Skip to content

[Epic] Slide Masters, Layouts & .potx Templates #19

@MHoroszowski

Description

@MHoroszowski

Problem

Slide masters and layouts are visible-but-frozen. Users can read the master/layout shape lists but cannot programmatically add new layouts (scanny/python-pptx#1091, #413), apply layouts from one master to another (#1028), or read .potx template files (#1070, #1095) — Presentation() raises on .potx because the content-type allowlist doesn't include .template. Adding shapes/pictures to a Slide Master is impossible (#575, 11c). Content placeholders are partial (#333, 12c).

Sub-features

  • Presentation() accepts .potx files (one-line content-type allowlist fix)
  • Presentation.save_as_potx(path) — write a template by changing the content-type
  • SlideMasters.add_layout(name, copy_from=None) — add a new <p:sldLayout> part with rels
  • SlideLayouts.copy_from(other_layout) — duplicate a layout including placeholders and shapes
  • SlideMaster.shapes.add_* — author shapes/pictures directly on a master (not inherited via layout)
  • SlideLayout.placeholders.add(idx, type, ...) — programmatically add placeholders
  • Apply a layout from master_a to a slide that's inheriting from master_b (cross-master rel resolution)
  • Improved content-placeholder semantics: chart-into-placeholder (#199, 11c)
  • SlideMaster.get_layout(slide_layout_id, default=None) (scanny/python-pptx#269)

Prior art

Acceptance criteria

  • Presentation("template.potx") opens without error.
  • pres.save_as_potx("out.potx") produces a file PowerPoint recognizes as a template.
  • master.add_layout("Three Columns") creates a new layout that's selectable in PowerPoint's layout pane.
  • 20+ unit tests + 6 behave scenarios.

Effort: M

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mastersFeature area: mastersepicMulti-feature roadmap epicprior-art:forkActive community fork has shipped thisprior-art:upstream-prOpen PR on scanny/python-pptx is candidate cherry-pickpriority:P1Important but not urgent

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions