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)
該錯誤意思是說,文件中的數據是用Office2007+XML保存的,而現在卻調用OLE2 Office文檔處理,應該使用POI不同的部分來處理這些數據,比如使用XSSF來代替HSSF。
只需要導入poi的包即可!!!
1、百度輸入 mvn repository,找到第一個網址打開:https://mvnrepository.com/ 在輸入框輸入:poi
2、選擇一個版本,憑我的經驗,不要選擇beta版本,也不要選擇最新的按本。
3、點進去,copy如下內容,復制到自己pom.xml。更新一下,即可解決
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.13</version> </dependency>