This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


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.


collapse 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

collapse 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

Was this topic helpful?