question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XFExt 0x000B throws exception

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SheetJSDevcommented, Mar 13, 2017

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

0reactions
aimcomcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Throw Exceptions in Java - Rollbar
Throwing an exception is as simple as using the "throw" statement. You then specify the Exception object you wish to throw. Every Exception...
Read more >
How to Throw Exceptions (The Java™ Tutorials > Essential ...
Regardless of what throws the exception, it's always thrown with the throw statement. As you have probably noticed, the Java platform provides numerous ......
Read more >
Creating and Throwing Exceptions | Microsoft Learn
The runtime then searches for the most compatible exception handler. Programmers should throw exceptions when one or more of the following ...
Read more >
throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current function will stop (the statements after throw won't be ...
Read more >
Mockito test a void method throws an exception - Stack Overflow
The parentheses are poorly placed. You need to use: doThrow(new Exception()).when(mockedObject).methodReturningVoid(...); ^. and NOT use:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found