Bug 45649 - Unable to create excel file
Summary: Unable to create excel file
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2008-08-18 21:42 UTC by Rohit
Modified: 2010-06-03 07:28 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Rohit 2008-08-18 21:42:04 UTC
I am trying to read a excel file using POI and getting following the following exception.

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
	at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:117)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:148)
	at com.abc.handler.NAVXLSFileHandler.createWorkBook(NAVXLSFileHandler.java:323)
	at com.abc.handler.NAVXLSFileHandler.main(NAVXLSFileHandler.java:230)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:187)
	... 5 more
Caused by: java.lang.IllegalArgumentException: compressByte in continue records must be 1 while reading unicode LE string
	at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:260)
	at org.apache.poi.hssf.record.TextObjectRecord.processRawString(TextObjectRecord.java:194)
	at org.apache.poi.hssf.record.TextObjectRecord.fillFields(TextObjectRecord.java:49)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
	at org.apache.poi.hssf.record.TextObjectBaseRecord.<init>(TextObjectBaseRecord.java:80)
	at org.apache.poi.hssf.record.TextObjectRecord.<init>(TextObjectRecord.java:37)
	... 10 more
Comment 1 Josh Micich 2008-08-19 00:56:14 UTC
POI assumes that the compress flag will not change across CONTINUE records.  There are no existing test samples that violate this assumption.  I assume the spreadsheet opens OK in Excel. 

Please upload a sample spreadsheet which produces this problem.  For interest, which application produced the spreadsheet?
Comment 2 Nick Burch 2010-06-03 07:28:26 UTC
This bug references a very old version of POI. As no new comments have been added in a long time, I'm assuming that this bug has now been fixed

If the bug still exists with the latest version of POI, please re-open the bug and add a comment indicating this, ideally also with a failing unit test