https://issues.apache.org/bugzilla/show_bug.cgi?id=54803
Bug ID: 54803
Summary: Error opening XLSX after saving with a Drawing using
POI
Product: POI
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
I seem to be running into a bug when I open a XLSX file (created in
LibreOffice), add a drawing, and reopen the file.
I've been able to recreate how the bug occurs, and here is a snippet of the
code that causes the bug:
FileInputStream file = new FileInputStream("file.xlsx");
XSSFWorkbook workbook = (XSSFWorkbook)WorkbookFactory.create(file);
file.close();
XSSFSheet sheet = workbook.getSheetAt(0);
XSSFDrawing drawing = sheet.createDrawingPatriarch();
FileOutputStream fos = new FileOutputStream("newfile.xlsx");
workbook.write(fos);
fos.close();
try {
WorkbookFactory.create(new FileInputStream("newfile.xlsx"));
System.out.println("Sucessful re-reading");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error re - reading spreadsheet" + e.getMessage());
}
This is the exception that is caught:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: The part
/xl/worksheets/_rels/sheet1.xml.rels does not have any content type ! Rule:
Package require content types when retrieving a part from a package. [M.1.14]
at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:224)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:662)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:269)
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:73)
--
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]