跳到主要内容

SetTableRowPr

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

语法

expression.SetTableRowPr(tableRowPr);

expression - 表示 ApiStyle 类的变量。

参数

名称必需/可选数据类型默认值描述
tableRowPr必需ApiTableRowPr将要设置的表格行属性。

返回值

ApiStyle

示例

将行级格式(如高度)保存到表格样式中,以便文档中的所有行共享这些尺寸。

// How do I set a minimum row height for every table row by defining it in the table style in a document?

// Enforce uniform row sizing across a table by embedding the row settings in a reusable style in a document.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
let tableRowPr = Api.CreateTableRowPr();
tableRowPr.SetHeight("atLeast", 1440);
tableStyle.SetTableRowPr(tableRowPr);

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