Hi
I am able to create slides using potx, but finally when I write to outputstream
I using file extension pptx, but when I try to open it the "file is corrupted",
when I change the extension to potx it works, Any idea how to get it working ?
Sample Code
InputStream pptTemplate = getClass().getResourceAsStream("/" + "test.potx");
File pptFile = new File(TMP_DIR, "test.pptx");
LOG.debug("pptTemplate: " + pptTemplate.available());
XMLSlideShow presentation = new XMLSlideShow(pptTemplate);
for (int i = 0; i < lists.length; i++) {
XSLFSlideMaster masterSlide = presentation.getSlideMasters()[0];
XSLFSlideLayout[] slideLayouts = masterSlide.getSlideLayouts();
Iterator layoutItr = new
ArrayList(Arrays.asList(slideLayouts)).iterator();
while (layoutItr.hasNext()) {
XSLFSlideLayout slideLayout = (XSLFSlideLayout)
layoutItr.next();
LOG.debug("Slide Title: " + slideLayout.getName());
if (slideLayout.getName().equalsIgnoreCase("TITLE SLIDE")) {
XSLFSlide slide = presentation.createSlide(slideLayout);
XSLFShape shapes[] = slide.getShapes();
Iterator shapesItr = new
ArrayList(Arrays.asList(shapes)).iterator();
while (shapesItr.hasNext()) {
XSLFShape shape = (XSLFShape) shapesItr.next();
LOG.debug("All Shapes: " + shape.getShapeName());
}
}
}
}
presentation.write(new FileOutputStream(pptFile));
This email and any attachments are intended solely for the use of the
individual or entity to whom it is addressed and may be confidential and/or
privileged.
If you are not one of the named recipients or have received this email in error,
(i) you should not read, disclose, or copy it,
(ii) please notify sender of your receipt by reply email and delete this email
and all attachments,
(iii) Dassault Systemes does not accept or assume any liability or
responsibility for any use of or reliance on this email.
For other languages, go to http://www.3ds.com/terms/email-disclaimer