Hi, I get the following error when reading a Exel file with POI 3.7.
Exception in thread "main"
org.apache.poi.hssf.record.RecordFormatException: Unable to construct
record instance
at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:65)
at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:300)
at
org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:270)
at
org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:236)
at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:442)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:263)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:188)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:305)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:286)
at aflat4.apps.adr.POITest.main(POITest.java:18)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Not
enough data (1) to read requested (2) bytes
at
org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:216)
at
org.apache.poi.hssf.record.RecordInputStream.readUShort(RecordInputStream.java:267)
at org.apache.poi.util.StringUtil.readUnicodeLE(StringUtil.java:277)
at
org.apache.poi.hssf.record.common.UnicodeString$ExtRst.<init>(UnicodeString.java:172)
at
org.apache.poi.hssf.record.common.UnicodeString.<init>(UnicodeString.java:438)
at
org.apache.poi.hssf.record.SSTDeserializer.manufactureStrings(SSTDeserializer.java:55)
at org.apache.poi.hssf.record.SSTRecord.<init>(SSTRecord.java:250)
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$ReflectionConstructorRecordCreator.create(RecordFactory.java:57)
... 9 more
The file is saved with Excel 2003. It's a confidential file, so I
can't provide the file here. BiffViewer reveals a weired UNKNOWNRECORD
right before the error occurs. Below is the last part of BiffViewer
output.
Offset=0x00002661(9825) recno=402 sid=0x0018 size=0x001B(27)
[NAME]
.option flags = 0x0020
.keyboard shortcut = 0x00
.length of the name = 1
.extSheetIx(1-based, 0=Global)= 0
.sheetTabIx = 31
.Menu text length = 0
.Description text length= 0
.Help topic text length = 0
.Status bar text length = 0
.NameIsMultibyte = false
.Name (Unicode text) = Print_Area
.Formula (nTokens=1):
org.apache.poi.hssf.record.formula.Area3DPtg [sheetIx=12 ! $A$1:$E$32]R
.Menu text =
.Description text=
.Help topic text =
.Status bar text =
[/NAME]
Offset=0x00002680(9856) recno=403 sid=0x01C1 size=0x0008(8)
[RECALCID]
.reserved = 0x0000
.engineId = 0x0001BE22
[/RECALCID]
Offset=0x0000268C(9868) recno=404 sid=0x0866 size=0x0F5E(3934)
[UNKNOWNRECORD] (0x866)
rawData=[66, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 0F,
00, 00, F0, 48, 0F, 00, 00, 00, 00, 06, F0, 28, 0F, 00, 00, 01, 8C,
07, 00, E4, 01, 00, 00, E3, 01, 00, 00, 00, 00, 00, 00, 01, 00, 00,
00, 01, 00, 00, 00, 02, 00, 00, 00, 01, 00, 00, 00, 01, 00, 00, 00,
01, 00, 00, 00, 02, 00, 00, 00, 01, 00, 00, 00, 03, 00, 00, 00, 01,
00, 00, 00, 04, 00, 00, 00, 01, 00, 00, 00, 05, 00, 00, 00, 01, 00,
00, 00, 06, 00, 00, 00, 01, 00, 00, 00, 07, 00, 00, 00, 01, 00, 00,
00, 08, 00, 00, 00, 01, 00, 00, 00, 09, 00, 00, 00, 01, 00,
...... ****LONG DATA HERE**** .....
]
[/UNKNOWNRECORD]
Offset=0x000035EE(13806) recno=405 sid=0x00EB size=0x0242(578)
[MSODRAWINGGROUP]
No Escher Records Decoded
[/MSODRAWINGGROUP]
*****ERROR OCCURS HERE*****
Please help.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]