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)
时间: 2023-04-23 09:07:11 浏览: 156
这个错误提示是说你提供的数据似乎是Office 2007+ XML格式的,而你正在调用POI处理OLE2 Office文档的部分。你需要调用POI的另一个部分来处理这个数据(例如使用XSSF而不是HSSF)。
相关问题
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)
这个错误通常是由于您正在尝试使用 HSSF API 处理 Office 2007+ XML 格式的文档,而 HSSF API 只能处理旧的 OLE2 格式的文档。为了解决这个问题,您需要改用 XSSF API 来处理 Office 2007+ XML 格式的文档。
如果您使用的是 Apache POI 库,可以按照以下步骤来更新您的代码:
1. 导入 org.apache.poi.xssf.usermodel.XSSFWorkbook 类。
2. 将 HSSFWorkbook 实例替换为 XSSFWorkbook 实例。
3. 将 HSSFSheet 实例替换为 XSSFSheet 实例。
4. 将 HSSFRow 实例替换为 XSSFRow 实例。
5. 将 HSSFCell 实例替换为 XSSFCell 实例。
如果您的代码中使用了其他 HSSF API 类,也需要相应地替换为 XSSF API 类。
如果您正在使用其他库来处理 Office 2007+ XML 格式的文档,可能需要查阅相关文档来确定正确的 API。
The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals
"The supplied data appears to be in the Office 2007 XML. You are calling the part of POI that deals with OLE2 Office Documents." 这个错误是由于使用了错误的POI解析类导致的。POI是一个用于操作Microsoft Office文件的开源库,分为HSSF和XSSF两部分,分别用于处理旧版(xls)和新版(xlsx)的Excel文件。当你使用HSSFWorkbook来解析xlsx文件时,就会出现这个错误。正确的处理方法是使用XSSFWorkbook来解析xlsx文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [NPOIDemo.zip](https://download.csdn.net/download/qq_23663693/12370014)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [java处理excel库,poi-bin-4.1.0-20190412](https://download.csdn.net/download/cp62/11156022)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals](https://blog.csdn.net/weixin_46205984/article/details/122255403)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)