SetTextPr
设置当前表单的文本属性。
备注
仅在此类型表单支持时使用。
语法
expression.SetTextPr(textPr);
expression - 表示 ApiComboBoxForm 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| textPr | 必需 | ApiTextPr | 将设置到当前表单的文本属性。 |
返回值
boolean
示例
在文档中为组合框表单应用文本格式。
// How do I apply text formatting to a combo box form in a document?
// Make the combo box text bold and larger to highlight it visually in a document.
let doc = Api.GetDocument();
let comboBoxForm = Api.CreateComboBoxForm({"key": "Personal information", "tip": "Choose your country", "required": true, "placeholder": "Country", "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]});
let paragraph = doc.GetElement(0);
paragraph.AddElement(comboBoxForm);
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
comboBoxForm.SetTextPr(textPr);