跳到主要内容

GetFormType

返回当前表单的类型。

继承自 ApiFormBase.GetFormType。

语法​

expression.GetFormType();

expression - 表示 ApiComplexForm 类的变量。

参数​

此方法没有任何参数。

返回值​

FormType

示例​

获取文档中复合表单的类型。

// How do I find out what type a form is in a document?

// Identify whether a form belongs to a specific category before processing it in a document.

let doc = Api.GetDocument();
let complexForm = Api.CreateComplexForm({"key": "Complex1"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(complexForm);
let formType = complexForm.GetFormType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form type: " + formType);
doc.Push(paragraph);