跳到主要内容

SetTableTitle

设置表格标题。

语法​

expression.SetTableTitle(title);

expression - 表示 ApiTable 类的变量。

参数​

名称必需/可选数据类型默认值描述
title必需string要设置的表格标题。

返回值​

boolean

示例​

在演示文稿中设置表格的标题。

// Useful for setting and retrieving a table title.

// Create a table, set its title, and display the title in the first cell.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const table = Api.CreateTable(3, 3);
table.SetTableTitle("Quarterly Report");
const paragraph = Api.CreateParagraph();
paragraph.AddText("Table title: " + table.GetTableTitle());
table.GetCell(0, 0).GetContent().Push(paragraph);
slide.RemoveAllObjects();
slide.AddObject(table);