Skip to main content

Official open-source Python library by Aspose.Slides for creating, reading, and editing PowerPoint (.pptx) presentations. Designed for developers and AI agents.

Project description

Aspose.Slides FOSS

The official open-source Python library by Aspose.Slides for creating, reading, and editing PowerPoint (.pptx) presentations.


Installation

pip install aspose-slides-foss

Requires: Python 3.10+ and lxml (installed automatically as a dependency).


Quick Start

import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

# Open an existing presentation
with slides.Presentation("input.pptx") as prs:
    print(f"Slides: {len(prs.slides)}")
    prs.save("output.pptx", SaveFormat.PPTX)

# Create a new presentation
with slides.Presentation() as prs:
    slide = prs.slides[0]
    prs.save("new.pptx", SaveFormat.PPTX)

Features

  • Presentation I/O — Open, create, and save .pptx files with full round-trip fidelity
  • Slides — Add, remove, clone, reorder, and iterate slides
  • Shapes — AutoShapes, PictureFrames, Tables, Connectors, GroupShapes
  • Text — TextFrame, Paragraph, Portion with character, paragraph, and text frame formatting (including bullets)
  • Charts — 70+ chart types, series, categories, axes, trendlines, error bars, legend, titles, data labels, markers, series groups, 3D
  • Animations — Shape and text-level animations with sequences, effects, triggers, and motion paths
  • Slide transitions — 60+ transition types with per-slide timing, advance settings, and morph support
  • Themes — Color schemes, font schemes, format schemes, master/override themes
  • Backgrounds — Per-slide and master slide backgrounds with solid/gradient/pattern/picture fills
  • Fill — Solid, gradient, pattern, and picture fills
  • Lines — Width, dash style, arrows, join and alignment
  • Effects — Outer shadow, glow, soft edge, blur, reflection, inner shadow
  • 3D — Bevel, camera, light rig, material, extrusion depth
  • Document properties — Core, app, and custom properties
  • Notes slides — Per-slide notes with header/footer management
  • Comments — Threaded comments with authors, timestamps, and positions
  • Images — Embed from file, bytes, or stream
  • Markdown export — Save presentation text as Markdown in 24 flavor dialects, with tables, lists, headings, comments, and chart data

Usage Examples

Shapes

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]
    shape = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 300, 100)
    shape.add_text_frame("Hello, world!")
    prs.save("shapes.pptx", SaveFormat.PPTX)

Text Formatting

from aspose.slides_foss import ShapeType, NullableBool, FillType
from aspose.slides_foss.drawing import Color
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 400, 150)
    tf = shape.add_text_frame("Formatted text")
    fmt = tf.paragraphs[0].portions[0].portion_format
    fmt.font_height = 24
    fmt.font_bold = NullableBool.TRUE
    fmt.fill_format.fill_type = FillType.SOLID
    fmt.fill_format.solid_fill_color.color = Color.from_argb(255, 0, 70, 127)
    prs.save("text.pptx", SaveFormat.PPTX)

Table

import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    table = prs.slides[0].shapes.add_table(50, 50, [120.0, 120.0, 120.0], [40.0, 40.0])
    table.rows[0][0].text_frame.text = "Name"
    table.rows[0][1].text_frame.text = "Value"
    prs.save("table.pptx", SaveFormat.PPTX)

Connector

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]
    box1 = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 100, 150, 60)
    box2 = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 350, 100, 150, 60)
    conn = slide.shapes.add_connector(ShapeType.BENT_CONNECTOR3, 0, 0, 10, 10)
    conn.start_shape_connected_to = box1
    conn.start_shape_connection_site_index = 3  # right
    conn.end_shape_connected_to = box2
    conn.end_shape_connection_site_index = 1    # left
    prs.save("connector.pptx", SaveFormat.PPTX)

Fill

from aspose.slides_foss import ShapeType, FillType
from aspose.slides_foss.drawing import Color
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 50, 50, 300, 150)
    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 30, 120, 200)
    prs.save("fill.pptx", SaveFormat.PPTX)

Notes

import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    notes = prs.slides[0].notes_slide_manager.add_notes_slide()
    notes.notes_text_frame.text = "Speaker notes go here."
    prs.save("notes.pptx", SaveFormat.PPTX)

Comments

from aspose.slides_foss.drawing import PointF
from datetime import datetime
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    author = prs.comment_authors.add_author("Jane Smith", "JS")
    slide = prs.slides[0]
    author.comments.add_comment("Review this slide", slide, PointF(2.0, 2.0), datetime.now())
    prs.save("comments.pptx", SaveFormat.PPTX)

Document Properties

import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    prs.document_properties.title = "Q1 Results"
    prs.document_properties.author = "Finance Team"
    prs.document_properties.set_custom_property_value("Version", 3)
    prs.save("deck.pptx", SaveFormat.PPTX)

Chart

Build a chart from scratch by populating its backing workbook:

from aspose.slides_foss.charts import ChartType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]

    # Pass has_default_data=False to start with an empty workbook
    chart = slide.shapes.add_chart(ChartType.CLUSTERED_COLUMN, 50, 50, 600, 400, False)
    chart.chart_title.add_text_frame_for_overriding("Quarterly Sales")

    cd = chart.chart_data
    wb = cd.chart_data_workbook  # embedded XLSX workbook backing the chart

    cd.series.clear()
    cd.categories.clear()

    # Workbook layout (worksheet 0):
    #          col 0   col 1      col 2
    #  row 0            "Revenue"  "Expenses"   <- series name row
    #  row 1   "Q1"     1200       800
    #  row 2   "Q2"     1500       900
    #  row 3   "Q3"     1800       1000
    #  row 4   "Q4"     2100       1100

    # Categories — column 0, rows 1..4
    for row, name in enumerate(["Q1", "Q2", "Q3", "Q4"], start=1):
        cd.categories.add(wb.get_cell(0, row, 0, name))

    # Series 1 (Revenue) — name at (row 0, col 1), values at (rows 1..4, col 1)
    s1 = cd.series.add(wb.get_cell(0, 0, 1, "Revenue"), chart.type)
    for row, value in enumerate([1200, 1500, 1800, 2100], start=1):
        s1.data_points.add_data_point_for_bar_series(wb.get_cell(0, row, 1, value))

    # Series 2 (Expenses) — name at (row 0, col 2), values at (rows 1..4, col 2)
    s2 = cd.series.add(wb.get_cell(0, 0, 2, "Expenses"), chart.type)
    for row, value in enumerate([800, 900, 1000, 1100], start=1):
        s2.data_points.add_data_point_for_bar_series(wb.get_cell(0, row, 2, value))

    prs.save("chart.pptx", SaveFormat.PPTX)

wb.get_cell(worksheet_index, row, column, value) writes the value to the embedded XLSX and returns a cell reference that the chart series and categories bind to.

Slide Transition

from aspose.slides_foss.slideshow import TransitionType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]
    slide.slide_show_transition.type = TransitionType.CIRCLE
    slide.slide_show_transition.advance_on_click = True
    slide.slide_show_transition.advance_after_time = 3000  # ms
    prs.save("transition.pptx", SaveFormat.PPTX)

Group Shape

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]
    group = slide.shapes.add_group_shape()
    group.shapes.add_auto_shape(ShapeType.RECTANGLE, 300, 100, 100, 100)
    group.shapes.add_auto_shape(ShapeType.RECTANGLE, 500, 100, 100, 100)
    group.name = "TwoRectangles"
    prs.save("group.pptx", SaveFormat.PPTX)

Markdown Export

import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat, MarkdownSaveOptions, Flavor, NewLineType

with slides.Presentation("input.pptx") as prs:
    # Save the whole presentation with default options
    prs.save("output.md", SaveFormat.MD)

    # Or customize the output
    options = MarkdownSaveOptions()
    options.flavor = Flavor.GITHUB
    options.new_line_type = NewLineType.UNIX
    options.show_slide_number = True
    options.slide_number_format = "## Slide {0}"
    options.show_hidden_slides = True
    options.show_comments = True
    prs.save("custom.md", SaveFormat.MD, options)

    # Save only selected slides (1-based, order and repeats respected)
    prs.save("subset.md", [2, 1], SaveFormat.MD, options)

Text frames, tables, lists, titles/subtitles (as headings), comments, and chart data are exported; the export is text-only, so images, media, and SmartArt are skipped.


Limitations

The following areas are not yet implemented and will raise NotImplementedError:

  • SmartArt, OLE objects, mathematical text
  • Export to PDF, HTML, SVG, and image formats
  • VBA macros, digital signatures
  • Hyperlinks and action settings

Unknown XML parts encountered during load are preserved verbatim on save — opening and re-saving a file will never strip content this library does not yet understand.


Links


License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspose_slides_foss-26.8.0.tar.gz (450.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspose_slides_foss-26.8.0-py3-none-any.whl (628.0 kB view details)

Uploaded Python 3

File details

Details for the file aspose_slides_foss-26.8.0.tar.gz.

File metadata

  • Download URL: aspose_slides_foss-26.8.0.tar.gz
  • Upload date:
  • Size: 450.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aspose_slides_foss-26.8.0.tar.gz
Algorithm Hash digest
SHA256 5618ccae12dee0e62b7db010b62448f0af20125510846d4e27c7a2abda6d7a04
MD5 a33395cd138eaa9e60b659138ae80400
BLAKE2b-256 0241b787354c9805fd84272c1e6af0b1e3d61f489bb4eec759c81ae4a5715c5a

See more details on using hashes here.

File details

Details for the file aspose_slides_foss-26.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aspose_slides_foss-26.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc795c3b2ec5a3f6e25342a64dc47a393de06225dd1c901c1d728190be901438
MD5 159f13fb0be6f54d24d12d75f35ea1c4
BLAKE2b-256 e3b48ad2281a2d96a61afe5293ae2c562503febc4d75079fa4cd3ee760acebe0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page