PowerPoint presentations are often required to be split into multiple PPTX/PPT files. You may split a presentation by each slide, even or odd slides, etc. as per your scenario. In this article, you will learn how to split the PowerPoint PPTX/PPT presentations using Java.
Java API to Split PowerPoint Presentations
In order to split PPTX or PPT presentations, we will use Aspose.Slides for Java. The API is designed to create, modify and convert PowerPoint and OpenOffice presentations from within Java applications. You can either download the API or install it using the following Maven configurations.
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>21.8</version>
<classifier>jdk16</classifier>
</dependency>
Split a PowerPoint Presentation using Java
The following are the steps to split a PowerPoint presentation using Java.
- First, create an instance of the Presentation class to load the PowerPoint presentation.
- Then, loop through each ISlide in Presentation.getSlides() collection.
- In each iteration, perform the following steps:
- Create an instance of Presentation class.
- Remove the default slide using Presentation.getSlides().get_item(0).remove() method.
- Add the slide to the presentation using Presentation.getSlides().addClone(ISlide) method.
- Finally, save the presentation using Presentation.save(String, SaveFormat) method.
The following code sample shows how to split a PowerPoint PPTX presentation.
Get a Free API License
You can use Aspose.Slides for Java without evaluation limitations by getting a temporary license.
Online Demo
Try the online presentation splitter, which is based on Aspose.Slides.
Conclusion
In this article, you have learned how to split PowerPoint PPTX or PPT presentations using Java. You can customize the provided code sample to split each slide in the presentation, all the even or odd slides, etc. In addition, you can visit the documentation to explore other features of API. Also, you can feel free to let us know about your queries via our forum.