Please take a look at the file sample.xls clcik here
I was using Apache-Poi to read xls files and convert them into HTML table format.
For few files the POIFSFileSystem (inputStream) could not take the inputStream.
There is an exception and it is:
java.io.IOException: Unable to read entire header; 36 bytes read; expected 512 bytes
at org.apache.poi.poifs.storage.HeaderBlock.alertShortRead(HeaderBlock.java:226)
at org.apache.poi.poifs.storage.HeaderBlock.readFirst512(HeaderBlock.java:207)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:138)
at openReports.ReadExcelSheet.readExcelFile(ReadExcelSheet.java:24)
at openReports.ReadFolderInMail.getDetailsOfMail(ReadFolderInMail.java:109)
at openReports.ReadFolderInMail.getDetailsOfMail(ReadFolderInMail.java:104)
at openReports.OpenReportsProject.main(OpenReportsProject.java:55)
I could notice, that is because of the file which is saved as xls file but the file format is not 2003.
I get these files from a different source,hence I cannot manually change the file extensions. If I download them and change them then the problem is resolved.
But I cannot do it every time because it should be run as a scheduler.
So can someone please suggest a solution to this.
Thank you.