Quick Start
Quick Start
This guide shows the fastest path from installation to a saved .pptx file using
Aspose.Slides FOSS for Python. The library is pure Python, MIT-licensed, and requires
no Microsoft Office or native binaries.
Prerequisites
| Requirement | Detail |
|---|---|
| Python | 3.10 or later |
| OS | Windows, macOS, Linux, Docker |
| Package | aspose-slides-foss from PyPI |
Install
Install the package from PyPI using pip. Version 26.3.2 or later is required:
pip install aspose-slides-foss>=26.3.2Create a Presentation
Construct a Presentation with no arguments to create a blank deck. The library
automatically adds one empty slide. Call save() with a path and SaveFormat.PPTX
to write the file:
from aspose.slides_foss import Presentation, SaveFormat
prs = Presentation()
prs.save("empty.pptx", SaveFormat.PPTX)Add a Shape with Text
Access the first slide via prs.slides[0], then insert a rectangle using
slide.shapes.add_auto_shape(). Call add_text_frame() to attach a text frame
and set font properties via portion_format:
from aspose.slides_foss import Presentation, SaveFormat, ShapeType
prs = Presentation()
slide = prs.slides[0]
shape = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 400, 150)
tf = shape.add_text_frame("Hello from Aspose.Slides FOSS!")
tf.paragraphs[0].portions[0].portion_format.font_height = 24
prs.save("with_shape.pptx", SaveFormat.PPTX)Apply a Solid Fill
Set fill_format.fill_type to FillType.SOLID, then supply an ARGB color using
Color.from_argb(). The color is applied to the shape background before saving:
from aspose.slides_foss import (
Presentation, SaveFormat, ShapeType, FillType, Color
)
prs = Presentation()
shape = prs.slides[0].shapes.add_auto_shape(
ShapeType.RECTANGLE, 100, 100, 400, 200
)
shape.fill_format.fill_type = FillType.SOLID
shape.fill_format.solid_fill_color.color = Color.from_argb(255, 70, 130, 180)
shape.add_text_frame("Styled shape")
prs.save("styled.pptx", SaveFormat.PPTX)Load an Existing File
Pass a file path to the Presentation constructor to open an existing .pptx file.
Read the slide count, modify the deck as needed, then call save() to write the output:
from aspose.slides_foss import Presentation, SaveFormat
prs = Presentation("existing.pptx")
print(f"Slides: {len(prs.slides)}")
prs.save("copy.pptx", SaveFormat.PPTX)