记录一次使用easypoi导出word报Compile template failed错误

具体:Caused by: org.apache.poi.openxml4j.exceptions.OLE2NotOfficeXmlFileException: The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)

  用wps编辑好模板直接拖进idea后将文件后缀 .wps   改为  .docx,导致问题出现。

点击文件名也可以跳转,并正常打开。

重新将文件另存为.docx既可。

"The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (e.g. HSSF instead of XSSF)"这个错误是由于使用错误POI部分处理给定的数据格式引起的。您需要调用POI的另一个部分来处理数据。具体来说,如果您处理的是doc文件,应该使用HWPFDocument来读取;如果您处理的是xls文件,应该使用HSSFWorkbook来读取。如果您处理的是docx文件,应该使用XWPFDocument来读取;如果您处理的是xlsx文件,应该使用XSSFWorkbook来读取。请根据您所处理的文件类型选择正确的POI部分进行处理。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [The supplied data appears to be in the OLE2 Format.](https://blog.csdn.net/qq_40014707/article/details/114318042)[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: 50%"] - *3* [POI OLE2NotOfficeXmlFileException:The supplied data appears to be in the OLE2 Format问题解决](https://blog.csdn.net/qq_38974638/article/details/116210340)[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: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值