MS Word provides a complete set of features to create rich text documents quite easily. You can insert formatted text, images, graphics, media, and various other elements in a Word document. In certain cases, you need to transform a Word DOC or DOCX document into a PowerPoint PPT or PPTX presentation programmatically. To perform this conversion, this article provides the best and the simplest way of converting a Word DOC to PowerPoint PPT in Python.
- Python Word to PowerPoint Converter Libraries
- Steps to Convert a DOC to PPT
- Convert a DOC to PPT in Python
Python Word to PowerPoint Converter - Free Download
To convert DOC/DOCX files to PPT/PPTX, we will use Aspose.Words for Python and Aspose.Slides for Python. The former is a high-speed and feature-rich word processing library to work with Word documents. Whereas, the latter is a presentation manipulation library to create and process PowerPoint PPT/PPTX presentations. We will use a combination of both libraries to convert the Word DOC to PPT in Python. You can use the following commands to install the libraries in your Python applications.
>pip install aspose-words
>pip install Aspose.Slides
Steps to Convert DOC to PPT in Python
Let’s have a look at the steps you need to perform to convert a Word DOC to PowerPoint PPT using the above-mentioned Python libraries.
- Use Aspose.Words to load and convert the Word document to PDF.
- Use Aspose.Slides to convert PDF to PPT.
And that is it.
Now, let’s write the code and see how to convert a DOCX file to PPTX programmatically in Python.
Convert a DOCX to PPT in Python
In this section, we’ll demonstrate which classes and methods of the above-mentioned libraries are used for Word to PowerPoint conversion. The following are the steps to convert a Word DOCX to PPT in Python.
- First, load the Word DOC/DOCX using Document class of Aspose.Words.
- Then, call Document.save() method to save the document in PDF format.
- Create a new Presentation object using Aspose.Slides.
- Remove the default slide using Presentation.slides.remove_at(0) method.
- Call Presentation.slides.add_from_pdf() method to convert PDF pages to PPT slides.
- Finally, save converted PPT using Presentation.save() method.
The following code sample shows how to convert a DOC to PPT in Python.
For demonstration, let’s have a look at the DOC to PPT conversion results. The following is the input Word document that is to be converted.
And the following is the converted PowerPoint PPT presentation.
Python Word DOC to PPT Converter - Get a Free License
You can get a free temporary license to convert Word DOC/DOCX to PowerPoint PPT/PPTX without evaluation limitations.
Conclusion
In this article, you have learned how to convert Word DOC to PowerPoint PPT in Python. You can use the same code for DOC to PPT, DOCX to PPT, DOC to PPTX, and DOCX to PPTX conversion in your Python applications.
Explore Aspose’ Libraries
You can explore more about Aspose.Words for Python and Aspose.Slides for Python using the documentation and API references listed below.
- Aspose.Words for Python documentation
- Aspose.Words for Python references
- Aspose.Slides for Python documentation
- Aspose.Slides for Python references
In case you would have any questions, feel free to let us know via our forum.