Bug 62517 - ArrayStoreException when running getShapes on slide of XSLFSheet
Summary: ArrayStoreException when running getShapes on slide of XSLFSheet
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-03 08:05 UTC by 2710780954
Modified: 2018-08-12 16:12 UTC (History)
0 users



Attachments
Template PPT for Generation (36.23 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2018-07-03 08:05 UTC, 2710780954
Details

Note You need to log in before you can comment on or make changes to this bug.
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".