Merge POTX Files in Java
Merge POTX documents using Aspose.Slides for Java server-side APIs.
Merge POTX Files Using Java
Use
Aspose.Slides for Java
to load multiple POTX presentations, clone slides from one presentation into another, and save the merged file. You can install the aspose-slides package in a Maven-based project by adding the repository and dependency below.
Repository
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://releases.aspose.com/java/repo/</url>
</repository>Dependency
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>26.8</version>
<classifier>jdk16</classifier>
</dependency>Merge POTX Files - Java
Presentation destinationPresentation = new Presentation("presentation1.potx");
try {
Presentation sourcePresentation = new Presentation("presentation2.potx");
try {
for (ISlide slide : sourcePresentation.getSlides()) {
destinationPresentation.getSlides().addClone(slide);
}
} finally {
sourcePresentation.dispose();
}
destinationPresentation.save("merged-presentation.potx", SaveFormat.Potx);
} finally {
destinationPresentation.dispose();
}Steps for Merging POTX Files in Java
A basic document merge with Aspose.Slides for Java APIs can be done with just a few lines of code.
- Load the destination
POTXfile with thePresentationclass. - Load the source
POTXfile with thePresentationclass. - Loop through the
ISlideobjects in the source presentation. - Call
addCloneto add each source slide to the destination presentation. - Call the
savemethod withSaveFormat.Potx.
System Requirements
Before running the Java merge sample code, make sure that you have the following prerequisites.
- Microsoft Windows, Linux, macOS, or another OS with a supported Java Runtime Environment.
- Get the latest version of Aspose.Slides for Java from Maven.
Built with Aspose.Slides
Merge POTX Files Online
The free Aspose.Slides Merger app is built with Aspose.Slides for Java, the same API as the code above. Open it and see what the API can do with your own POTX files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides merges files before you write code.
- Upload several POTX files and combine them into one.
- Download the merged result as one file.
What is POTX File Format?
Files with the .POTX extension represent Microsoft PowerPoint template presentations created with PowerPoint 2007 and later. A POTX file can store layouts, styles, themes, backgrounds, fonts, and defaults used to create new presentations.
Other Supported Merging Formats
Using Java, you can also merge many other file formats including the ones listed below.