Hi, I'm new in this list, and I've just begun to use POI too.
I'm trying to create a workbook in a servlet, to read an Excel file submitted 
by a form.

This is exactly what I'm doing:

-------------------
import org.apache.poi.hssf.usermodel.*;
...

 ServletInputStream is = request.getInputStream();

 byte[] junk = new byte[1024];
 int bytesRead = 0;

 // the first four lines are request junk...
 bytesRead = is.readLine(junk, 0, junk.length);
 bytesRead = is.readLine(junk, 0, junk.length);
 bytesRead = is.readLine(junk, 0, junk.length);
 bytesRead = is.readLine(junk, 0, junk.length);

 HSSFWorkbook workbook = new HSSFWorkbook(is);
 HSSFSheet sheet = workbook.getSheetAt(0);
----------------------

This is the error I'm receiving:

java.io.IOException: Unable to read entire block; 48 bytes read; expected 512 
bytes

when creating the workbook.
I`m using Apache Tomcat 5.5, jdk 1.5.0_04 in a Windows XP machine.

Any ideas??

Thanks!

Alexis.

Reply via email to