https://issues.apache.org/bugzilla/show_bug.cgi?id=55516

            Bug ID: 55516
           Summary: createDrawingPatriarch does not take
                    drawingml.chartshapes+xml into account for calculation
                    of drawingNumber
           Product: POI
           Version: 3.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]

I have an Excel containing multiple drawings.

/xl/drawings/drawing1.xml=Name: /xl/drawings/drawing1.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing2.xml=Name: /xl/drawings/drawing2.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing3.xml=Name: /xl/drawings/drawing3.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing4.xml=Name: /xl/drawings/drawing4.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing5.xml=Name: /xl/drawings/drawing5.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing6.xml=Name: /xl/drawings/drawing6.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing7.xml=Name: /xl/drawings/drawing7.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawing+xml
/xl/drawings/drawing8.xml=Name: /xl/drawings/drawing8.xml - Content Type:
application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml

A Workbook gets created from this file.

        Drawing drawing = sheet.createDrawingPatriarch();
Throws an Exception:
Exception in thread "main"
org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException: A part with the
name '/xl/drawings/drawing8.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]

Having analyzed this issue by looking into the sources, there are the following
findings:
1. XSSFRelation does not contain the ...drawingml.chartshapes+xml
2. Excel apparently has a unique numbering across (at least) drawing+xml and
drawingml.chartshapes+xml Content types
3. My Suggestion would be to add the new Content type and modify the XSSFSheet
createDrawingPatriarch() to:
  int drawingNumber = 
  
getPackagePart().getPackage().getPartsByContentType(XSSFRelation.DRAWINGS.getContentType()).size()
   getPackagePart().getPackage().getPartsByContentType(XSSFRelation.***NEW
CONSTANT FOR drawingml***.getContentType()).size()
 + 1;

This Problem occurs in 3.9 and in the latest 3.10 beta download.

-- 
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]

Reply via email to