Python: Convert PPS and PPT to PPTX

2024-07-24 09:21:47 Written by  support iceblue
Rate this item
(0 votes)

Converting between presentation documents is a common task, especially when dealing with different versions of Microsoft PowerPoint. PPS is used to display presentations directly as finalized documents. PPT is an older format compatible with PowerPoint 97-2003. PPTX, the default editable format in the latest version of PowerPoint, offers better data recovery capabilities, smaller file sizes, and enhanced security.

Whether you need to edit PPS documents or ensure compatibility with modern tools and features, converting them to PPTX is essential. This article will demonstrate how to convert PPS and PPT to PPTX documents using Python with Spire.Presentation for Python. Read on to learn more.

Install Spire.Presentation

This scenario requires Spire.Presentation for Python and plum-dispatch v1.7.4. They can be easily installed in your Windows through the following pip commands.

pip install Spire.Presentation

If you are unsure how to install, please refer to this tutorial: How to Install Spire.Presentation for Python on Windows.

How to Convert PPS to PPTX with Python

To convert PPS to PPTX format, you can call Document.SaveToFile() method offered by Spire.Presentation for Python. It supports converting various formats to PPT(X), such as PPS and PPT, as well as converting PPT documents to other formats like PDF and images (PNG, JPG, BMP, SVG).

Steps to convert PPS to PPTX:

  1. Create an object for the Presentation class.
  2. Import the document to be converted with Document.LoadFromFile() method.
  3. Convert it to a PPTX document using Document.SaveToFile() method.

Here is the code example for you:

  • Python
from spire.presentation.common import *
from spire.presentation import *
# Create a Presentation document object
pre = Presentation()
# Load the file from the disk
pre.LoadFromFile("input/sample.pps")
# Save the document as PPTX
pre.SaveToFile("ppstopptx.pptx", FileFormat.Pptx2010)
pre.Dispose()

Python: Convert PPS and PPT to PPTX

How to Convert PPT to PPTX with Python

Compared with PPT, PPTX has many advantages. Despite being mentioned above, it supports inserting more multimedia content and advanced formats, thereby improving the overall quality and performance of presentations. Spire.Presentation for Python provides Document.SaveToFile() to convert PPT to PPTX without data loss.

Steps to convert PPT to PPTX:

  1. Instantiate a new Presentation object.
  2. Load the document from the files with Document.LoadFromFile().
  3. Save the PPT document as a PPTX document by Document.SaveToFile().

Below is the code example to refer to:

  • Python
from spire.presentation.common import *
from spire.presentation import *

# Create an instance of the Presentation class
pre = Presentation()

# Load the file to be converted
pre.LoadFromFile("input/Sample1.ppt")

# Convert the document to PPTX format
pre.SaveToFile("ppttopptx.pptx", FileFormat.Pptx2010)

pre.Dispose()

Python: Convert PPS and PPT to PPTX

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.