https://bz.apache.org/bugzilla/show_bug.cgi?id=60255

            Bug ID: 60255
           Summary: createDrawingPatriarch does not take next correct next
                    drawing index number
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: tuyen...@gmail.com

When i create Drawing from sheet.createDrawingPatriarch()
I got Exception:
org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException: A part with the
name '/xl/drawings/drawing7.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]

I tested with 3.14 and 3.15. Problem i found maybe: in
org.apache.poi.xssf.usermodel.XSSFSheet.createDrawingPatriarch, 
we get new drawing index by code line
int drawingNumber =
getPackagePart().getPackage().getPartsByContentType(XSSFRelation.DRAWINGS.getContentType()).size()
+ 1;
The index is count of exist drawings + 1. And correct if exist indexes are
consecutive.

My Excel file containing multiple drawings,
getPackagePart().getPackage().getPartsByContentType(XSSFRelation.DRAWINGS.getContentType())
return indexes are nonconsecutive. Then I got Exception
/xl/drawings/drawing1.xml
/xl/drawings/drawing2.xml
/xl/drawings/drawing3.xml
/xl/drawings/drawing5.xml
/xl/drawings/drawing7.xml
/xl/drawings/drawing10.xml

There is another way for me to re-index exist drawing by poi library or How can
I override this method to get new index = get lastest index + 1

Thank you very much for reading and support

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to