跳到主要内容

SetTextPr

设置当前表单的文本属性。

备注

仅在此类型表单支持时使用。

继承自 ApiFormBase.SetTextPr。

语法​

expression.SetTextPr(textPr);

expression - 表示 ApiComplexForm 类的变量。

参数​

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

返回值​

boolean

示例​

在文档中为复合表单应用文本格式属性。

// How do I set the font style and size of text inside a form in a document?

// Control the visual appearance of form text by specifying bold, size, and other character styles.

let doc = Api.GetDocument();
let complexForm = Api.CreateComplexForm({"key": "Complex1"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(complexForm);
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
complexForm.SetTextPr(textPr);