replace
类: mlreportgen.ppt.PicturePlaceholder
命名空间: mlreportgen.ppt
用图片替换图片占位符
说明
用指定的图片替换指定的图片占位符并返回图片对象。replacementPictureObj = replace(picturePlaceholder,picture)
示例
在演示文稿中添加 Title and Picture 幻灯片,然后用您自己的标题和图片替换标题和图片占位符。
导入 PPT 命名空间,这样您就不必对 PPT API 类使用长而完全限定的名称。
import mlreportgen.ppt.*创建演示文稿。
ppt = Presentation("myPicturePlaceholderPresentation.pptx");
open(ppt);添加具有 Title and Picture 布局的幻灯片。
slide = add(ppt,"Title and Picture");使用幻灯片对象的 find 方法查找名为 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'
find 方法返回一个 mlreportgen.ppt.TextBoxPlaceholder 对象。
用标题文本替换占位符内容。
replace(titlePlaceholderObj,"Airplane");使用幻灯片对象的 find 方法查找名为 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'
find 方法返回一个 mlreportgen.ppt.PicturePlaceholder 对象。
用图片替换图片占位符。
replace(picturePlaceholderObj,Picture("b747.jpg"));关闭并查看演示文稿。
close(ppt); rptview(ppt);
PowerPoint® 调整图片尺寸以适合图片占位符。如果图片占位符尺寸大于 Picture 对象尺寸,则图片会按比例拉伸。如果尺寸较小,则图片位于中央。
输入参数
图片占位符,指定为 mlreportgen.ppt.PicturePlaceholder 对象。
用于替换图片占位符的图片,指定为 mlreportgen.ppt.Picture 对象。
输出参量
替换图片,作为 mlreportgen.ppt.Picture 对象返回。
版本历史记录
在 R2015b 中推出
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)