I get an error trying to open an xls97.xls file.  From the traceback, I'm
guessing org.apache.poi.hssf.record::ExternalNameRecord.hasFormula() may be
the cause, but I have no idea.

Can anyone think of a workaround for this?
The file opens ok in MsWord and in Quick View Plus.

Here's my code:
    public static void extractXls97(String filename) {
        try {
            POIFSFileSystem fs = null;
            fs = new POIFSFileSystem(new FileInputStream(filename));
            org.apache.poi.hssf.usermodel.HSSFWorkbook doc = new
org.apache.poi.hssf.usermodel.HSSFWorkbook(fs);
     (other details omitted)


Here's the stack/traceback (

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException:
Unable to construct record instance
        at
org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:64)
        at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:263)
        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:392)
        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:183)
        at test1.readDoc.extractXls97(cExtractDocPoifs.java:1082)
        at test1.readDoc.main(cExtractDocPoifs.java:1343)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Ran out of
record data trying to read formula. fields: (option=-12 index=31453
not_used=4 name=''')
        at
org.apache.poi.hssf.record.ExternalNameRecord.readFail(ExternalNameRecord.java:177)
        at
org.apache.poi.hssf.record.ExternalNameRecord.<init>(ExternalNameRecord.java:164)
        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$ReflectionRecordCreator.create(RecordFactory.java:56)
        ... 9 more
Java Result: 1

-- 
View this message in context: 
http://old.nabble.com/Error-opening-xls97.xls-file-using-HSSF%2C-%22Ran-out-of-record-data-trying-to-read-formula%22-tp27677294p27677294.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to