Bug 62517

Summary: ArrayStoreException when running getShapes on slide of XSLFSheet
Product: POI Reporter: 2710780954
Component: XSLFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.17-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Template PPT for Generation

Description 2710780954 2018-07-03 08:05:57 UTC
Created attachment 36002 [details]
Template PPT for Generation

I want to generate PPT based on my own template PPT refer to the attachment.

I debugged from my side, found there is an error when executed syntax _drawing = new XSLFDrawing(this, cgs) in XSLFSheet>initDrawingAndShapes.

But when I remove the Object Type from Selection Panel in the template PPT, it works well.

Please help solve the problem.

Many thanks in advance
Comment 1 Andreas Beeker 2018-08-12 16:12:21 UTC
Apart of the image1.wmf and oleObject1.bin containing a lot of empty space, I had no problems with your template with the current 4.0.0-SNAPSHOT.

@Test
public void bug62517() throws IOException {
    ZipSecureFile.setMinInflateRatio(0.001);
    try (InputStream fis = new FileInputStream("Template.pptx");
         XMLSlideShow ppt = new XMLSlideShow(fis)) {
        XSLFSlide sld = ppt.getSlides().get(0);
        XSLFTextShape ts = (XSLFTextShape)sld.getShapes().get(0);
        ts.setText("not-a-template text");
        XSLFAutoShape as = sld.createAutoShape();
        as.setAnchor(new Rectangle2D.Double(100,100,100,100));
        as.setShapeType(ShapeType.GEAR_9);
        as.setFillColor(Color.RED);
        try (FileOutputStream fos = new FileOutputStream("bla.pptx")) {
            ppt.write(fos);
        }
    }
}

I don't understand what you mean by "remove the Object Type from Selection Panel".