org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read content types part ! at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:102) at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54) at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:253) at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:758) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:298) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:201) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:319) at XlxsReader.main(XlxsReader.java:14) Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: ZIP_Read: specified offset out of range at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:401) at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:100) ... 7 more I don't know why,the Excel downloaded from a website.It's so weird,when it's downloaded completely,I opened it with EXCEL and I deleted the last blank line (for example,the 28th line has data,but the 28th is the last .I deleted the 29th or more and I ran my code, it worked). But i did nothing and opened it with Office,it was normal.I just wanna know how to solve it.Office 2007 and above
Can you post the Excel file and a code snippet that produced the problem?
(In reply to Javen O'Neal from comment #1) > Can you post the Excel file and a code snippet that produced the problem? Thank you,I find the reason. Becase the POI unzips Excel files with java.util.zip.*,When POI begin to unzip the Excel file of mine,it fails. I get another way to solve it. Thank a lot.
Since we didn't change the code it Java docs, I'm changing the status to WONTFIX, since there's nothing we can do without an example Except file that breaks POI. If anyone else has the same problem, please reopen this bug so we can fix this bug for everyone.