GetText
返回当前表单中的文本。
继承自 ApiFormBase.GetText。
语法
expression.GetText();
expression - 表示 ApiComboBoxForm 类的变量。
参数
此方法没有任何参数。
返回值
string
示例
读取文档中组合框表单的当前文本值。
// How do I get the text currently shown in a combo box form in a document?
// Check what value a user has selected or entered by reading the combo box text.
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 text = comboBoxForm.GetText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form text: " + text);
doc.Push(paragraph);