Edit PPT in Python
Add text, shapes, and other presentation elements to PPT files with Python
Edit PPT in Python
The following example opens a PPT presentation, adds a text-bearing shape to its first slide, and saves the edited presentation as a new PPT file.
Python code for editing PPT
with slides.Presentation("presentation.ppt") as presentation:
slide = presentation.slides[0]
text_shape = slide.shapes.add_auto_shape(
slides.ShapeType.RECTANGLE, 10, 10, 300, 50)
text_shape.text_frame.text = "New text"
presentation.save("edited-presentation.ppt", slides.export.SaveFormat.PPT)Edit PPT using Aspose.Slides
Aspose.Slides for Python via .NET lets you load PPT presentations, edit their slides, and save the changes without Microsoft PowerPoint. You can modify text and shapes or add new presentation elements programmatically.
How to edit PPT in Python
- Install Aspose.Slides for Python via .NET by following the installation guide.
- Open the source PPT file with
Presentation. - Access the target slide through a
slidevariable. - Call
ShapeCollection.add_auto_shapeto add a rectangle to the slide. - Set the shape’s
text_frame.textvalue. - Call
Presentation.savewithSaveFormat.PPTto write the edited presentation.
Built with Aspose.Slides
Edit PPTX Files Online
The free Aspose.Slides Editor app is built with Aspose.Slides for Python via .NET, the same API as the code above. Open it and see what the API can do with your own PPTX files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides handles your files before you write code.
- Upload your PPTX files and edit them instantly.
- Save and download the edited file.
Edit other files
You can also edit files in other formats