Created attachment 38595 [details] This attachment shows the error Hi I am using apche poi ooxm-5.2.3 version and i was tried older version also. I have used apache poi for reading the xlsx sheets and removing the selected tabs that is working fine after deletion the save not happen it throwing the following error. org.apache.poi.openxml4j.exceptions.InvalidOperationException: A part with the name '/docProps/core.xml' already exists : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12] at org.apache.poi.openxml4j.opc.OPCPackage.addPackagePart(OPCPackage.java:947) at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:547) at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1496) at org.apache.poi.ooxml.POIXMLDocument.write(POIXMLDocument.java:227) at com.simplilearn.mavenexample.Authentication.getWorkbook(Authentication.java:691) at com.simplilearn.mavenexample.Authentication.exportToFile(Authentication.java:656) at com.simplilearn.mavenexample.App.main(App.java:29) So as per my understanding whenever edit happens using the apche poi it try to create new OPC package part checks existing part so that time the error displayed. For testing purpose i have deleted the package part then it was allowed for SAVE. The JAVA code is pretty straight forward. try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); XSSFWorkbook testWorkBook = new XSSFWorkbook(inputfile); testWorkBook.removeSheetAt(0); testWorkBook.write(bos); } catch(Exception e) { e.printStackTrace(); } Observations: 1.Once opened XLSX even without change also not allowed for save 2.The part name removal working only for windows Environment not LINUX server
That code is not a test case - where does inputFile param come from? You will need to provide the file.
Created attachment 38596 [details] Input file
Hi please find the attached file,we have developing new POC using apache POI so there is no Test case, this is actual code. Note:the file directly get it from POWER BI api, if we have download the file then save as manually after checking it will work properly but our requirement handle the input file dynamically(runtime) so that time i have faced that error. its not related to file issue
added r1910949
Any luck/update?
have a look at the comment from 2023-07-12 12:30:54 UTC
Should be fixed on latest trunk version.