XFExt 0x000B throws exception #298

Closed
opened 2015-09-08 13:22:30 +00:00 by aetna-softwares · 5 comments
aetna-softwares commented 2015-09-08 13:22:30 +00:00 (Migrated from github.com)

I received a file XLS that I parsed using

XLS.readFile(importFile) ;

it failed with error "bafuqb"

After some debugging, I found that it is due to the presence of a XFExt with value 0x000B which is not known by the function :

/* xf is an XF, see parse_XFExt for xfext */
function update_xfext(xf, xfext) {
    xfext.forEach(function(xfe) {
        switch(xfe[0]) { /* 2.5.108 extPropData */
            case 0x04: break; /* foreground color */
            case 0x05: break; /* background color */
            case 0x07: case 0x08: case 0x09: case 0x0a: break;
            case 0x0d: break; /* text color */
            case 0x0e: break; /* font scheme */
            default: throw "bafuq" + xfe[0].toString(16);
        }
    });
}

Looking at MSDN documentation (https://msdn.microsoft.com/en-us/library/dd906769(v=office.12).aspx), this value is about "the diagonal cell border color".

adding the following case solved my problem :

            case 0x0b: break; 

A workaround to read the file, is to manually open it in Excel before a remove all cell formatting

please note that it seems that values 0x06 and 0x0f are also missing in the function

I received a file XLS that I parsed using ``` XLS.readFile(importFile) ; ``` it failed with error "bafuqb" After some debugging, I found that it is due to the presence of a XFExt with value 0x000B which is not known by the function : ``` /* xf is an XF, see parse_XFExt for xfext */ function update_xfext(xf, xfext) { xfext.forEach(function(xfe) { switch(xfe[0]) { /* 2.5.108 extPropData */ case 0x04: break; /* foreground color */ case 0x05: break; /* background color */ case 0x07: case 0x08: case 0x09: case 0x0a: break; case 0x0d: break; /* text color */ case 0x0e: break; /* font scheme */ default: throw "bafuq" + xfe[0].toString(16); } }); } ``` Looking at MSDN documentation (https://msdn.microsoft.com/en-us/library/dd906769(v=office.12).aspx), this value is about "the diagonal cell border color". adding the following case solved my problem : ``` case 0x0b: break; ``` A workaround to read the file, is to manually open it in Excel before a remove all cell formatting please note that it seems that values 0x06 and 0x0f are also missing in the function
baharudinafif commented 2017-01-02 04:13:50 +00:00 (Migrated from github.com)

+1

+1
reviewher commented 2017-01-02 04:15:21 +00:00 (Migrated from github.com)

Can you share a sample file showing this?

Can you share a sample file showing this?
baharudinafif commented 2017-01-02 04:22:50 +00:00 (Migrated from github.com)
@reviewher this is the file that make an error https://drive.google.com/file/d/0BzBSiEsMzvbYWkx0WXlCYjNnSjg/view?usp=sharing
aimcom commented 2017-01-19 13:11:47 +00:00 (Migrated from github.com)

When trying to import an Excel file (format "XLS") with js-xlsx 0.8.1, I got the error "bafuqb", too.
I've created a small Excel file with only one row and no content to reproduce the problem:
https://drive.google.com/open?id=0B09zLCh79hV5NzVVMUR3ZzhUcEE

When trying to import an Excel file (format "XLS") with js-xlsx 0.8.1, I got the error "bafuqb", too. I've created a small Excel file with only one row and no content to reproduce the problem: https://drive.google.com/open?id=0B09zLCh79hV5NzVVMUR3ZzhUcEE
SheetJSDev commented 2017-03-13 04:52:15 +00:00 (Migrated from github.com)

Thanks @aimcom @baharudinafif that throw statement should have been guarded with a WTF check. We're removing the throw in 0.9.2

Thanks @aimcom @baharudinafif that throw statement should have been guarded with a WTF check. We're removing the throw in 0.9.2
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#298
No description provided.