Copy Slides from One Presentation to Another Using Java

This article will introduce how to copy slides from one PowerPoint presentation to another programmatically using Free Spire.Presentation for Java.

Import jar dependency (2 Methods)
● Download the free library and unzip it. Then add the Spire.Presentation.jar file to your project as dependency.

● You can also add the jar dependency to your maven project by adding the following configurations to the pom.xml.


Sample Code

import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;

public class CopySlides {
public static void main(String[] args) throws Exception {

//Create a Presentation object to load the first document
Presentation pptOne= new Presentation();

//Create a Presentation object to load the second document
Presentation pptTwo = new Presentation();

//Insert the specific slide of the first document to the specified position on the second document

//Append the specific slide of the first document to the end of the second document

//Save the second document to file
pptTwo.saveToFile("CopySlides.pptx", FileFormat.PPTX_2013);

Sharing Java Code