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. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Package: mlreportgen.ppt

Replace picture in picture placeholder


pictureObj = replace(picturePlaceholder,picture)



pictureObj = replace(picturePlaceholder,picture) replaces the picture in a picture placeholder. PowerPoint® modifies the picture dimensions to fill in the picturePlaceholder dimensions. If the picture dimensions are bigger, PowerPoint stretches the image proportionally. If the picture dimensions are smaller, the picture is centered.


collapse all

Create a presentation.

import mlreportgen.ppt.*
slidesFile = 'myPlaceholderPresentation.pptx';
slides = Presentation(slidesFile);
slide1 = add(slides,'Title and Picture');

Create an mlreportgen.ppt.Picture object.

plane = Picture(which('b747.jpg'));

Find an object whose Name property is Picture.

pictures = find(slide1,'Picture');

Replace the picture in the picture placeholder.


Generate the presentation and then open myPlaceholderPresentation.pptx. On a Windows® platform, you can open the presentation in MATLAB®:


if ispc

Input Arguments

collapse all

Picture placeholder whose picture to replace, specified as an mlreportgen.ppt.PicturePlaceholder object.

Picture to use as replacement, specified as an mlreportgen.ppt.Picture object.

Output Arguments

collapse all

Picture, represented by an mlreportgen.ppt.Picture object.

Introduced in R2015b