WolfPPT - Documentation

# How do I copy, reorder, and delete slides with WolfPPT?

Use slides.duplicate(slide), slides.move(old_index, new_index), and slides.remove(slide) for same-presentation slide changes. On the published 0.1.6 package, the verified example saves and reopens between these structural operations instead of combining them in one pending save.

Last updated: November 9, 2026.

[WolfPPT documentation](https://wolfppt.com/docs)

## Inspect the presentation before changing its structure

A presentation layout is not a portable numeric role. The bundled default deck used below has its blank layout at index six, but a company template may have a different layout list. Print layout names and choose the intended object before calling slides.add_slide(layout). Creating a slide from an existing layout and copying a populated slide are different operations with different inputs.

Placeholders also have identities distinct from their position in the shape list. The sample prints placeholder_format.idx and name for any placeholders on the first slide. Its synthetic blank slide has no title or body placeholders, so that loop may print nothing. Do not create an empty box and describe it as an inherited title placeholder, or infer placeholder availability from a layout name alone.

## Copy within the owning presentation

The synthetic source contains Overview, Details, and Appendix slides. slides.duplicate(prs.slides\[0\]) appends a copy of the first slide and returns the copied slide. The sample changes the copied box to Overview copy, saves, and reopens the result. The operation is same-presentation duplication; it is not an example of importing a slide from an unrelated presentation with another theme or master.

Current engine documentation describes relationship-aware duplication policies for charts, notes, media, and other slide dependencies. This page does not turn those source claims into a blanket compatibility promise for every deck in 0.1.6. The executed example is text-only. Test the dependency types present in your template and inspect related task guidance before using copies as report prototypes.

## Complete example

```
from wolfppt import Presentation

seed = Presentation()
for title in ("Overview", "Details", "Appendix"):
    slide = seed.slides.add_slide(seed.slide_layouts[6])
    slide.shapes.add_textbox(0, 0, 3657600, 914400).text = title
seed.save("slides.pptx")

prs = Presentation("slides.pptx")
for index, layout in enumerate(prs.slide_layouts):
    print(index, layout.name)
for placeholder in prs.slides[0].placeholders:
    print(placeholder.placeholder_format.idx, placeholder.name)
copy = prs.slides.duplicate(prs.slides[0])
copy.shapes[0].text = "Overview copy"
prs.save("slides-copied.pptx")
prs = Presentation("slides-copied.pptx")
prs.slides.move(len(prs.slides) - 1, 1)
prs.save("slides-reordered.pptx")
prs = Presentation("slides-reordered.pptx")
prs.slides.remove(prs.slides[-1])
prs.save("slides-updated.pptx")
reopened = Presentation("slides-updated.pptx")
assert [s.shapes[0].text for s in reopened.slides] == ["Overview", "Overview copy", "Details"]
```

## Move and remove in separate saved stages

Moving a slide takes old and new collection indices. The sample moves the newly appended copy to index one, writes slides-reordered.pptx, and reopens it. It then removes the final Appendix slide by passing its current slide object to slides.remove. The final saved order is Overview, Overview copy, Details. Reopening and asserting that order is part of the example.

The save-and-reopen boundaries are intentional. Combining duplication, movement, and deletion into one pending save failed on this synthetic workflow in the published 0.1.6 package. That result is not a promise that every combination fails, but it means this documentation cannot present the combined sequence as verified. Use the explicit saved stages here when evaluating that release.

## Choose a template workflow, not a generic rebuild

Copying existing slides is useful when an approved template already contains the intended shapes and relationships. It does not decide where data belongs, adjust narrative length, or redesign a page. When the need is a guarded recurring report with conditional regions and independently verified publication, use the Commercial reporting documentation for the applicable request contract rather than treating duplication as a complete reporting system.

Keep each output distinct from its source while evaluating. Compare expected slide order and content after reopening, then qualify any chart, media, notes, or hyperlink dependencies separately. Package preservation and visible layout are different checks. A slide can retain relationships and still render differently in another layout engine, so no PowerPoint GUI appearance guarantee follows from a successful copy or reorder.

## Evaluation boundary

The intermediate files also make evaluation inspectable: each output records one structural step and can be opened independently. This is an explicit demonstration workflow, not a recommendation to expose partially processed decks to downstream readers. Your application must decide which final artifact is eligible for publication and retain the source when a later operation fails.

## Parameters and contracts

| Method | Argument contract |
| --- | --- |
| `slides.add_slide(layout)` | A layout from the owning presentation; returns the new slide. |
| `slides.duplicate(source)` | A source slide from the same presentation; appends and returns a copy. |
| `slides.move(old_index, new_index)` | Two collection positions. |
| `slides.remove(slide)` | The current slide object to remove. |
| `placeholder.placeholder_format.idx` | Placeholder identifier, not shape-list position. |

## What it does not do

- The executed example covers text-only same-presentation copying, not cross-deck import.
- Keep the explicit saved stages for this verified 0.1.6 sequence.
- Layout indices and placeholder identifiers depend on the input template.
- No automatic redesign, animation playback, or PowerPoint rendering equivalence is implied.

## Related documentation and tasks

- [How do I open, inspect, edit, and save a PPTX with WolfPPT?](https://wolfppt.com/docs/quickstart)
- [Which WolfPPT Python APIs work in the published 0.1.6 package?](https://wolfppt.com/docs/api-reference)
- [How do I refresh a PPTX report and handle WolfPPT refusals?](https://wolfppt.com/docs/reports-refusals)
- [Copy slides in Python](https://wolfppt.com/copy-slides-pptx-python)
- [Update an existing PPTX](https://wolfppt.com/update-pptx-python)
