主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

append

类: mlreportgen.ppt.TableRow
命名空间: mlreportgen.ppt

将表条目追加到表行

说明

tableEntryObj = append(tableRow,entry) 将表条目追加到表行。

示例

示例

全部展开

创建演示文稿。

import mlreportgen.ppt.*

ppt = Presentation("myTableEntryPresentation.pptx");
open(ppt);
add(ppt,"Title and Content");

创建一个包含三列的表。

table1 = Table(3);

创建第一个表行。

tr1 = TableRow();
tr1.Style = {Bold(true)};

为第一行创建三个表条目。

te1tr1 = TableEntry();
p = Paragraph("first entry");
p.FontColor = "red";
append(te1tr1,p);

te2tr1 = TableEntry();
append(te2tr1,"second entry");

te3tr1 = TableEntry();
te3tr1.Style = {FontColor("green")};
append(te3tr1,"third entry");

将表条目追加到第一行。

append(tr1,te1tr1);
append(tr1,te2tr1);
append(tr1,te3tr1);

创建第二个表行。

tr2 = TableRow();

为第二行创建三个表条目。

te1tr2 = TableEntry();
te1tr2.Style = {FontColor("red")};
p = Paragraph("first entry");
append(te1tr2,p);

te2tr2 = TableEntry();
append(te2tr2,"second entry");

te3tr2 = TableEntry();
te3tr2.Style = {FontColor("green")};
append(te3tr2,"third entry");

将表条目追加至第二行。

append(tr2,te1tr2);
append(tr2,te2tr2);
append(tr2,te3tr2);

将表行追加到表中。

append(table1,tr1);
append(table1,tr2);

使用 mlreportgen.ppt.Presentation.find 方法查找具有 Content 占位符的幻灯片。在这种情况下,有两个。

contents = find(ppt,"Content");

将第二张幻灯片中的表替换为 table1

replace(contents(1),table1);

生成演示文稿。打开 myTableEntryPresentation.pptx。在 Windows® 平台上,您可以在 MATLAB® 中打开演示文稿:

close(ppt);
rptview(ppt);

Sample presentation with a table that contains three columns and two rows. The text in the first column is red, the text in the second column is black, and the text in the third column is green.

输入参数

全部展开

要追加内容的表行,指定为 mlreportgen.ppt.TableRow 对象。

要追加到表行的表条目,指定为 mlreportgen.ppt.TableEntry 对象。

输出参量

全部展开

表条目,作为 mlreportgen.dom.TableEntry 对象返回。

版本历史记录

在 R2015b 中推出