Class: mlreportgen.ppt.Slide
Package: mlreportgen.ppt

Replace paragraphs, tables, or pictures in slide



replace(slide,objectName,content) replaces existing content of a placeholder with one or more paragraphs, a table, or a picture that you specify. If the type of content you specify in the content input argument is not valid for replacing the placeholder, the replace method has no effect.


expand all

Create a presentation.

import mlreportgen.ppt.*

slidesFile = 'mySlideReplacePresentation.pptx';
slides = Presentation(slidesFile);
slide1 = add(slides,'Title Slide');
slide2 = add(slides,'Title and Content');

Replace the titles in slide1 and slide2.

replace(slide1,'Title','Slide Title of Slide 1');
replace(slide2,'Title','Slide Title of Slide 2');

Generate the presentation. Open mySlideReplacePresentation.pptx. On a Windows® platform, you can open the presentation in MATLAB®:


if ispc

Input Arguments

expand all

Slide in which to replace content, specified as an mlreportgen.ppt.Slide object.

Name of placeholder to replace, specified as a character vector. The placeholder name must be defined in the template.

Content to use as replacement, specified as one of these:

  • character vector

  • mlreportgen.ppt.Paragaph object

  • cell array of character vectors or Paragraph objects, or a combination of both

  • mlreportgen.ppt.Table object

  • mlreportgen.ppt.Picture object

Introduced in R2015b