Skip to content

[Epic] Headers, Footers, Slide Numbers, Dates & Watermarks #20

@MHoroszowski

Description

@MHoroszowski

Problem

There is no API for slide footers, slide numbers, dates, or watermarks despite these being basic compliance / branding requirements in regulated-industry decks. Slide footers (<p:hf>) and the field placeholders (<a:fld> for slide-number, date, time) round-trip on read but cannot be set or queried. Watermarks (which in PPT are typically a large semi-transparent text shape on the master) can be authored only via the lower-level shape API. There has been an open PR for <a:fld> since 2022 (scanny/python-pptx#797, 812 LOC) but the diff is XML-fixture-heavy and needs careful rebase.

Sub-features

  • Slide.footer.text getter+setter
  • Slide.has_slide_number boolean toggle
  • Slide.has_date toggle and Slide.date_format (fixed / auto-update + format mask)
  • Presentation.set_footer(text, slide_number=True, date=True, exclude_title_slide=True) — apply across all slides + master
  • Master.footer / Master.has_slide_number for master-level defaults
  • <a:fld> field-placeholder support — emits page numbers, dates, times in run text with auto-update
  • Master.add_watermark(text, font, opacity, rotation) convenience helper
  • Notes-master and handout-master access (currently only per-slide notes-text-frame works)

Prior art

  • Open PRs: scanny/python-pptx#797 <a:fld> for page nums + dates (LillianJensen, 812 LOC, last activity 2024-02 — needs rebase but core design is correct).
  • User issues this would close: #201, #641, #793.
  • OOXML: PresentationML §19.3.1.18 <p:hf> (slide-number/date/footer/header), §19.3.1.51 <p:sldNum>/<p:dt>/<p:ftr> placeholder types, DrawingML §21.1.2.2.5 <a:fld> (id, type=slidenum/datetime1/datetimeN/title).
  • Code paths: new src/pptx/header_footer.py, src/pptx/slide.py, src/pptx/oxml/slide.py, src/pptx/oxml/text.py (<a:fld>).

Acceptance criteria

  • pres.set_footer("Confidential", slide_number=True, exclude_title_slide=True) produces footers visible on every non-title slide.
  • Slide number <a:fld type="slidenum"> auto-updates when slides are reordered.
  • 12+ unit tests + 4 behave scenarios.
  • Documentation page in docs/user/.

Effort: M

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:headers-footersFeature area: headers-footersepicMulti-feature roadmap epicprior-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