Open and Save Presentation using Apache POI and Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Open and Save Presentation
Using Aspose.Slides for Java, developers can not only create PowerPoint presentations from scratch but also access or modify the existing ones.
//Instantiate a PresentationEx object that represents a PPTX file
Presentation pres = new Presentation("presentation.ppt");
//Add the title slide
ISlide slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));
//Save the presentation
pres.save("EditedPPT_Aspose.ppt", SaveFormat.Ppt);
Apache POI SL - HSLF XSLF - Open and Save Presentation
FileInputStream can be passed to XMLSlideShow to open an existing presentation. Presentation can than later be saved using FileOutputStream.
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("presentation.pptx"));
//append a new slide to the end
XSLFSlide blankSlide = ppt.createSlide();
//save changes in a file
FileOutputStream out = new FileOutputStream("EditedPPT_Apache.pptx");
ppt.write(out);
out.close();
Download Running Code
Download Sample Code
For more details, visit Opening a Presentation and Saving a Presentation.