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.

js-xlsx exported XLS BIFF8 and Apache-POI XLS reading function compatibility issue

See original GitHub issue

Dear SheetJS developers,

js-xlsx is incompatible with Apache-POI XLS reading function. Here is a sample maven project which can be complied to instantly reproduce the error: poirun.zip When opening js-xlsx generated document with Apache-POI library a following error occurs:

Exception in thread "main" java.lang.RuntimeException: Found EOFRecord before WindowTwoRecord was encountered at org.apache.poi.hssf.model.RecordOrderer.isEndOfRowBlock(RecordOrderer.java:430) at org.apache.poi.hssf.model.RowBlocksReader.<init>(RowBlocksReader.java:58) at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:181) at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:122) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:354) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:400) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:381) at poirun.ApachePOIExcelRead.main(ApachePOIExcelRead.java:21)

I have tried generating the file with bookSST set as true and false, what did not help. Also the target application for which I am generating this file only supports reading XLS BIFF8 files via Apache-POI API.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cordovapolymercommented, Aug 30, 2019

Thank you for you reply, I have found the solution which can be added to the Docs: wb.Workbook = { Views: [‘Window2’] }; Can be added before calling XLSX.write, then Window2 is created and the file is successfully opened by Apache POI.

0reactions
SheetJSDevcommented, Dec 25, 2019

To be sure, you could also write:

if(!wb.Workbook) wb.Workbook = {};
if(!wb.Workbook.Views) wb.Workbook.Views = [];

and that would trigger the Window2 generation.

Please direct further comments to the Apache POI project https://bz.apache.org/bugzilla/show_bug.cgi?id=63708 .

@cordovapolymer we’d accept a PR that makes the change in step 1 from https://github.com/SheetJS/sheetjs/issues/1612#issuecomment-526530072

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error reading Excel .XLSX with Apache POI - Stack Overflow
The web app has access to the file, if that is what you are asking. It only reads (no modify). On a related...
Read more >
The New Halloween Document - Apache POI
HSSF allows numeric, string, date or formula cell values to be written to or read from an XLS file. Also in this release...
Read more >
Read / Write Excel file in Java using Apache POI - ViralPatel.net
Apache POI is a powerful Java library to work with different Microsoft Office file formats such as Excel, Power point, Visio, MS Word...
Read more >
Microsoft Office Excel 97-2003 Binary File Format (.xls, BIFF8)
File conversion packages that can read XLS files but not write them include: Aspose Cells (including a free online viewer at https://products.
Read more >
Read & Write Data from Excel in Selenium: Apache POI
HSSFWorkbook- These class methods are used to read/write data to Microsoft Excel file in .xls format. It is compatible with MS-Office versions ...
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