replace

Class: mlreportgen.ppt.PicturePlaceholder
Package: mlreportgen.ppt

Replace picture in picture placeholder

Description

example

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.

Examples

expand 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.

replace(pictures(1),plane);

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

close(slides);

if ispc
    winopen(slidesFile);
end

Input Arguments

expand 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

expand all

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

Introduced in R2015b