No we are just slow to update the website. There are problems with *reading* images in the 2.5 series. It writes them just fine, just has issues reading them. Drop to 2.0.x. Shortly I'll add a "ignore images" bit twiddle if no one beats me to it.

Ric Dargusch wrote:
Hi-

I'm new to HSSF (and java for that matter).
I note that POI claims to work for Excel -2002,
and I have Excel 2003.  Will that cause me grief?


I am getting an exception in the following piece of code:


    private static HSSFWorkbook getWorkbook(String fname)
    {
        HSSFWorkbook wb = null;
        try {
            POIFSFileSystem  fs = new POIFSFileSystem(new
FileInputStream(fname));
            System.out.println("Got the FileInputStream...");
            wb = new HSSFWorkbook(fs);          <-- Exception occurs here.
            System.out.println("Got the workbook");
        }
        catch (java.io.FileNotFoundException e)
        {
            System.out.println("File not found!  Please try again.");
            System.exit(-1);
        }
        catch (java.io.IOException e2)
        {
            System.out.println("POI FS had some kind of problem.
Bailing...");
            System.exit(-2);
        }
        return wb;
    }


What am I doing wrong? I'll include the stack trace below, in case that helps somebody with this.

Thanks!
-Ric



C:\java\JBuilder\jdk1.4\bin\javaw -classpath
"C:\work\JAGUAR\src\com\draper\jaguar\tool\tab\classes;C:\work\JAGUAR\src\li
b\log4j-1.2.7.jar;C:\work\JAGUAR\src\lib\JaguarModels.jar;C:\work\JAGUAR\src
\lib\modelIndex.jar;C:\work\JAGUAR\src\lib\jaguar-schema.jar;C:\work\JAGUAR\
src\lib\xbean.jar;C:\java\JBuilder\jdk1.4\jre\javaws\javaws.jar;C:\java\JBui
lder\jdk1.4\jre\lib\charsets.jar;C:\java\JBuilder\jdk1.4\jre\lib\ext\dnsns.j
ar;C:\java\JBuilder\jdk1.4\jre\lib\ext\ldapsec.jar;C:\java\JBuilder\jdk1.4\j
re\lib\ext\localedata.jar;C:\java\JBuilder\jdk1.4\jre\lib\ext\sunjce_provide
r.jar;C:\java\JBuilder\jdk1.4\jre\lib\im\indicim.jar;C:\java\JBuilder\jdk1.4
\jre\lib\im\thaiim.jar;C:\java\JBuilder\jdk1.4\jre\lib\jce.jar;C:\java\JBuil
der\jdk1.4\jre\lib\jsse.jar;C:\java\JBuilder\jdk1.4\jre\lib\plugin.jar;C:\ja
va\JBuilder\jdk1.4\jre\lib\rt.jar;C:\java\JBuilder\jdk1.4\jre\lib\sunrsasign
.jar;C:\java\JBuilder\jdk1.4\lib\dt.jar;C:\java\JBuilder\jdk1.4\lib\htmlconv
erter.jar;C:\java\JBuilder\jdk1.4\lib\tools.jar"
com.draper.jaguar.tool.tab.driver Got the FileInputStream...
java.lang.reflect.InvocationTargetException     at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224
)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:16
0)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
        at com.draper.jaguar.tool.tab.driver.getWorkbook(driver.java:81)
        at com.draper.jaguar.tool.tab.driver.excelDriver(driver.java:62)
at com.draper.jaguar.tool.tab.driver.main(driver.java:51) Caused by: java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at
org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
        at
org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
        at
org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
... 11 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:237
)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:16
0)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
        at com.draper.jaguar.tool.tab.driver.getWorkbook(driver.java:81)
        at com.draper.jaguar.tool.tab.driver.excelDriver(driver.java:62)
at com.draper.jaguar.tool.tab.driver.main(driver.java:51) Exception in thread "main"


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to