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

  1. Install Aspose.Slides for Python via .NET and Aspose.Words for Python via .NET

  2. Add the two libraries as references in your project.

  3. Create an instance of the Presentation class and Doc class.

  4. Load the PPTX presentation you want to convert to Word.

  5. Generate images and texts based on the slides’ contents.

  6. Save the resulting Word document.

Other Supported Conversions

You can also convert PowerPoint to files in other formats