跳到主要内容

SetHeight

设置当前表格中当前表格行的高度。

语法

expression.SetHeight(sHRule, nValue);

expression - 表示 ApiTableRowPr 类的变量。

参数

名称必需/可选数据类型默认值描述
sHRule必需"auto" | "atLeast"将高度值应用于当前表格行或忽略它的规则。使用 <code>"atLeast"</code> 值以启用 <code>SetHeight</code> 方法。
nValue可选twips当前表格行的高度,以点的二十分之一为单位(1/1440 英寸)。如果 <code>sHRule="auto"<code>,此值将被忽略。

返回值

boolean

示例

此示例设置表格中当前表格行的高度。

// Resize the height of the row.

// How to set a minimum row height of the table.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We create a 3x3 table and set the height of half an inch to all the rows:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetTableLook(true, true, true, true, false, false);
let tableRowPr = tableStyle.GetTableRowPr();
tableRowPr.SetHeight("atLeast", 720);
table.SetStyle(tableStyle);
doc.Push(table);