Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active September 9, 2021 05:44
Show Gist options
  • Save aspose-com-gists/45a4f75a2eec6324a9da6541a6f70bf0 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/45a4f75a2eec6324a9da6541a6f70bf0 to your computer and use it in GitHub Desktop.
Split PowerPoint Presentations using Java
// Load PowerPoint presentation
Presentation presentation = new Presentation("presentation.pptx");
// Iterate through the slides in the presentation
for (ISlide sld : presentation.getSlides()) {
// Create a new presentation
Presentation newPres = new Presentation();
// Remove default slide
newPres.getSlides().get_Item(0).remove();
// Add slide to presentation
newPres.getSlides().addClone(sld);
// Save presentation
newPres.save(String.format("Slide_{0}.pptx", sld.getSlideNumber()), SaveFormat.Pptx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment