当我尝试初始化 Workbook 对象时,我总是收到此错误:
The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
但我按照办公室示例执行此操作,以下是我的代码:
File inputFile = new File(inputFileName);
InputStream is = new FileInputStream(inputFile);
Workbook wb = new XSSFWorkbook(is);
异常发生在代码行:
Workbook wb = new XSSFWorkbook(is);
这是 POI jar,包括:
poi-3.8-20120326.jar
poi-ooxml-3.8-20120326.jar
poi-ooxml-schemas-3.8-20120326.jar
xmlbeans-2.3.0.jar
有大佬可以指导一下吗?一个显示如何阅读完整 Excel 2007 文档的示例将不胜感激。提前致谢!