You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by luca finzi contini <lu...@yahoo.it> on 2005/11/16 17:23:33 UTC
XLS reading problem!
Hi all,
i'm using POI 2.5.1 to create and read XLS files.
The xls file lifecycle is:
- creation in my Java app;
- activeSync'ing to a handheld device --> xls gets
converted to Pocket Excel pxl format
- modifying the file on the handheld
- Active syncing back to the PC --> pxl file gets
re-converted to xls Excel 97/2000 format.
Then I try to read the xls with my java app.
I used the code in the example at HSSF:
...
FileInputStream inputStream = new
FileInputStream(fileName);
POIFSFileSystem fs = new POIFSFileSystem(
inputStream );
HSSFWorkbook wb = new HSSFWorkbook(fs);
...
I get the following exception:
java.io.IOException: Unable to read entire block; 295
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.java:88)
at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:123)
at ....
I found that if I open the problematic xls file with
Excel and re-save it, it all works fine.
I cannot do that in production! ;-) I need to parse
the file directly through my app.
Any suggestions will be highly appreciated!
Thank you all in advance!
Luca.
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: XLS reading problem!
Posted by luca finzi contini <lu...@yahoo.it>.
Leen,
I'm afraid it doesn't work --- I copied the file to an
'import' directory before processing it... I believe
it's something in the POI lib...
Thank you so much for the suggestion!
Luca.
--- Leen Toelen <to...@gmail.com> ha scritto:
> Can you try to first copy the file to a temp
> location and open that in
> poi? Maybe the file is still in use be the previous
> process or
> something like that.
>
> Regards,
> Leen Toelen
>
>
> On 11/16/05, luca finzi contini
> <lu...@yahoo.it> wrote:
> > Hi all,
> > i'm using POI 2.5.1 to create and read XLS files.
> > The xls file lifecycle is:
> > - creation in my Java app;
> > - activeSync'ing to a handheld device --> xls gets
> > converted to Pocket Excel pxl format
> > - modifying the file on the handheld
> > - Active syncing back to the PC --> pxl file gets
> > re-converted to xls Excel 97/2000 format.
> >
> > Then I try to read the xls with my java app.
> > I used the code in the example at HSSF:
> > ...
> > FileInputStream inputStream = new
> > FileInputStream(fileName);
> > POIFSFileSystem fs = new POIFSFileSystem(
> > inputStream );
> > HSSFWorkbook wb = new HSSFWorkbook(fs);
> > ...
> >
> >
> > I get the following exception:
> > java.io.IOException: Unable to read entire block;
> 295
> > 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.java:88)
> >
> > at
> >
>
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:123)
> >
> > at ....
> >
> > I found that if I open the problematic xls file
> with
> > Excel and re-save it, it all works fine.
> > I cannot do that in production! ;-) I need to
> parse
> > the file directly through my app.
> > Any suggestions will be highly appreciated!
> > Thank you all in advance!
> > Luca.
> >
> >
> >
> >
> >
> >
> >
> > ___________________________________
> > Yahoo! Mail: gratis 1GB per i messaggi e allegati
> da 10MB
> > http://mail.yahoo.it
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> poi-user-unsubscribe@jakarta.apache.org
> > Mailing List:
> http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:
> http://jakarta.apache.org/poi/
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> poi-user-unsubscribe@jakarta.apache.org
> Mailing List:
> http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:
> http://jakarta.apache.org/poi/
>
>
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: XLS reading problem!
Posted by Leen Toelen <to...@gmail.com>.
Can you try to first copy the file to a temp location and open that in
poi? Maybe the file is still in use be the previous process or
something like that.
Regards,
Leen Toelen
On 11/16/05, luca finzi contini <lu...@yahoo.it> wrote:
> Hi all,
> i'm using POI 2.5.1 to create and read XLS files.
> The xls file lifecycle is:
> - creation in my Java app;
> - activeSync'ing to a handheld device --> xls gets
> converted to Pocket Excel pxl format
> - modifying the file on the handheld
> - Active syncing back to the PC --> pxl file gets
> re-converted to xls Excel 97/2000 format.
>
> Then I try to read the xls with my java app.
> I used the code in the example at HSSF:
> ...
> FileInputStream inputStream = new
> FileInputStream(fileName);
> POIFSFileSystem fs = new POIFSFileSystem(
> inputStream );
> HSSFWorkbook wb = new HSSFWorkbook(fs);
> ...
>
>
> I get the following exception:
> java.io.IOException: Unable to read entire block; 295
> 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.java:88)
>
> at
> org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:123)
>
> at ....
>
> I found that if I open the problematic xls file with
> Excel and re-save it, it all works fine.
> I cannot do that in production! ;-) I need to parse
> the file directly through my app.
> Any suggestions will be highly appreciated!
> Thank you all in advance!
> Luca.
>
>
>
>
>
>
>
> ___________________________________
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
> http://mail.yahoo.it
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: XLS reading problem!
Posted by srikrishnudu <s....@berlinatlantic.com>.
Hi Luca,
Could you please tell me if you found the solution for this. Its a long time
which you posted it. Unfortunately I am facing the same problem when using
poi 3.0.1.
Thanks
Krishna
luca finzi contini wrote:
>
> Hi all,
> i'm using POI 2.5.1 to create and read XLS files.
> The xls file lifecycle is:
> - creation in my Java app;
> - activeSync'ing to a handheld device --> xls gets
> converted to Pocket Excel pxl format
> - modifying the file on the handheld
> - Active syncing back to the PC --> pxl file gets
> re-converted to xls Excel 97/2000 format.
>
> Then I try to read the xls with my java app.
> I used the code in the example at HSSF:
> ...
> FileInputStream inputStream = new
> FileInputStream(fileName);
> POIFSFileSystem fs = new POIFSFileSystem(
> inputStream );
> HSSFWorkbook wb = new HSSFWorkbook(fs);
> ...
>
>
> I get the following exception:
> java.io.IOException: Unable to read entire block; 295
> 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.java:88)
>
> at
> org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:123)
>
> at ....
>
> I found that if I open the problematic xls file with
> Excel and re-save it, it all works fine.
> I cannot do that in production! ;-) I need to parse
> the file directly through my app.
> Any suggestions will be highly appreciated!
> Thank you all in advance!
> Luca.
>
>
>
>
>
>
>
> ___________________________________
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
> http://mail.yahoo.it
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
>
>
--
View this message in context: http://www.nabble.com/XLS-reading-problem%21-tp1514698p25361739.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