org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Fail to save

前端 未结 6 1222

I\'m facing org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Fail to save:an error occurs while saving the package : The part /docProps/app.xml fail to b

相关标签:
6条回答
  • 2020-12-06 18:07

    This can happen if a timeout occurs. I have code that works for a small dataset and throws this error with huge dataset.

    0 讨论(0)
  • 2020-12-06 18:10

    I also had this error.

    I found my mistake was caused because I was opening the same file / workbook multiple times.

    So I would recommend to make sure you are opening just once before attempting to close as well.

    0 讨论(0)
  • 2020-12-06 18:15

    I had the same issue. When I shortened the output excel filename, it stopped.

    0 讨论(0)
  • 2020-12-06 18:21

    I had this problem today and fixed it already.

    The problem is in putResultstoReport()

    You can't wb.write(fileOut); in your cycle.

    resolution:

    first call putResultstoReport(); then wb.write(fileOut);

    0 讨论(0)
  • 2020-12-06 18:21

    I had the same problem user refreshing page and sending the request again before the previous request is completed. when creating the name use millisecond in name to avoid name conflict with these updates in code of name creation resolved the above issue.

           String sheetName="projectName"+System.currentTimeMillis() + ".xlsx"
           FileOutputStream fileOut = new FileOutputStream(sheetName);
           workbook.write(fileOut);
           fileOut.close();
    
    0 讨论(0)
  • 2020-12-06 18:22

    I had similar Issue. Finally I got the reason and that was version for the below jar file was getting overrided.

      org.apache.xmlgraphics:batik-dom
    

    Hence, I added below dependency and now it is working fine.

    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik-dom</artifactId>
        <version>1.8</version>
    </dependency>
    

    This jar contains dependency for xalan. To generate the report xalan is required.

    0 讨论(0)
提交回复
热议问题