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

            Bug ID: 55791
           Summary: cannot delete slides when using layout to create new
                    slides
           Product: POI
           Version: 3.9-dev
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: XSLF
          Assignee: [email protected]
          Reporter: [email protected]

Whenever am trying to delete slides of a simple PPT , it is possible. But am
working on a program where i have to use the previous layouts to create new
slides dynamically for more data. 

Now when i try to delete a slide, it starts throwing error on that layout part
of code irrespective of the slide i want to delete.

The error is as shown

Exception in thread "main"
org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException: A part with the
name '/ppt/slides/slide22.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]
       at
org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:774)
       at
org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:738)
       at
org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:350)
       at
org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:334)
       at
org.apache.poi.xslf.usermodel.XMLSlideShow.createSlide(XMLSlideShow.java:206)
       at Table.main(Table.java:9)

And my code is:


XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("Template.pptx"));
XSLFSlide[] slide = ppt.getSlides();
ppt.removeSlide(11);
XSLFTable tbl = slide[1].createTable();
tbl.setAnchor(new Rectangle2D.Double(30, 100, 600, 800));

XSLFSlideMaster master = ppt.getSlideMasters()[0];
XSLFSlideLayout layout1 = master.getLayout(SlideLayout.TITLE_ONLY);
XSLFSlide slide1 = ppt.createSlide(layout1) ;
String str1 = slide[1].getTitle();
XSLFTextShape[] pht = slide1.getPlaceholders();

Thank you.

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