Main Content


Class: mlreportgen.ppt.TextBoxPlaceholder
Namespace: mlreportgen.ppt

Add content to text box placeholder



addedParagraphObj = add(textBoxPlaceholder,paragraph) adds text as a paragraph in the specified text box placeholder and returns the paragraph object.


expand all

To add a paragraph to a slide title, use the add method of the TextBoxPlaceholder object that represents the title. This example creates a presentation with a Title and Table slide and then creates a second presentation from the first presentation. In the second presentation, the example adds content to the title of the Title and Table slide.

Import the PPT namespace so that you do not have to use long, fully qualified names for the PPT API classes.

import mlreportgen.ppt.*

Create a presentation and add a Title and Table slide to the presentation.

ppt = Presentation("myPPT1.pptx");
slide = add(ppt,"Title and Table");

Find the text box placeholder for the title and replace the content.

contents = find(slide,"Title");
replace(contents(1),"Hello World");

Close and generate the presentation.


Here is the title slide in the generated presentation:

Create a second presentation, using the first presentation as the template.

ppt = Presentation("myPPT2.pptx","myPPT1.pptx");

Find the text box placeholder for the title and add content to the title.

contents = find(ppt,"Title");
add(contents(1)," -- How are You?");

Close and view the presentation.


In the second presentation, the title has the content from the template presentation and the added content.

Input Arguments

expand all

Text box placeholder, specified as an mlreportgen.ppt.TextBoxPlaceholder object.

Paragraph to add to the text box placeholder, specified as a character vector, string scalar, or mlreportgen.ppt.Paragraph object.

Output Arguments

expand all

Added paragraph, returned as an mlreportgen.ppt.Paragraph object.

Version History

Introduced in R2015b