replace
类: mlreportgen.ppt.TextBoxPlaceholder
命名空间: mlreportgen.ppt
替换文本框占位符内容
说明
将指定文本框占位符中的内容替换为段落并返回段落对象。replacementParagraphObj = replace(textBoxPlaceholder,paragraph)
示例
向演示文稿添加标题幻灯片,然后用标题和副标题文本替换标题和副标题的幻灯片占位符。
导入 PPT 命名空间,这样您就不必对 PPT API 类使用长而完全限定的名称。
import mlreportgen.ppt.*创建演示文稿。
ppt = Presentation("myTextBoxPlaceholderPresentation.pptx");
open(ppt);添加标题幻灯片。
slide = add(ppt,"Title Slide");使用幻灯片对象的 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: '1524000emu'
Y: '1122363emu'
Width: '9144000emu'
Height: '2387600emu'
Style: []
Children: []
Parent: [1×1 mlreportgen.ppt.Slide]
Tag: 'ppt.TextBoxPlaceholder:431:407'
Id: '431:407'
find 方法返回一个 mlreportgen.ppt.TextBoxPlaceholder 对象。
用标题文本替换占位符内容。
replace(titlePlaceholderObj(1),"My Title");找到子标题的占位符对象。
subtitlePlaceholderObj = find(slide,"Subtitle")subtitlePlaceholderObj =
TextBoxPlaceholder with properties:
Bold: []
Font: []
ComplexScriptFont: []
FontColor: []
FontSize: []
Italic: []
Strike: []
Subscript: []
Superscript: []
Underline: []
BackgroundColor: []
VAlign: []
Name: 'Subtitle'
X: '1524000emu'
Y: '3602038emu'
Width: '9144000emu'
Height: '1655762emu'
Style: []
Children: []
Parent: [1×1 mlreportgen.ppt.Slide]
Tag: 'ppt.TextBoxPlaceholder:432:408'
Id: '432:408'
子标题的占位符对象也是一个 mlreportgen.ppt.TextBoxPlaceholder 对象。
将占位符内容替换为子标题文本。
replace(subtitlePlaceholderObj(1),"My Subtitle");关闭并查看演示文稿。
close(ppt); rptview(ppt);
这是生成的演示文稿中的标题幻灯片:

输入参数
文本框占位符,指定为 mlreportgen.ppt.TextBoxPlaceholder 对象。
用作文本框占位符内容替换的段落,指定为字符向量、字符串标量或 mlreportgen.ppt.Paragraph 对象。
输出参量
替换段落,作为 mlreportgen.ppt.Paragraph 对象返回。
版本历史记录
在 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)