Main Content

add

Class:mlreportgen.ppt.TextBoxPlaceholder
Package:mlreportgen.ppt

Add content to text box placeholder

Description

example

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

Examples

expand all

To add a paragraph to a slide title, use theaddmethod of theTextBoxPlaceholderobject that represents the title. This example creates a presentation with aTitle and Tableslide and then creates a second presentation from the first presentation. In the second presentation, the example adds content to the title of theTitle and Tableslide.

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

importmlreportgen.ppt.*

Create a presentation and add aTitle and Tableslide to the presentation.

ppt = Presentation("myPPT1.pptx"); open(ppt); 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 view the presentation.

close(ppt); rptview(ppt);

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"); open(ppt);

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.

close(ppt); rptview(ppt)

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 anmlreportgen.ppt.TextBoxPlaceholderobject.

Paragraph to add to the text box placeholder, specified as a character vector, string scalar, ormlreportgen.ppt.Paragraphobject.

Output Arguments

expand all

Added paragraph, returned as anmlreportgen.ppt.Paragraphobject.

Introduced in R2015b