Bug 45901 - Error Opening Excel .xls file in mhtml format <Rel. POI 3.1>
Summary: Error Opening Excel .xls file in mhtml format <Rel. POI 3.1>
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 3.1-FINAL
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-26 12:26 UTC by Madan
Modified: 2008-09-26 13:01 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Madan 2008-09-26 12:26:05 UTC
Hello,

I am generating the Cognos Reports through Java using Cognos API. While generating the reports we set the outputformat to XLWA (Microsoft Excel Web Archive (XLWA) format). The reports generated files have .xls extension.

When I try to read this file it gives me the following error:

------------------------------------------------------------------
java.io.IOException: Invalid header signature; read 8243089445407770957, expected -2226271756974174256
        at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:112)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
-------------------------------------------------------------------

If I open and save one of the report files in XLS format. The POI is able to read it correctly. Looks like it is unable to recognize the format. But since these reports are generated in batch mode and in huge number it is practically not possible to open and save all these reports in XLS format. Also, if I try to use SaveAs of MS-Excel, it show the SaveAs file Type to be mthml.

I will appreciate if you could give me some pointers on this.

Thanks in advance!
Comment 1 Nick Burch 2008-09-26 13:01:41 UTC
IIRC, mhtml = html in a specific format

The error tells you that the file isn't in ole2 format, so isn't a "real" excel file

If it's html, just process it with a html parser