Steps: 1. Load a file in the workbook and xssfsheet objects. 2. Access the file. 3. Try to write the data in the loaded file. Issue: Exception occurs and corrupts the file and make it 0 KB. Exception: .apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4 exception : this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that triggers it, thanks! at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:343) at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.removeContentType(ContentTypeManager.java:256) at org.apache.poi.openxml4j.opc.OPCPackage.removePart(OPCPackage.java:958) at org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522) at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1687) at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:464) at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:211)
Can you post a minimal set of code which reproduces this? It seems to be happening during writing and it might be related to what you actually do before in your code.
I have loaded the workbook in the workbook object and sheet in xssf sheet. Before writing the data I have read the data from it then write the data by using same workbook and sheet object.
Need code. Can't help otherwise.
We cannot do much without code or sample documents, so this is bug-report is INVALID until we receive more information.