poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Natu, Ashlesha [IT]" <ashlesha.n...@citigroup.com>
Subject RE: JakartaPOI - read excel file using HSSF
Date Tue, 28 Mar 2006 15:07:44 GMT
Hi all,

Can someone help me with the below problem??...I am stuck at this point...

thanks, AN

-----Original Message-----
From: Natu, Ashlesha [IT] 
Sent: Monday, March 27, 2006 2:17 PM
To: poi-dev@jakarta.apache.org
Subject: JakartaPOI - read excel file using HSSF

I am trying to read an Excel 2000 file using HSSF. If I hardcode the filename, the code reads
it perfectly. But if I upload the file from the browser into a ServletInputStream, I get an
IOException - Invalid Header signature.
My code is:
ServletInputStream is = request.getInputStream();
InputStream ins = (InputStream)is;
POIFSFileSystem fs = new POIFSFileSystem(ins);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(1);
HSSFCell cell = row.getCell((short)0);
String c1 = cell.getStringCellValue();
If I do 
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("Test.xls")); 
instead, it reads the contents without errors. 
I am getting the following exception:
java.io.IOException: Invalid header signature; read 3255307777713450285, expected -2226271756974174256
Please help.
thanks, AN

To unsubscribe, e-mail: poi-dev-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 raw message