replace
类: mlreportgen.ppt.TablePlaceholder
命名空间: mlreportgen.ppt
用表替换表占位符
说明
用指定的表替换指定的表占位符并返回表对象。replacementTableObj = replace(tablePlaceholder,table)
示例
在演示文稿中添加 Title and Table 幻灯片,然后用您自己的标题和表替换标题和表占位符。
导入 PPT 命名空间,这样您就不必对 PPT API 类使用长而完全限定的名称。
import mlreportgen.ppt.*创建演示文稿。
ppt = Presentation("myTablePlaceholderPresentation.pptx");
open(ppt);添加具有 Title and Table 布局的幻灯片。
slide = add(ppt,"Title and Table");使用幻灯片对象的 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:555:529'
Id: '555:529'
find 方法返回一个 mlreportgen.ppt.TextBoxPlaceholder 对象。
用标题文本替换占位符内容。
replace(titlePlaceholderObj,"Fourth-Order Magic Square");使用幻灯片对象的 find 方法查找名为 Table 的占位符对象。
tablePlaceholderObj = find(slide,"Table")tablePlaceholderObj =
TablePlaceholder with properties:
Bold: []
Font: []
ComplexScriptFont: []
FontColor: []
FontSize: []
Italic: []
Strike: []
Subscript: []
Superscript: []
Underline: []
BackgroundColor: []
VAlign: []
Name: 'Table'
X: []
Y: []
Width: []
Height: []
Style: []
Children: []
Parent: [1×1 mlreportgen.ppt.Slide]
Tag: 'ppt.TablePlaceholder:556:530'
Id: '556:530'
find 方法返回一个 mlreportgen.ppt.TablePlaceholder 对象。
将表格占位符替换为四阶幻方表。
replace(tablePlaceholderObj,Table(magic(4)));
关闭并查看演示文稿
close(ppt); rptview(ppt);
以下是生成的演示文稿中的幻灯片:

输入参数
表占位符,指定为 mlreportgen.ppt.TablePlaceholder 对象。
用于替换表占位符的表,指定为 mlreportgen.ppt.Table 对象。
输出参量
替换表,作为 mlreportgen.ppt.Table 对象返回。
版本历史记录
在 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)