replace
Class: mlreportgen.ppt.TemplatePicture
Package: mlreportgen.ppt
Replace template picture with another picture
Syntax
newPicture = replace(templatePicture,replacementPicture)
Description
replaces a template picture with another picture.newPicture
= replace(templatePicture
,replacementPicture
)
Input Arguments
templatePicture
— Template picture to replace
mlreportgen.ppt.TemplatePicture
object
Template picture to replace, specified as an
mlreportgen.ppt.TemplatePicture
object.
replacementPicture
— Replacement picture
mlreportgen.ppt.Picture
object
Replacement picture, specified as an mlreportgen.ppt.Picture
object.
Output Arguments
newPicture
— New picture
mlreportgen.ppt.Picture
object
New picture in the presentation slide, specified as an
mlreportgen.ppt.Picture
object.
Examples
Replace Template Picture
Generate a presentation, MyPicturePresentation
, that you then use as the template presentation for another presentation. MyPicturePresentation
has one slide with one picture.
import mlreportgen.ppt.* ppt = Presentation("MyPicturePresentation"); open(ppt); slide1 = add(ppt,"Title and Picture"); replace(slide1,"Title","Street"); replace(slide1,"Picture",Picture("street1.jpg"));
Close and view the presentation.
close(ppt); rptview(ppt);
Create a presentation, MyNewPicturePresentation
, from MyPicturePresentation
. MyPicturePresentation
is the template presentation for MyNewPicturePresentation
,
ppt = Presentation("MyNewPicturePresentation","MyPicturePresentation"); open(ppt);
Find the template picture by using the find
method of the slide object. Because the picture comes from a template presentation slide, find
returns the picture as an mlreportgen.ppt.TemplatePicture
object.
slide1 = ppt.Children(1);
templatePictureObj = find(slide1,"Picture")
templatePictureObj = TemplatePicture with properties: XMLMarkup: '<p:pic><p:nvPicPr><p:cNvPr id="8" name="Picture"/><p:cNvPicPr><a:picLocks noChangeAspect="1" noGrp="1"/></p:cNvPicPr><p:nvPr><p:ph idx="13" sz="quarter" type="pic"/></p:nvPr></p:nvPicPr><p:blipFill><a:blip r:embed="rId2"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr/></p:pic>' Name: 'Picture' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TemplatePicture:1360:550' Id: '1360:550'
Replace the picture with a different picture.
street2 = Picture("street2.jpg");
replace(templatePictureObj,street2);
Close and view the presentation.
close(ppt); rptview(ppt);
Version History
Introduced in R2019b
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)