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

Replace text box paragraphs



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

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


expand all

Create a presentation.

import mlreportgen.ppt.*

slidesFile = 'myTextBoxReplacePresentation.pptx';
slides = Presentation(slidesFile);
slide1 = add(slides,'Blank');

Create an mlreportgen.ppt.Paragraph object.

p = Paragraph('Hello World');

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

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


Add replace the text box with the paragraph.


Replace the content of the text box.

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

Generate the presentation.


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, array, cell array, or Paragraph object. If you specify an array, include only mlreportgen.ppt.Paragraph objects in the array. If you specify a cell array, you can include character vectors and mlreportgen.ppt.Paragraph objects.

Content to use as a replacement, specified as a cell array of character vectors, mlreportgen.ppt.Paragraph objects, or a combination of both. Inner cell arrays specify inner list items. The slide layout specifies whether the text displays as paragraphs, bulleted list items, or numbered list items.

Output Arguments

expand all

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

Introduced in R2015b