SetTextPr
将文本设置应用于内容控件的内容。
语法
expression.SetTextPr(textPr);
expression - 表示 ApiBlockLvlSdt 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| textPr | 必需 | ApiTextPr | 将设置到内容控件内容的属性。 |
返回值
boolean
示例
将文本设置应用于文档中内容控件的内容。
// Create a block content control, add a text to it, and set the font size and bold property to this text in a document.
// Specify the text properties object and apply its settings to the block-level content control object in a document.
let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with the font size set to 30 and the font weight set to bold.");
doc.AddElement(0, blockLvlSdt);
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
blockLvlSdt.SetTextPr(textPr);