Paper Office
paper-pptxAPI referenceslide

Slides

paper-pptx 0.2.0 API reference

Sequence of slides belonging to an instance of Presentation.

Has list semantics for access to individual slides. Supports indexed access, len(), and iteration.

Slides(sldIdLst: CT_SlideIdList, prs: Presentation)

Attributes

element

attributeelement

The lxml element proxied by this object.

parent

attributeparent

The ancestor proxy object to this one.

For example, the parent of a shape is generally the SlideShapes object that contains it.

part

attributepartPresentationPart

Functions

__getitem__

func__getitem__(idx: int) -> Slide

Provide indexed access, (e.g. 'slides[0]').

paramidxint

Returns

pptx.slide.Slide

__iter__

func__iter__() -> Iterator[Slide]

Support iteration, e.g. for slide in slides:.

Returns

typing.Iterator[pptx.slide.Slide]

__len__

func__len__() -> int

Support len() built-in function, e.g. len(slides) == 4.

Returns

int

add_slide

funcadd_slide(slide_layout: SlideLayout) -> Slide

Return a newly added slide that inherits layout from slide_layout.

paramslide_layoutSlideLayout

Returns

pptx.slide.Slide

clone

funcclone(source: Slide | int, *, after: Slide | int | None = None, policy: SlideClonePolicy | None = None) -> Slide

Return a new slide that is a policy-governed deep copy of source.

paper-pptx addition. The clone's relationship graph follows policy (default SlideClonePolicy): layout shared; charts deep-copied WITH their embedded workbooks and style parts; notes deep-copied and re-linked to the clone; image/media shared; external (hyperlink) relationships copied. A slide bearing any other relationship type (OLE objects, controls, SmartArt, comments, …) refuses with RelationshipPolicyError before anything changes.

The clone is inserted directly after source, or after the slide given by after. source/after accept a Slide or a 0-based index; a Slide from another presentation raises TargetNotFoundError.

paramsourceSlide | int
paramafterSlide | int | None
= None
parampolicySlideClonePolicy | None
= None

Returns

pptx.slide.Slide

delete

funcdelete(slide: Slide | int) -> None

Remove slide from this presentation.

paper-pptx addition. Removes the slide's p:sldId entry and the presentation's relationship to the slide part; parts then unreachable through the relationship graph (the slide, and e.g. its charts and notes if unshared) are never serialized again — orphans structurally cannot reach disk. Deleting the last slide is allowed.

paramslideSlide | int

Returns

None

get

funcget(slide_id: int, default: Slide | None = None) -> Slide | None

Return the slide identified by int slide_id in this presentation.

Returns default if not found.

paramslide_idint
paramdefaultSlide | None
= None

Returns

pptx.slide.Slide | None

index

funcindex(slide: Slide) -> int

Map slide to its zero-based position in this slide sequence.

Raises ValueError on slide not present.

paramslideSlide

Returns

int

move

funcmove(slide: Slide | int, to_index: int) -> None

Move slide so it sits at 0-based to_index in the slide sequence.

paper-pptx addition. to_index outside range(len(slides)) raises ValueError.

paramslideSlide | int
paramto_indexint

Returns

None

reorder

funcreorder(new_order: Sequence[int]) -> None

Permute the slide sequence: new position i shows the slide now at new_order[i].

paper-pptx addition. new_order must be an exact permutation of range(len(slides)); anything else raises ValueError before any change.

paramnew_orderSequence[int]

Returns

None

On this page