This quick tutorial is about how to create PPT using Python by providing details and configuring the environment to execute the sample code. In order to create PowerPoint with Python detailed steps are shared which guide to use the required classes and namespaces for this task. In the end, a sample presentation with a line shape added inside the slide is saved on the disk as PPTX.
Steps to Create PowerPoint with Python
- Configure the environment to use Aspose.Slides for Python via .NET
- Import the necessary namespaces to be used from the Aspose.Slides library
- Create an empty presentation using the Presentation class object
- Create a Slide class object to access the default first slide
- Add a line shape inside the slide
- Save the newly created presentation on disk
These aforementioned steps in Python create PowerPoint presentation using simple API calls. We will commence the process by instantiating the Presentation class object to create an empty presentation and access the default first slide using the Slide class object. Then a line shape is added to the slide and the presentation is saved on the disk in PPTX format.
Code to Create PPT using Python
You can use Python create PowerPoint from template presentations as well. You will be required to load the template presentation which will give you the benefit of using a template slide theme. You can then add new slides and respective shapes inheriting template properties. You can add text, SmartArt, OLE Frame, Picture Frames and many other shapes supported by PowerPoint programmatically by using the API.
In this article, we witnessed how easy it is to use Python create PPT or PPTX presentations with the help of simple API calls. If you want to convert a Word file to PDF, refer to the article on how to convert Word to PDF using Python.