org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Offic

Posted 山高我为峰

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Offic相关的知识,希望对你有一定的参考价值。

org.apache.poi.poifs.filesystem.OfficeXmlFileException: 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)

原因是:
HSSFWorkbook:是操作Excel2003以前(包括2003)的版本,扩展名是.xls 
XSSFWorkbook:是操作Excel2007的版本,扩展名是.xlsx

 <!--处理2003 excel-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <!--处理2007 excel-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>

 




以上是关于org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Offic的主要内容,如果未能解决你的问题,请参考以下文章