Main Content

add

Class: mlreportgen.ppt.ContentPlaceholder
Namespace: mlreportgen.ppt

Add paragraphs to content placeholder

Description

addedParagraphObj = add(contentPlaceholder,paragraph) adds one paragraph to a content placeholder and returns the paragraph object.

example

add(contentPlaceholder,paragraphs) adds multiple paragraphs to a content placeholder.

Examples

expand all

To add text to a content placeholder in a slide, use the add method of the ContentPlaceholder object.

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 Content slide to the presentation.

ppt = Presentation("myContentPlaceholderAddPresentation.pptx");
open(ppt);
slide = add(ppt,"Title and Content");

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

titlePlaceholderObj = find(slide,"Title");
replace(titlePlaceholderObj,"Fruits and Vegetables");

Find the content placeholder and replace the content with a paragraph.

contents = find(slide,"Content");
contentPlaceholderObj = contents(1);
replace(contentPlaceholderObj,{'Fruits' ["Apples" "Oranges"]});

Add another paragraph to the content placeholder.

add(contentPlaceholderObj,{"Vegetables" ["Beans" "Carrots"]});

Close and view the presentation.

close(ppt);
rptview(ppt);

Here is the slide in the generated presentation:

Input Arguments

expand all

Content placeholder, specified as an mlreportgen.ppt.ContentPlaceholder object.

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

Multiple paragraphs to add to the content placeholder, specified as one of these values:

  • String array

  • Cell array of any combination of string scalars, character vectors, or mlreportgen.ppt.Paragraph objects. Inner arrays are indented from outer arrays.

The slide layout determines whether the text displays as paragraphs, bullet list items, or numbered list items.

Output Arguments

expand all

Paragraph added to the content placeholder, returned as an mlreportgen.ppt.Paragraph object.

Version History

Introduced in R2015b