Skip to content

Quick Start Guide

This guide demonstrates the core features of pptxlib through practical examples. You'll learn how to create a presentation with multiple slides and shapes.

Creating a New App

Initialize the PowerPoint application using the App class:

from pptxlib import App

app = App()
app

<App>

Access the collection of presentations through the presentations attribute:

app.presentations

<Presentations (0)>

Creating a New Presentation

Create a new presentation using the add method:

pr = app.presentations.add()
pr

<Presentation [Presentation1]>

Access specific presentations by index:

app.presentations[0]

<Presentation [Presentation1]>

Adding a Title Slide

Create a title slide by specifying the "Title" layout:

slide = pr.slides.add(layout="Title")
slide.title = "Welcome to pptxlib"

Verify the slide collection and title:

pr.slides

<Slides (1)>

pr.slides[0].title

'Welcome to pptxlib'

Adding Content Slides

Add content slides with different layouts:

slide = pr.slides.add(layout="TitleOnly")
slide.title = "First Slide"

The layout parameter is optional - it defaults to the previous slide's layout:

slide = pr.slides.add()
slide.title = "Second Slide"

View all slides in the presentation:

pr.slides

<Slides (3)>

Selecting Slides

Select a slide for display:

slide.select()

Clear the selection:

app.unselect()

Working with Shapes

Add a rectangle shape to the slide with precise positioning:

shape = slide.shapes.add("Rectangle", 100, 100, 200, 100)
shape

<Shape [Rectangle 2]>

Quit the App

Always ensure proper cleanup by quitting the application:

app.quit()