Convert PPTX to Word in Python
Powerful cross-platform Python API for converting PowerPoint to Word using Python code without Microsoft PowerPoint or Office
Convert PowerPoint to Word using Aspose.Slides and Aspose.Words
Aspose.Slides for Python via .NET and Aspose.Words for Python via .NET are powerful Python libraries used to manipulate and convert PowerPoint presentations, Word documents, and other files. When you convert PowerPoint to Word, you are essentially moving the contents of a presentation’s slides to pages in a Word document.
Convert PowerPoint to Word in Python
You can convert PPTX to Word quickly with just a few lines of code
Python code for converting PowerPoint to Word
presentation = slides.Presentation("pres.pptx")
doc = words.Document()
builder = words.DocumentBuilder(doc)
for index in range(presentation.slides.length):
slide = presentation.slides[index]
# generates and inserts slide image
slide.get_thumbnail(2,2).save("slide_{i}.png".format(i = index), drawing.imaging.ImageFormat.png)
builder.insert_image("slide_{i}.png".format(i = index))
for shape in slide.shapes:
# inserts slide's texts
if (type(shape) is slides.AutoShape):
builder.writeln(shape.text_frame.text)
builder.insert_break(words.BreakType.PAGE_BREAK)
doc.save("presentation.docx")
How to convert PPTX to Word
Install Aspose.Slides for Python via .NET and Aspose.Words for Python via .NET
Add the two libraries as references in your project.
Create an instance of the Presentation class and Doc class.
Load the PPTX presentation you want to convert to Word.
Generate images and texts based on the slides’ contents.
Save the resulting Word document.
Other Supported Conversions
You can also convert PowerPoint to files in other formats