Java/ Convert PPS/PPT to PPTX
PPS is a PowerPoint Show format that opens in full-screen slideshow mode and automatically exits when finishing displaying . While PPT is the default file extension for saving presentations in PowerPoint 2003 and earlier versions. Sometimes, you may receive a PowerPoint presentation in .pps or .ppt format. In this article, you will learn how to programmatically convert them to PPTX format using Free Spire.Presentation for Java.
Import jar dependency
● You can download the free library and unzip it, and then add the Spire.Presentation.jar file to your project as dependency.
● Or you can directly add the jar dependency to your maven project by adding the following configurations to the pom.xml.
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.presentation.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>
【The Presentation.saveToFile() method offered by Free Spire.Presentation for Java allows you to convert the pps and ppt file fromat to pptx with just a few lines of code.】
Convert PPS to PPTX
import com.spire.presentation.*;
public class convertPPSToPPTX {
public static void main(String[] args) throws Exception {
//Create an instance of presentation document
Presentation ppt = new Presentation();
//Load PowerPoint file
ppt.loadFromFile("sample.pps");
//Save the PPS document to PPTX file format
ppt.saveToFile("output/convertPPSToPPTX.pptx", FileFormat.PPTX_2013);
}
}
Convert PPT to PPTX
import com.spire.presentation.*;
public class toPPTX {
public static void main(String[] args) throws Exception {
//Create an instance of presentation document
Presentation ppt = new Presentation();
//Load the PowerPoint file from disk
ppt.loadFromFile("sample.ppt");
//Save the PPT document to PPTX file format
ppt.saveToFile("output/PPTtoPPTX_result.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}