Main Content

replace

Class: mlreportgen.ppt.TextBox
Package: mlreportgen.ppt

Replace text box paragraphs

Description

example

paraObj = replace(textBox,content) replaces a paragraph in a text box.

replace(textBox,contents) replaces multiple paragraphs in a text box placeholder.

Examples

expand all

Create a presentation.

import mlreportgen.ppt.*
ppt = Presentation('myTextBoxReplacePresentation.pptx');
slide = add(ppt,'Blank');

Create an mlreportgen.ppt.Paragraph object.

p = Paragraph('Hello World');

Add a text box to the blank slide (slide).

tb = TextBox();
tb.X = '1in';
tb.Y = '1in';
tb.Width = '4 in';
tb.Height = '2in';

add(slide,tb);

Add the paragraph to the text box.

add(tb,p);

Replace the content of the text box.

replace(tb,'This is the real content');

Close and view the presentation.

close(ppt);
rptview(ppt);

Input Arguments

expand all

Text box replace text in, specified as an mlreportgen.ppt.TextBox object.

Text to use as replacement, specified as a character vector, string scalar, or mlreportgen.ppt.Paragraph object.

Multiple paragraphs to use as replacement, specified as a string array or as a cell array that can contain character vectors, mlreportgen.ppt.Paragraph objects, or combination of character vectors, strings scalars, string arrays, or mlreportgen.ppt.Paragraph objects. For a cell array, contents of inner cell arrays or string arrays are indented from the contents of the outer cell array.

Output Arguments

expand all

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

Introduced in R2015b