Paper Office
paper-pptxAPI referenceslideops

pptx.slideops

paper-pptx 0.2.0 API reference

Internal machinery for slide clone/delete/reorder (paper-pptx). Not public API.

The public surface is Slides.clone/delete/reorder/move and SlideClonePolicy in pptx.slide. Everything here operates on the in-memory opc package — parts, relationships, content types — never on unpacked files; [Content_Types].xml regenerates from live parts at save, and a part no longer reachable through the relationship graph is simply never serialized, so orphans structurally cannot reach disk.

Clone is validate-fully-then-mutate: the complete relationship plan for the source slide (and every deep-copied part's own relationships) is validated against the policy BEFORE any part is created, so a RelationshipPolicyError provably leaves the package untouched.

clone_slide_part

funcclone_slide_part(source_part: 'SlidePart', policy) -> 'SlidePart'

Return a new SlidePart that is a policy-governed deep copy of source_part.

The new part is fully related (layout, media, charts+workbooks, notes per policy) but NOT yet added to the presentation's slide list — the caller owns p:sldIdLst.

paramsource_part'SlidePart'
parampolicy

Returns

'SlidePart'

enroll_clone_in_section

funcenroll_clone_in_section(presentation_elm, source_slide_id: int, clone_slide_id: int) -> None

Add clone_slide_id to the section holding source_slide_id, directly after it.

No-op when the deck has no sections or the source slide is not enrolled in one. Custom shows are deliberately NOT extended: a copy is not part of a curated show.

parampresentation_elm
paramsource_slide_idint
paramclone_slide_idint

Returns

None

remove_slide_from_id_lists

funcremove_slide_from_id_lists(presentation_elm, slide_id: int, rId: str) -> None

Purge slide_id/rId bookkeeping for a deleted slide from auxiliary ID lists.

Sections (p14:sectionLst, in the presentation's extension list) reference slides by slide id; custom shows (p:custShowLst) reference them by relationship id. Neither is reachable through the relationship graph, so without this step a delete leaves dangling entries behind — the corruption class this step closes. Empty sections and empty custom-show slide lists are schema-valid and left in place (matching PowerPoint, which keeps an emptied section).

parampresentation_elm
paramslide_idint
paramrIdstr

Returns

None

On this page