Introduction

Aspose.Slides FOSS for Python gives you full control over the PowerPoint presentation lifecycle — creating decks from scratch, adding and reordering slides, populating them with shapes, tables, and formatted text, and saving the result to PPTX, ODP, PDF, or a dozen other formats. All of this happens in pure Python with no dependency on Microsoft Office or any external binary.

The library is available on PyPI as aspose-slides-foss under the MIT license. Install it with pip, import it, and start building presentations in a few lines of code. Whether you are automating report generation, building a slide-deck pipeline, or embedding presentation output in a web application, the API covers the full surface: slide collections, master/layout slides, shape collections, text frames, fill formats, and export options.

This post walks through the core presentation-management capabilities — the classes and methods you will use most when working with slides in Python.


What’s Included

Presentation Lifecycle

The Presentation class is the entry point. Create a new deck, manipulate its contents, and save to any supported format. Presentations support the context-manager protocol, so resources are released automatically.

import io
from aspose.slides_foss import Presentation
from aspose.slides_foss.export import SaveFormat

with Presentation() as pres:
    # A new presentation starts with one blank slide
    print("Slides:", len(pres.slides))  # 1

    # Save to a file
    pres.save("output.pptx", SaveFormat.PPTX)

    # Or save to a stream
    buf = io.BytesIO()
    pres.save(buf, SaveFormat.PPTX)

Slide Collection Operations

SlideCollection lets you add, insert, clone, remove, and reorder slides. Every operation updates the internal index so len(pres.slides) always reflects the current count.

from aspose.slides_foss import Presentation, ShapeType

with Presentation() as pres:
    layout = pres.layout_slides[0]

    # Add a blank slide using the first layout
    pres.slides.add_empty_slide(layout)

    # Insert at a specific position
    pres.slides.insert_empty_slide(1, layout)

    # Clone an existing slide (shapes are copied)
    pres.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 200, 100)
    pres.slides.add_clone(pres.slides[0])

    print("Total slides:", len(pres.slides))  # 4

    # Remove by index
    pres.slides.remove_at(3)

Shapes and AutoShapes

Add rectangles, ellipses, triangles, and other geometry shapes to any slide via ShapeCollection.add_auto_shape(). Each shape exposes position, size, rotation, and fill properties that persist across save/reload cycles.

from aspose.slides_foss import Presentation, ShapeType

with Presentation() as pres:
    slide = pres.slides[0]
    slide.shapes.clear()

    rect = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 300, 150)
    rect.rotation = 15

    ellipse = slide.shapes.add_auto_shape(ShapeType.ELLIPSE, 400, 50, 200, 200)

    # Reorder z-index
    slide.shapes.reorder(0, ellipse)
    print("Front shape:", slide.shapes[0].shape_type)  # ELLIPSE

Tables

Create data tables with ShapeCollection.add_table(), set cell text via TextFrame, merge cells, and apply border formatting. Row heights and column widths match the values you pass to the constructor.

from aspose.slides_foss import Presentation, FillType
from aspose.slides_foss.drawing import Color

with Presentation() as pres:
    slide = pres.slides[0]
    slide.shapes.clear()

    table = slide.shapes.add_table(50, 50, [150, 150, 150], [40, 40, 40])
    table.rows[0][0].text_frame.text = "Name"
    table.rows[0][1].text_frame.text = "Role"
    table.rows[0][2].text_frame.text = "Team"

    # Merge two cells in the second row
    table.merge_cells(table.rows[1][0], table.rows[1][1], False)

    # Style the header row borders
    for col_idx in range(len(table.columns)):
        fmt = table.rows[0][col_idx].cell_format
        fmt.border_bottom.fill_format.fill_type = FillType.SOLID
        fmt.border_bottom.fill_format.solid_fill_color.color = Color.black
        fmt.border_bottom.width = 2

Master and Layout Slides

Every presentation has a hierarchy of master slides and layout slides. Access them through Presentation.masters and Presentation.layout_slides to apply consistent formatting across your deck.

from aspose.slides_foss import Presentation

with Presentation() as pres:
    master = pres.masters[0]
    print("Master layouts:", len(master.layout_slides))

    # Pick a layout by type
    from aspose.slides_foss import SlideLayoutType
    title_layout = pres.layout_slides.get_by_type(SlideLayoutType.TITLE)
    if title_layout:
        pres.slides.add_empty_slide(title_layout)

Document Properties

Read and write built-in metadata such as title, author, and subject through the DocumentProperties object. Properties persist in the saved file.

from aspose.slides_foss import Presentation
from aspose.slides_foss.export import SaveFormat

with Presentation() as pres:
    props = pres.document_properties
    props.title = "Quarterly Report"
    props.author = "Engineering"
    props.subject = "Q1 2026 Results"

    pres.save("report.pptx", SaveFormat.PPTX)

Quick Start

pip install aspose-slides-foss
from aspose.slides_foss import Presentation, ShapeType, FillType, NullableBool
from aspose.slides_foss.drawing import Color
from aspose.slides_foss.export import SaveFormat

with Presentation() as pres:
    slide = pres.slides[0]
    slide.shapes.clear()

    # Add a title shape
    title = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 30, 860, 80)
    tf = title.add_text_frame("Quarterly Report")
    tf.paragraphs[0].portions[0].portion_format.font_bold = NullableBool.TRUE
    tf.paragraphs[0].portions[0].portion_format.font_height = 28

    # Add a data table
    table = slide.shapes.add_table(50, 150, [200, 200, 200], [40, 40, 40])
    headers = ["Region", "Revenue", "Growth"]
    for i, h in enumerate(headers):
        table.rows[0][i].text_frame.text = h

    # Fill the title shape background
    title.fill_format.fill_type = FillType.SOLID
    title.fill_format.solid_fill_color.color = Color.from_argb(255, 0, 51, 102)

    # Save as PPTX
    pres.save("report.pptx", SaveFormat.PPTX)

Supported Formats

FormatExtensionReadWrite
PPTX.pptx
PPT.pptPlanned
PPSX.ppsxPlanned
PPTM.pptmPlanned
POTX.potxPlanned
ODP.odpPlanned
PDF.pdfPlanned
HTML.htmlPlanned
HTML5.htmlPlanned
TIFF.tiffPlanned
GIF.gifPlanned
XPS.xpsPlanned
FODP.fodpPlanned
MD.mdPlanned

Note: Currently only PPTX export is implemented. Other format values exist in the SaveFormat enum for forward compatibility but are not yet functional. The save() method always produces PPTX output regardless of the format parameter.


Open Source & Licensing

Aspose.Slides FOSS for Python is released under the MIT license. You can use it in personal, academic, and commercial projects without restrictions. The source code is available on GitHub and the package is published on PyPI.


Getting Started