When I tried to read an Excel file in Java it throws "biff exception".
What does this mean? I tried to Google it but wasn't able to find a proper explanation.
jxl.read.biff.BiffExc开发者_JS百科eption: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at Com.Parsing.ExcelFile.excel(Extract.java:20)
at Com.Parsing.Extract.main(Extract.java:55)
I also faced similar problem and was able to fix it.
I was using a .xlsx file and when I changed it to .xls file, it worked just fine. Seems JXL doesn't support .xlsx format.
Please correct me if somebody knows that it supports.
The javadoc for BiffException.
Exception thrown when reading a biff file.
This exception has a number of messages that should provide some information about the cause:
excelFileNotFound
excelFileTooBig
expectedGlobals
passwordProtected
streamNotFound
unrecognizedBiffVersion
unrecognizedOLEFile
Edit:
unrecognizedOLEFile
seems to mean that something is embedded in the file that cannot be read.
An Excel workbook with several sheets (from BIFF5 on) is stored using the compound document file format (also known as “OLE2 storage file format” or “Microsoft Office compatible storage file format”). It contains several streams for different types of data.
A complete documentation of the format of compound document files can be found at http://sc.openoffice.org/compdocfileformat.pdf
I think the exception mean that your parsing library can not recognise it(For example:biff5 format can not be parsed in POI and Jexcelapi). You can check your file version be open it in Office and click 'SAVE AS',the format list in the filedialog is it's current file version.
精彩评论