Edit PPT in Python
Add text, shapes, and other presentation elements to PPT files with Python
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.
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)
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.