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
.pptxfiles 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
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)
Limitations
The following areas are not yet implemented and will raise NotImplementedError:
- SmartArt, OLE objects, mathematical text
- Export to non-PPTX formats (PDF, HTML, SVG, images)
- 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aspose_slides_foss-26.4.0.tar.gz.
File metadata
- Download URL: aspose_slides_foss-26.4.0.tar.gz
- Upload date:
- Size: 430.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fee0dd0b137d1ac65fd7676e419e234aa39b0424fd1be587e983f99ee5d1aa3
|
|
| MD5 |
aa00787a1aaac4da5979059d024eb139
|
|
| BLAKE2b-256 |
f1e43decbc2aec91c0f10c2ff151aef84cb749fdddd6e8a8dde35c37fbe89f00
|
File details
Details for the file aspose_slides_foss-26.4.0-py3-none-any.whl.
File metadata
- Download URL: aspose_slides_foss-26.4.0-py3-none-any.whl
- Upload date:
- Size: 608.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da1f083ff18173c079cd9129b47129d7f40e02edcbbaa72cfff85f453777c168
|
|
| MD5 |
f859cbee5beca655b39278a858d2e0bc
|
|
| BLAKE2b-256 |
05630b018e8a609a914addb081c7ce50b69dff9394617ecfa0c4e879b4b2f642
|