You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/09/03 08:30:19 UTC

[Bug 55516] New: createDrawingPatriarch does not take drawingml.chartshapes+xml into account for calculation of drawingNumber

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: dev@poi.apache.org
          Reporter: manfred.muehlan@rimaone.com

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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55516] createDrawingPatriarch does not take drawingml.chartshapes+xml into account for calculation of drawingNumber

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55516

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Any chance you could create a very small test excel file, with the mixture of
drawing types, and then a short junit test case which triggers this bug?

We can then use those to test a fix, verify it is fixed, and ensure it stays
fixed into the future!

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