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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > --------------------------------------------------------------------- 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/
