跳到主要内容

GetTextPr

返回将应用于表格中符合条件格式类型的所有文本运行的文本运行属性集。

语法

expression.GetTextPr();

expression - 表示 ApiTableStylePr 类的变量。

参数

此方法没有任何参数。

返回值

ApiTextPr

示例

此示例展示如何获取将应用于表格中符合条件格式类型的所有文本运行的文本运行属性集。

// How to get text properties of the table style and make it bold.

// Make the table text bold.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We create a 3x3 table and set the bold font weight to the text in cell #1:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
let tableStylePr = tableStyle.GetConditionalTableStyle("topLeftCell");
table.SetTableLook(true, true, true, true, true, true);
tableStylePr.GetTextPr().SetBold(true);
paragraph = table.GetRow(0).GetCell(0).GetContent().GetElement(0);
paragraph.AddText("Bold text");
paragraph = table.GetRow(0).GetCell(1).GetContent().GetElement(0);
paragraph.AddText("Normal text");
table.SetStyle(tableStyle);
doc.Push(table);