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
attributeelementThe lxml element proxied by this object.
parent
attributeparentThe ancestor proxy object to this one.
For example, the parent of a shape is generally the SlideShapes object that contains it.
part
attributepartPresentationPartFunctions
__getitem__
func__getitem__(idx: int) -> SlideProvide indexed access, (e.g. 'slides[0]').
paramidxintReturns
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__() -> intSupport len() built-in function, e.g. len(slides) == 4.
Returns
intadd_slide
funcadd_slide(slide_layout: SlideLayout) -> SlideReturn a newly added slide that inherits layout from slide_layout.
paramslide_layoutSlideLayoutReturns
pptx.slide.Slideclone
funcclone(source: Slide | int, *, after: Slide | int | None = None, policy: SlideClonePolicy | None = None) -> SlideReturn 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 | intparamafterSlide | int | None= NoneparampolicySlideClonePolicy | None= NoneReturns
pptx.slide.Slidedelete
funcdelete(slide: Slide | int) -> NoneRemove 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 | intReturns
Noneget
funcget(slide_id: int, default: Slide | None = None) -> Slide | NoneReturn the slide identified by int slide_id in this presentation.
Returns default if not found.
paramslide_idintparamdefaultSlide | None= NoneReturns
pptx.slide.Slide | Noneindex
funcindex(slide: Slide) -> intMap slide to its zero-based position in this slide sequence.
Raises ValueError on slide not present.
paramslideSlideReturns
intmove
funcmove(slide: Slide | int, to_index: int) -> NoneMove 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 | intparamto_indexintReturns
Nonereorder
funcreorder(new_order: Sequence[int]) -> NonePermute 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