Paper Office
paper-pptxAPI referenceslide

Slide

paper-pptx 0.2.0 API reference

Slide object. Provides access to shapes and slide-level properties.

Attributes

background

attributebackground_Background

_Background object providing slide background properties.

This property returns a _Background object whether or not the slide, master, or layout has an explicitly defined background.

The same _Background object is returned on every call for the same slide object.

element

attributeelement

The lxml element proxied by this object.

follow_master_background

attributefollow_master_background

True if this slide inherits the slide master background.

Assigning False causes background inheritance from the master to be interrupted; if there is no custom background for this slide, a default background is added. If a custom background already exists for this slide, assigning False has no effect.

Assigning True causes any custom background for this slide to be deleted and inheritance from the master restored.

has_notes_slide

attributehas_notes_slidebool

True if this slide has a notes slide, False otherwise.

A notes slide is created by :attr:.notes_slide when one doesn't exist; use this property to test for a notes slide without the possible side effect of creating one.

name

attributenamestr

String representing the internal name of this slide.

Returns an empty string ('') if no name is assigned. Assigning an empty string or None to this property causes any name to be removed.

notes_slide

attributenotes_slideNotesSlide

The NotesSlide instance for this slide.

If the slide does not have a notes slide, one is created. The same single instance is returned on each call.

part

attributepartSlidePart

placeholders

attributeplaceholdersSlidePlaceholders

Sequence of placeholder shapes in this slide.

shapes

attributeshapesSlideShapes

Sequence of shape objects appearing on this slide.

slide_id

attributeslide_idint

Integer value that uniquely identifies this slide within this presentation.

The slide id does not change if the position of this slide in the slide sequence is changed by adding, rearranging, or deleting slides.

slide_layout

attributeslide_layoutSlideLayout

SlideLayout object this slide inherits appearance from.

Functions

apply_footers

funcapply_footers(*, footer: str | None = None, slide_number: bool = False, date_format: str | None = None, fixed_date: str | None = None, now: 'datetime | None' = None) -> None

Apply the complete footer state to this slide only (the dialog's "Apply").

paper-pptx addition. Same parameters, mechanism, and refusals as :meth:.Presentation.apply_footers, restricted to this slide — the per-slide override path (e.g. removing just this slide's footer while the rest of the deck keeps it). Each call sets this slide's full three-element state.

paramfooterstr | None
= None
paramslide_numberbool
= False
paramdate_formatstr | None
= None
paramfixed_datestr | None
= None
paramnow'datetime | None'
= None

Returns

None

read_notes_text

funcread_notes_text() -> str

Return the text of this slide's existing speaker notes.

paper-pptx addition. Unlike :attr:notes_slide, this NEVER creates a notes slide: a slide with no notes part raises UnsupportedStructureError (as does a notes slide with no body placeholder). Returns "" for an empty existing notes body.

Returns

str

rebind_layout

funcrebind_layout(target_layout: 'SlideLayout', *, placeholder_map='auto', orphan_policy: str = 'refuse') -> 'RebindReport'

Move this slide to target_layout; return the required RebindReport.

paper-pptx addition — the template-migration primitive (bulk-migration workflows are left to the caller). Placeholders reconcile against the target layout: auto-matching binds by exact type+idx, then same type, then interchangeable type family (title/ctrTitle; body/object/subTitle). The two fallback tiers bind only when exactly one unclaimed target exists; ambiguity refuses and requires an explicit map. Pass placeholder_map={source_idx: target_idx | None} to override any of it (None force-orphans a source). Source placeholders with no destination follow orphan_policy: "refuse" (default; typed, atomic) or "bake" — convert to a free shape with inherited geometry materialized and each run's resolved effective formatting written locally, so the text keeps its look.

The report is not optional: the effective-value resolver runs before and after, and every run whose resolved values changed appears with its before/after payloads — a rebind never shifts appearance silently. Same-package only (cross-package composition is import_slide's job); slides carrying mc:AlternateContent refuse (shapes inside are invisible to reconciliation).

paramtarget_layout'SlideLayout'
paramplaceholder_map
= 'auto'
paramorphan_policystr
= 'refuse'

Returns

'RebindReport'

replace_notes_text

funcreplace_notes_text(text: str) -> None

Replace the text of this slide's existing speaker notes with text.

paper-pptx addition. Only the notes body placeholder is touched — slide-number and other notes placeholders are preserved untouched. The first paragraph's properties and its first run's character formatting are kept and applied to the replacement text; "\n" in text starts a new paragraph. Never creates a notes slide: a slide with no notes part raises UnsupportedStructureError before anything changes (creating the notes part graph is intentionally not supported).

paramtextstr

Returns

None

On this page