replace
Class: mlreportgen.ppt.PicturePlaceholder
Namespace: mlreportgen.ppt
Replace picture placeholder with picture
Description
replaces the specified picture placeholder with the specified picture and returns
the picture object.replacementPictureObj
= replace(picturePlaceholder
,picture
)
Examples
Replace Picture Placeholder with Picture
Add a Title and Picture
slide to a presentation and then replace the title and picture placeholders with your own title and picture.
Import the PPT namespace so that you do not have to use long, fully qualified names for the PPT API classes.
import mlreportgen.ppt.*
Create a presentation.
ppt = Presentation("myPicturePlaceholderPresentation.pptx");
open(ppt);
Add a slide that has a Title and Picture
layout.
slide = add(ppt,"Title and Picture");
Use the find
method of the slide object to find the placeholder object that has the name Title
.
titlePlaceholderObj = find(slide,"Title")
titlePlaceholderObj = TextBoxPlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Title' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TextBoxPlaceholder:30:125' Id: '30:125'
The find
method returns an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the title text.
replace(titlePlaceholderObj,"Airplane");
Use the find
method of the slide object to find the placeholder object that has the name Picture
.
picturePlaceholderObj = find(slide,"Picture")
picturePlaceholderObj = PicturePlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Picture' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.PicturePlaceholder:31:126' Id: '31:126'
The find
method returns an mlreportgen.ppt.PicturePlaceholder
object.
Replace the picture placeholder with a picture.
replace(picturePlaceholderObj,Picture("b747.jpg"));
Close and view the presentation.
close(ppt); rptview(ppt);
PowerPoint® adjusts the picture dimensions to fit in the picture placeholder. If the picture placeholder dimensions are bigger than the Picture
object dimensions, the picture stretches proportionally. If the dimensions are smaller, the picture is centered.
Input Arguments
picturePlaceholder
— Picture placeholder
mlreportgen.ppt.PicturePlaceholder
object
Picture placeholder, specified as an mlreportgen.ppt.PicturePlaceholder
object.
picture
— Picture to use as replacement
mlreportgen.ppt.Picture
object
Picture to use as the replacement for the picture placeholder, specified
as an mlreportgen.ppt.Picture
object.
Output Arguments
replacementPictureObj
— Replacement picture
mlreportgen.ppt.Picture
object
Replacement picture, returned as an
mlreportgen.ppt.Picture
object.
Version History
Introduced in R2015b
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)