GetAllForms
返回文档中所有现有表单。
语法
expression.GetAllForms();
expression - 表示 ApiDocument 类的变量。
参数
此方法没有任何参数。
返回值
ApiForm[]
示例
此示例展示如何获取文档中所有现有的表单。
// Get all forms added to the document.
// How to retrieve all forms, set the text to the first one and select an answer to the second one.
let doc = Api.GetDocument();
let textForm = Api.CreateTextForm({"key": "Name", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(textForm);
let comboBoxForm = Api.CreateComboBoxForm({"key": "Country", "tip": "Choose your country", "required": true, "placeholder": "Country", "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]});
paragraph.AddLineBreak();
paragraph.AddElement(comboBoxForm);
let forms = doc.GetAllForms();
forms[0].SetText("John Smith");
forms[1].SelectListValue("USA");