Bug 47001 - Cannot read workbook exported from Google Docs
Summary: Cannot read workbook exported from Google Docs
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://mail-archives.apache.org/mod_m...
Depends on:
Reported: 2009-04-08 13:34 UTC by Josh Micich
Modified: 2009-04-08 14:17 UTC (History)
0 users

Workbook as exported from google docs (23.50 KB, application/vnd.ms-excel)
2009-04-08 13:40 UTC, Josh Micich

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Micich 2009-04-08 13:34:58 UTC
Created due to posting by Karim Ratib

org.apache.poi.hssf.record.RecordFormatException: Unable to construct
record instance
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:226)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:352)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:59)
	at TestPOI.main(TestPOI.java:12)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Not
enough data (0) to read requested (1) bytes
	at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:185)
	at org.apache.poi.hssf.record.RecordInputStream.readByte(RecordInputStream.java:193)
	at org.apache.poi.hssf.record.RecordInputStream.readUByte(RecordInputStream.java:223)
	at org.apache.poi.util.StringUtil.readCompressedUnicode(StringUtil.java:121)
	at org.apache.poi.hssf.record.WriteAccessRecord.<init>(WriteAccessRecord.java:62)
	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:513)
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:224)
	... 7 more
Comment 1 Josh Micich 2009-04-08 13:40:00 UTC
Created attachment 23468 [details]
Workbook as exported from google docs
Comment 2 Josh Micich 2009-04-08 14:17:45 UTC
Looks like Google Docs is writing the username field of the WRITEACCESS(0x005C) without the standard string 3 byte header.  The OOO doc says that this is optional, so it seems reasonable that POI should handle that situation.

There an additional problem encountered with the LinkTable.  This workbook is also missing its EXTERNSHEET records.  POI has been changed to tolerate this too.

After the two changes, POI can successfully read and write the workbook.  However, it is not clear whether the problem with the LinkTable has been fully addressed.

Fixed in svn r763391

junits added