跳到主要内容

SetValue

设置文本表单的文本值。

语法

expression.SetValue(value);

expression - 表示 ApiTextForm 类的变量。

参数

名称必需/可选数据类型默认值描述
value必需string要设置的文本值。

返回值

boolean

示例

// The SetValue method fills the text form with the given string value.

// Create a text form, set its value, and add it to the first paragraph.

let doc = Api.GetDocument();
let textForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "multiLine": false, "autoFit": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(textForm);
textForm.SetValue("John Smith");