跳到主要内容

SetTextPr

设置当前行的文本属性。

语法​

expression.SetTextPr(oTextPr);

expression - 表示 ApiTableRow 类的变量。

参数​

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

返回值​

boolean

示例​

在 PDF 中为表格行的所有单元格应用文本格式。

// Change the text style for an entire row of a table in a PDF.

// Style the text across a full table row uniformly in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(3, 3);
const row = table.GetRow(0);
row.GetCell(0).GetContent().AddText('First row');
const textPr = Api.CreateTextPr();
textPr.SetBold(true);
row.SetTextPr(textPr);

page.AddObject(table);