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
Created attachment 23468 [details] Workbook as exported from google docs
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