跳到主要内容

SetTableCellPr

设置当前样式的表格单元格属性。

语法

expression.SetTableCellPr(tableCellPr);

expression - 表示 ApiStyle 类的变量。

参数

名称必需/可选数据类型默认值描述
tableCellPr必需ApiTableCellPr将要设置的表格单元格属性。

返回值

ApiStyle

示例

此示例展示如何设置和获取样式的表格单元格属性。

// How to create table cell properties for style and add shading to it.

// Update the table cell properties in the style.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
let tableCellPr = Api.CreateTableCellPr();
tableCellPr.SetShd("clear", Api.HexColor('#FF6F3D'));
tableStyle.SetTableCellPr(tableCellPr);

let table = Api.CreateTable(2, 3);
table.SetWidth("percent", 100);
doc.Push(table);
table.SetStyle(tableStyle);
table.SetTableLook(true, true, true, true, true, true);