跳到主要内容

SetTextPr

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

备注

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

继承自 ApiFormBase.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);