poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54803] New: Error opening XLSX after saving with a Drawing using POI
Date Fri, 05 Apr 2013 03:30:35 GMT
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: dev@poi.apache.org
          Reporter: jpmaglutac@gmail.com
    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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message