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 JakartaPOI - read excel file using HSSF
Date Mon, 27 Mar 2006 19:17:03 GMT
Hi, 
 
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message