跳到主要内容

SetMultiline

指定当前文本字段是否应为多行。

语法

expression.SetMultiline(bMultiline);

expression - 表示 ApiTextForm 类的变量。

参数

名称必需/可选数据类型默认值描述
bMultiline必需boolean定义当前文本字段是否为多行(true)或单行(false)。

返回值

boolean

示例

此示例指定文本字段是否应为多行。

// How to set the first text form from this document multiline.

// Set the boolean that represents the multiline property of the text form.

let doc = Api.GetDocument();
let textForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "autoFit": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(textForm);
textForm.ToFixed(3 * 240, 3 * 240);
textForm.SetMultiline(true);
let multiline = textForm.IsMultiline();
paragraph = Api.CreateParagraph();
paragraph.AddText("The first text form from this document is multiline: " + multiline);
doc.Push(paragraph);