Bug 15343 - POI cannot read Gnumeric files
Summary: POI cannot read Gnumeric files
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.0.2
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://www.gnumeric.org
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-13 02:12 UTC by Guenter Wolf
Modified: 2012-06-20 14:29 UTC (History)
1 user (show)



Attachments
Excel spreadsheet created with Gnumeric (14.00 KB, application/octet-stream)
2002-12-13 02:15 UTC, Guenter Wolf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guenter Wolf 2002-12-13 02:12:31 UTC
Jakarta POI cannot read Excel spreadsheet that were created by Gnumeric 
(www.gnumeric.org).
I don’t know if I should report this problem at Gnumeric or at POI.

Version information:
Gnumeric version 1.05 running under Linux
Jakarta POI 1.5.1

1.) Under Linux create with Gnumeric a spreadsheet like this:
col1	col2	col3
a	1	x
b	2	y
c	3	z
and save it in Excel format as gnumeric1.xls.


2.) Try to load the spreadsheets gnumeric1.xls with the example POIExample.java
The problem is that HSSFWorkbook calls createDocumentInputStream with a hard 
coded parameter "Workbook".
But Gnumeric creates Excel95 files, i.e. correct would be "Book".
-->
java.io.FileNotFoundException: no such entry: "Workbook"
        at org.apache.poi.poifs.filesystem.DirectoryNode.getEntry
(DirectoryNode.java:282)
        at 
org.apache.poi.poifs.filesystem.POIFSFileSystem.createDocumentInputStream
(POIFSFileSystem.java:356)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:139)
        at POIExample.main(POIExample.java:83)


3.) Try to  load the spredsheet gnumeric1.xls with the example EventExample.java
Here you have a chance to call explicitely poifs.createDocumentInputStream
( "Book").
However the call factory.processEvents(req, din) fails.
-->
java.lang.reflect.InvocationTargetException
        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:274)
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:246)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.processEvents
(HSSFEventFactory.java:141)
        at EventExample.main(EventExample.java:133)
Caused by: java.lang.ArrayIndexOutOfBoundsException
        at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:537)
        at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:148)
        at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:169)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:142)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:104)
        at org.apache.poi.hssf.record.BOFRecord.<init>(BOFRecord.java:134)
        ... 7 more
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record 
instance, the following exception 

occured: null
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:259)
        at org.apache.poi.hssf.eventmodel.HSSFEventFactory.processEvents
(HSSFEventFactory.java:141)
        at EventExample.main(EventExample.java:133)
Exception in thread "main"
Comment 1 Guenter Wolf 2002-12-13 02:15:45 UTC
Created attachment 4152 [details]
Excel spreadsheet created with Gnumeric
Comment 2 Andy Oliver 2002-12-13 03:17:02 UTC
Gnumeric creates Excel 95 worksheets.  HSSF is for Excel 97+.
Comment 3 Guenter Wolf 2002-12-13 03:50:49 UTC
I have created a feature request at Gnumeric
http://bugzilla.gnome.org/show_bug.cgi?id=101096
Comment 4 Mark B 2012-06-20 14:29:01 UTC
Can you please attach an example file that POI cannot open?