Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XFExt 0x000B throws exception #298

Closed
aetna-softwares opened this issue Sep 8, 2015 · 5 comments
Closed

XFExt 0x000B throws exception #298

aetna-softwares opened this issue Sep 8, 2015 · 5 comments

Comments

@aetna-softwares
Copy link

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
Copy link

1

@reviewher
Copy link
Contributor

Can you share a sample file showing this?

@baharudinafif
Copy link

baharudinafif commented Jan 2, 2017

@aimcom
Copy link

aimcom commented Jan 19, 2017

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
Copy link
Contributor

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

saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 18, 2020
- decode sheet name for XLSX and XLML (fixes SheetJS#203 h/t @rocketmonkeys)
- XFExt (fixes SheetJS#298 h/t @aetna-softwares @aimcom @baharudinafif)
- handle truly empty `<is>` elements (fixes SheetJS#506 h/t @asksahil)
- pin version numbers for dependencies (fixes SheetJS#469 h/t @nhtera)
- sed usage fix (see SheetJS#572 h/t @Liryna)
- fix hex2RGB substr indices (fixes SheetJS#294 h/t @kamorahul)
- removed stale typescript files (see SheetJS#442)
- reworked shift formula regex (fixed SheetJS#551 h/t @SheetJSDev)
- README note on webpack codepage suppression (fixes SheetJS#438 h/t @rusty1s)
- README note on WTF (fixes SheetJS#487 h/t @livesoftware)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants