While manipulating the PowerPoint presentations programmatically, you may need to split the slides and save them as separate PPT files. For example, you may want to split each slide, all odd or even slides, and so on. In this article, you will learn how to split slides in PowerPoint PPT or PPTX in Python.
Python Library to Split PowerPoint PPT
Aspose.Slides for Python via .NET is a feature-rich Python library that allows you to create and manipulate PowerPoint presentations. Moreover, it lets you convert the presentations to other formats seamlessly. We will use this library to split the slides in PowerPoint PPT. You can install the library from PyPI using the following pip command.
> pip install aspose.slides
Split PowerPoint PPT Slides in Python
Aspose.Slides for Python makes it quite easier for you to split a presentation. Just load the presentation file, loop through slides, and save each slide as a separate PPT/PPTX file. The following are the steps to split slides in a PowerPoint PPT in Python.
- First, load the presentation using Presentation class.
- Loop through number of slides and in each iteration, perform following steps:
- Create a new presentation using Presentation class.
- Remove the default slide in the presentation using ISlide.remove() method.
- Add a clone of the slide using Presentation.slides.add_clone(ISlide) method.
- Save presentation using Presentation.save(string, SaveFormat) method.
The following code sample shows how to split slides in a PowerPoint PPTX using Python.
Get a Free License
You can use Aspose.Slides for Python via .NET without evaluation limitations by getting a temporary license.
In this article, you have seen how to split slides in a PowerPoint PPT using Python. You can modify the provided code sample to change the splitting criteria as per your requirements, such as splitting all even or odd slides, etc. To explore more about Aspose.Slides for Python via .NET, you can visit the documentation. Also, you can share your queries with us via our forum.
- Convert PPTX to PDF in Python
- Create PowerPoint Presentations in Python
- Convert PPT to PNG in Python
- Convert PPT to JPG in Python
Info: Aspose provides a free online PowerPoint Splitter, which is a live implementation of the presentation splitting process described on this page.