https://bz.apache.org/bugzilla/show_bug.cgi?id=66675
Bug ID: 66675
Summary: Save not happening in work book showing A part with
the name '/docProps/core.xml' already exists
Product: POI
Version: 5.2.3-FINAL
Hardware: PC
Status: NEW
Severity: blocker
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 38595
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38595&action=edit
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
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]