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);