Merge PowerPoint Presentations using Java

merge powerpoint presentation in java

In this post, you will learn how to merge PowerPoint PPTX presentations using Java. MS PowerPoint presentations are widely used to create interactive slide shows related to business, education, and other domains. In particular cases, you may need to merge multiple presentations into a single file programmatically. In accordance with that, this post provides you some simple ways of merging PowerPoint presentations from within the Java applications.

Java PowerPoint Merger API – Free Download

Aspose.Slides for Java is a powerful presentation manipulation API that provides almost all the features for PowerPoint automation in Java. Using the API, you can easily merge multiple PowerPoint presentations into a single file within a few lines of code. You can either download the API’s JAR or install it within your Mave-based applications using the following configurations.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>20.11</version>
    <classifier>jdk16</classifier>
</dependency>

Merge PowerPoint Presentations using Java

The following are the steps to merge all the slides from one presentation to another using Aspose.Slides for Java.

The following code sample shows how to merge PowerPoint presentations using Java.

Target Presentation

powerpoint presentation

Source Presentation

source presentation

Merged Presentation

merged presentation in java

Merge Particular Slides of PowerPoint Presentations

Instead of merging all the slides from one presentation to another, you can select a few to be merged. For this, you can access the slides using their index. The following are the steps to merge selected slides from source to target presentation.

The following code sample shows how to merge particular slides of PowerPoint presentations in Java.

Select Layout for Merged Slides using Slide Master

In the previous examples, you didn’t change the layout of the slides after merging. However, there might be a case when you need to modify the slides’ layout according to the target presentation. For this, you can mention the master slide to be used using the addClone(ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout) method.

The following code sample shows how to define the master slide when merging the presentations.

Merged Presentation

merged presentation with layout

Conclusion

PowerPoint automation provides you with a wide range of features to manipulate presentations from within your own applications. In this article, you have learned one of the widely used features of merging PowerPoint presentations using Java. The step-by-step guide along with the API references has shown different ways of merging slides from one presentation to another. In case you would want to explore more about the API, visit the documentation.

See Also