使用Apache POI生成的Excel打开时提示内容异常问题求助
Apache POI生成XLSX文件服务器端打开报错求助
我使用Apache POI 3.17、4.1.0/4.1.1/4.1.2及5.2.5版本生成XLSX文件,本地运行代码完全正常,但部署到服务器后,打开文件时会弹出提示:
We found a problem with some content in abc.xlsx. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes
即使仅保留创建工作表的极简代码(如下),问题仍复现,恳请协助解决该异常。
复现代码
String excelPath = "C:\Users\aa.bb\Desktop\Test.xlsx"; XSSFWorkbook workbook = new XSSFWorkbook(); workbook.createSheet("Report"); ByteArrayOutputStream b_Array_Out = new ByteArrayOutputStream(); workbook.write(b_Array_Out); byte[] b_FileByte = b_Array_Out.toByteArray(); File batchFile = new File(excelPath); FileOutputStream fos = new FileOutputStream(batchFile); fos.write(b_FileByte); fos.close();
相关截图说明
- 打开Excel时的错误提示弹窗
- 生成Excel所依赖的JAR包列表
内容的提问来源于stack exchange,提问作者Mani Gupta
相关产品推荐
相关产品推荐

