This simple tutorial contains all the required information about how to convert PowerPoint to Word in Python. You will learn to set up the environment and then load an existing PowerPoint presentation like PPTX from the disk and then save it as a Word document, say a DOCX file. You will also learn how to interact with multiple libraries together to achieve this requirement for changing PowerPoint into Word in Python.
Steps to Transform PowerPoint to Word in Python
- Configure the environment to use Aspose.Slides for Python via .NET and Aspose.Words for Python via .NET in your application
- Import aspose.slides, aspose.words and io libraries in your application
- Load the source PPTX presentation file from the disk using the Presentation class object
- Save the presentation as HTML into Stream object using the save method
- Load the intermediate HTML file into the Document class object
- Save the loaded HTML as DOCX on the disk
The above steps describe how to export PowerPoint to Word in Python by using multiple libraries i.e. Aspose.Slides and Aspose.Words simultaneously in a single application. First, we use the Presentation class to load the template PowerPoint presentation and then save it to an intermediate HTML file inside the memory stream. Subsequently, the intermediate HTML file is loaded using the Document class object and then saved as a DOCX file on the disk using the save method.
Code to Convert PPTX to DOCX in Python
This example exhibits the process for converting PPTX to DOCX in Python by loading the source PPTX using the Presentation class object. You can also use the LoadOptions object from the Aspose.Slides library to set different properties like setting password if the presentation is password protected, setting callback function in case of errors or warnings, etc to customize the loading process. The LoadOptions from the Aspose.Words library can also be used to set different properties of the input HTML like its format, encoding details, font settings progress, and warning callbacks to name a few.
In this article, we have walked you through the process to convert PowerPoint into Word document in Python using the simple API Interface. If you want to learn about converting an ODP presentation to PPTX, refer to the article on how to convert ODP to PPTX in Python.