Hi Toni,

thanks for your hint. But in my case the excel template could be found. If
not the error message differs a little bit. 
I don't really understand why but the statement
'fs = new POIFSFileSystem(new BufferedInputStream(excel));' is the one I
needed. I always tried it with 'fs = new POIFSFileSystem(excel);' because
POIFSFileSystem takes an InputStream and that is what excel is.

Bye,

Michael.
 
-----Original Message-----
From: Toni Penttinen
To: 'POI Users List'
Sent: 19.03.2003 18:55
Subject: RE: Opening excel files out of jar

Hi,
Your error just means that excel template has not been found .. below is
little snippet which should give you a hint

POIFSFileSystem fs = null;
                InputStream excel =
                        getClass().getResourceAsStream(
        
"/com/example/report/templates/template.xls");
                if (excel != null) {
                        try {
                                fs = new POIFSFileSystem(new
BufferedInputStream(excel));
                        } catch (IOException e) {
                                e.printStackTrace();
                        }


-----Original Message-----
From: Fankanowsky, Michael [mailto:[EMAIL PROTECTED] 
Sent: 19. maaliskuuta 2003 17:13
To: '[EMAIL PROTECTED]'
Subject: Opening excel files out of jar


Hi all,

I have problems opening an excel template out of a jar file. I tried
both
... new POIFSFileSystem(...getResourceAsStream(<filename>)) and  ... new
POIFSFileSystem(...getResource(<filename>).openStream())
and received following IOException:

java.io.IOException: Unable to read entire block; 44 bytes read;
expected
512 bytes
        at
org.apache.poi.poifs.storage.RawDataBlock.<init>(RawDataBlock.java:98)
        at
org.apache.poi.poifs.storage.RawDataBlockList.<init>(RawDataBlockList.ja
va:8
8)
        at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.j
ava:
123)

When running the code in IDE I don't have any problem.
I use jakarta-poi-1.10.0-dev-20030222 and eclipse.

Does anybody have an idea ?

Kind regards,

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to