python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

support adding slide_layout

Open wkpark opened this issue 3 months ago • 0 comments

WIP

This is merely one example.

It does not function perfectly, and only some features work as intended. Nevertheless, if you are planning to add or edit slide layouts, please refer to this.

  • [x] add_layout()
  • [x] add_placeholder()

https://github.com/scanny/python-pptx/issues/1044 - apply this suggestion into this PR.

examples

...
    prs = Presentation()
    ph_list = [
        PP_PLACEHOLDER.TITLE,
        PP_PLACEHOLDER.CENTER_TITLE
        PP_PLACEHOLDER.SUBTITLE,
        PP_PLACEHOLDER.BODY,
    ]
...
    layout= prs.slide_layouts.add_layout("My Layout %s")
...
    ph = layout.shapes.add_placeholder(PP_PLACEHOLDER.TITLE, "horz", "full")
    ph.text = "insert Title here"
...

wkpark avatar Oct 10 '25 13:10 wkpark