Package: mlreportgen.ppt
Placeholder for slide content
An object of the mlreportgen.ppt.ContentPlaceholder
class represents a
content placeholder in a slide. You can replace a content placeholder with a picture,
table, or one or more paragraphs.
The PPT API creates a ContentPlaceholder
object when you add a slide to
a presentation and the slide layout has a content placeholder. In the default PPT API,
these layouts have one or more content placeholders:
'Title and Content'
'Two Content'
'Comparison'
'Content with Caption'
To find a ContentPlaceholder
object, use the find
method of the slide that contains the content placeholder. To replace the content
placeholder with a picture, table, or one or more paragraphs, use the
replace
method of the ContentPlaceholder
object. For
a picture or table, the replace
method replaces the
ContentPlaceholder
object with an mlreportgen.ppt.Picture
or mlreportgen.ppt.Table
object, respectively. For paragraphs, the PPT API
does not replace the ContentPlaceholder
object. It adds mlreportgen.ppt.Paragraph
objects as children of the
ContentPlaceholder
object.
When you replace a ContentPlaceholder
object with a
Table
or Picture
object, some of the
ContentPlaceholder
object properties do not apply to the replacement
content. For details, see Properties.
Note
If you replace a content placeholder with a picture, Microsoft®
PowerPoint® adjusts the size of the content placeholder to accommodate the size of
the picture. If you want the placeholder position and size to be fixed in a slide,
use a slide with a picture placeholder. See mlreportgen.ppt.PicturePlaceholder
.
The mlreportgen.ppt.ContentPlaceholder
class is a handle
class.
HandleCompatible | true |
ConstructOnLoad | true |
For information on class attributes, see Class Attributes.
When you replace placeholder content in a presentation and then use the presentation as a template for a new presentation, the object that the PPT API creates for the content in the new presentation depends on the type of content, as shown in the table.
Replacement Content | Class of Object in New Presentation |
---|---|
picture | mlreportgen.ppt.TemplatePicture |
table | mlreportgen.ppt.TemplateTable |
paragraph | mlreportgen.ppt.ContentPlaceholder
|
For more information, see Add and Replace Presentation Content.
To see the placeholder objects that the PPT API creates for a slide object,
view the Children
property of the slide. For example, when
you add a Title and Content
slide to a presentation, the
Children
property is an array that contains an
mlreportgen.ppt.TextBoxPlaceholder
object and an
mlreportgen.ppt.ContentPlaceholder
object.
ppt = mlreportgen.ppt.Presentation("test.pptx"); open(ppt); slide = add(ppt,"Title and Content"); slide.Children(1)
ans = TextBoxPlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Title' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TextBoxPlaceholder:6:11' Id: '6:11'
slide.Children(2)
ans = ContentPlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Content' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.ContentPlaceholder:7:12' Id: '7:12'
getLayoutNames
| mlreportgen.ppt.Paragraph
| mlreportgen.ppt.Picture
| mlreportgen.ppt.PicturePlaceholder
| mlreportgen.ppt.Table
| mlreportgen.ppt.TablePlaceholder
| mlreportgen.ppt.TemplatePicture
| mlreportgen.ppt.TemplateTable
| mlreportgen.ppt.TextBoxPlaceholder