跳到主要内容

SetLabel

设置当前复选框的标签。

语法

expression.SetLabel(label);

expression - 表示 ApiCheckBoxForm 类的变量。

参数

名称必需/可选数据类型默认值描述
label必需string标签。

返回值

boolean

示例

此示例为复选框表单设置标签文本。

// How to add a label to the checkbox form.

// Set a label text to the checkbox.

let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"tip": "Specify your marital status", "required": true, "radio": true, "key" : "Marital status"});
checkBoxForm.SetLabel(" Married");
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddLineBreak();
checkBoxForm = Api.CreateCheckBoxForm({"tip": "Specify your marital status", "required": true, "radio" : true, "key" : "Marital status"});
checkBoxForm.SetLabel(" Single");
paragraph.AddElement(checkBoxForm);