跳到主要内容

SetTextPr

设置当前行的文本属性。

语法

expression.SetTextPr(oTextPr);

expression - 表示 ApiTableRow 类的变量。

参数

名称必需/可选数据类型默认值描述
oTextPr必需ApiTextPr将设置到当前行的文本属性。

返回值

boolean

示例

此示例设置当前行的文本属性。

// Make the row text bold.

// How to apply new text properties to the table row.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
let row = table.GetRow(0);
let textPr = Api.CreateTextPr();
textPr.SetBold(true);
row.GetCell(0).GetContent().GetElement(0).AddText("First row");
row.SetTextPr(textPr);
doc.Push(table);