You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by amp834 <am...@rqinc.com> on 2010/02/21 23:47:30 UTC

Error opening xls97.xls file using HSSF, "Ran out of record data trying to read formula"

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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Error opening xls97.xls file using HSSF, "Ran out of record data trying to read formula"

Posted by MSB <ma...@tiscali.co.uk>.
Sorry to say that I do not know the answer to your question - though one of
the developers may very well do so - but I would like to ask, is it possible
for you to attach the problematic file - confidentiality permitting - so
that they could look through it for the cause. Better still, is it possible
for you to create a very simple, small file that reproduces the problem?
That will isolate the cell or cells - and, of course, their contents - that
give rise to this issue.

Yours

Mark B


amp834 wrote:
> 
> 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-tp27677294p27689766.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org