poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DRINKARD, JAMES E (SBCSI)" <jd4...@sbc.com>
Subject Problem reading in a file
Date Tue, 11 Mar 2003 14:22:57 GMT
Hello All,
I'm trying to read in an excel file and I keep getting an error due to it
not being able to read the header? I made the file using POI and then
populated it with data. That part works fine. Then I try to read that file
in order to change it using the following code:

try
    {
      POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(fileName));  
  	  HSSFWorkbook wrkBk = new HSSFWorkbook(fs);

fileName is a string variable with the filename and path: ie
"c:\temp\test.xls".

The error is:
java.io.IOException: Unable to read entire header; -1 bytes read; expected
512 bytes
java.io.IOException: Unable to read entire header; -1 bytes read; expected
512 bytes
	at
org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java
:114)
	at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:
120)
	at
com.sbc.ecom.iris.batch.reports.totals.Totals.main(Totals.java:303)

I know from other documentation I read that the header gets read first, so
if it can't find it or interpret it, I assume this is the error one would
get.

Any ideas as to what I'm doing wrong?

Thanks,
James

Mime
View raw message