Try to construct your workbook using NPOIFS:
File file = new File("ExcelIn.xls");
Workbook wb = new HSSFWorkbook(new NPOIFSFileSystem(file).getRoot(), true);
Yegor
On Thu, Jul 28, 2011 at 1:02 PM, David González Casín
<[email protected]> wrote:
> As I said, I have the same problem as described in Bug 48261.
>
> I use POI 3.7, I try to open a .xls file (which is built by PHPExcel as far
> as I know) and I get this error:
>
> true
> Warning, incorrectly terminated empty data blocks in POIFS block listing
> (should end at -2, ended at 0)
>
> I use this test code:
>
> File file = new File("ExcelIn.xls");
> System.out.println(file.exists());
> FileInputStream in = new FileInputStream(file);
> Workbook workbook = WorkbookFactory.create(in);
>
> Is it true, as the last comment on this bug suggests, that POI 3.8 is more
> tolerant and such files can be opened? I can't open the sample file attached
> in this bug. So I wonder how to get it work.
>
> David
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Yegor Kozlov [mailto:[email protected]]
> Gesendet: Donnerstag, 28. Juli 2011 10:21
> An: POI Users List
> Betreff: Re: SXSSF in POI 3.8
>
> SXSSF won't help you, it is a API for writing large .xlsx files, not
> for reading.
>
> Please describe your problem in detail.
>
> - What version of POI are you running?
> - What file are you opening? .xls or .xlsx ?
> - Post the stack trace of the exception
>
> Without details we can't do much to help you.
>
> Yegor
>
> On Thu, Jul 28, 2011 at 11:52 AM, David González Casín
> <[email protected]> wrote:
>> Hi,
>>
>>
>>
>> I have the problem to open some Excel files, I guess it's nearly the same
>> problem described here:
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=48261
>>
>>
>>
>> The last answer gives the hint that it can be solved with POI 3.8, but I
>> don't know how. I tried with HSSFWorkbook and XSSFWorkbook, but with both
> it
>> doesn't work (same behavior as in POI 3.7). Then I read something about
>> SXSSFWorkbook, but there are only examples to write an Excel file, not to
>> read. I'm not sure if it is possible with SXSSF at all or if I need
>> something else.
>>
>>
>>
>> Could you help me and give a little code example or a hint?
>>
>>
>>
>> Best regards
>>
>>
>>
>> David
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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]