https://issues.apache.org/bugzilla/show_bug.cgi?id=51440
Bug #: 51440
Summary: Unable to construct record instance
Product: POI
Version: 3.7
Platform: PC
Status: NEW
Severity: critical
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 27217
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27217
the excel file
Error occur when i deal excel 2003 files with poi.
(btw: the hssf.xls file is created by ms office 2003 directly.
and i use FileFormatConverters.exe Compatibility Pack for opening office2007
files.
http://www.microsoft.com/download/en/details.aspx?id=3
now i see FileFormatConverters.exe is the right reason why this error occur.
please see the picture attached.
The code like this: (hssf.xls as attached.)
=============================================================
import java.io.FileInputStream;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class PoiTest {
public static void main(String[] args) {
FileInputStream in;
try {
in = new FileInputStream("e:/hssf.xls");
POIFSFileSystem f = new POIFSFileSystem(in);
HSSFWorkbook wb = new HSSFWorkbook(f);
System.out.println("ok");
} catch (Exception e) {
e.printStackTrace();
}
}
}
The exception as bellow:
=================================================================
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:170)
at PoiTest.main(PoiTest.java:37)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Expected to find a
ContinueRecord in order to read remaining 4 of 14 chars
at
org.apache.poi.hssf.record.RecordInputStream.readStringCommon(RecordInputStream.java:353)
at
org.apache.poi.hssf.record.RecordInputStream.readString(RecordInputStream.java:293)
at org.apache.poi.hssf.record.SupBookRecord.<init>(SupBookRecord.java:96)
at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:57)
... 8 more
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]