poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Read, David" <david.r...@blueslate.net>
Subject RE: Problem reading in a file
Date Tue, 11 Mar 2003 14:35:23 GMT
James,

Did you output the value of fileName to prove it isn't mangled in some way?
Did you escape the backslashes?  i.e.

String fileName = "c:\\temp\\test.xls";

-Dave

-----Original Message-----
From: DRINKARD, JAMES E (SBCSI) [mailto:jd4147@sbc.com]
Sent: Tuesday, March 11, 2003 9:23 AM
To: poi-user@jakarta.apache.org
Subject: Problem reading in a file


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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org

Mime
View raw message