DRINKARD, JAMES E (SBCSI) wrote:
Yes, I used the correct escape characters. I even tried hardcoding the path/filename string as an argument and it still fails.
-----Original Message----- From: Read, David [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 8:35 AM To: 'POI Users List' Subject: RE: Problem reading in a file
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:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 9:23 AM To: [EMAIL PROTECTED] 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: [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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
