Skip to content Skip to sidebar Skip to footer

Adding Text / Slide Title To Placeholder On Slide With Python-pptx

I am trying to add a title to my slide . I was looking up the documentation here and it says, 'Setting the slide title Almost all slide layouts have a title placeholder, which any

Solution 1:

In python-pptx, a placeholder is a subclass of Shape (auto shape). So all the properties of a regular shape (like a rectangle) are available on a placeholder, in particular .text and .text_frame.

http://python-pptx.readthedocs.io/en/latest/api/shapes.html#shape-objects-autoshapes

So to change the text of a placeholder, simply use:

placeholder.text = 'foobar'

The usual way to do this is to have a title placeholder that is pre-formatted for the standard title look and feel. Generally the title placeholder is placed on the slide layout used to create the slide, that way it shows up consistently through the presentation.

Using the title placeholder ensures the text it contains is used to identify the slide in the outline view and a few other places.

Post a Comment for "Adding Text / Slide Title To Placeholder On Slide With Python-pptx"