Java中的Biff异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1747665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Biff exception in Java
提问by Karthik.m
When I tried to read an Excel file in Java it throws "biff exception".
当我尝试用 Java 读取 Excel 文件时,它会抛出“biff 异常”。
What does this mean? I tried to Google it but wasn't able to find a proper explanation.
这是什么意思?我试着用谷歌搜索,但找不到合适的解释。
jxl.read.biff.BiffException: 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)
采纳答案by Thomas Jung
The javadoc for BiffException.
BiffException的 javadoc 。
Exception thrown when reading a biff file.
读取 biff 文件时抛出异常。
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.
unrecognizedOLEFile
似乎意味着文件中嵌入了无法读取的内容。
回答by unwind
回答by liya
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.
包含多个工作表的 Excel 工作簿(从 BIFF5 开始)使用复合文档文件格式(也称为“OLE2 存储文件格式”或“Microsoft Office 兼容存储文件格式”)进行存储。它包含用于不同类型数据的多个流。
A complete documentation of the format of compound document files can be found at http://sc.openoffice.org/compdocfileformat.pdf
有关复合文档文件格式的完整文档,请访问 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.
我认为异常意味着您的解析库无法识别它(例如:在POI和Jexcelapi中无法解析biff5格式)。您可以检查您的文件版本在 Office 中打开它并单击“另存为”,文件对话框中的格式列表是它的当前文件版本。
回答by Dee
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.
我使用的是 .xlsx 文件,当我将其更改为 .xls 文件时,它工作得很好。似乎 JXL 不支持 .xlsx 格式。
Please correct me if somebody knows that it supports.
如果有人知道它支持,请纠正我。