js-xlsx exported XLS BIFF8 and Apache-POI XLS reading function compatibility issue
See original GitHub issueDear 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:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
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.
To be sure, you could also write:
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