跳到主要内容

SetLabel

设置当前复选框的标签。

语法

expression.SetLabel(label);

expression - 表示 ApiCheckBoxForm 类的变量。

参数

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

返回值

boolean

示例

为文档中的复选框表单分配可见标签。

// How do I add descriptive text next to a checkbox in a document?

// Label each checkbox option so readers know what they are selecting in a document.

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);