跳到主要内容

InsertTextForm

在选定文本上方插入具有指定文本框属性的文本框。

语法

expression.InsertTextForm(formPr);

expression - 表示 ApiDocument 类的变量。

参数

名称必需/可选数据类型默认值描述
formPr必需TextFormInsertPr用于插入文本字段的属性。

返回值

ApiTextForm

示例

在文档中将选定文本替换为可编辑的表单字段。

// How do I convert text into a fillable field in a document?

// Turn highlighted content into an interactive text input area in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("First name");
paragraph.Select();
doc.InsertTextForm({
"key": "Personal information",
"tip": "Enter your first name",
"required": true,
"placeholder": "Name",
"comb": true,
"maxCharacters": 10,
"cellWidth": 3,
"multiLine": false,
"autoFit": false,
"placeholderFromSelection": true,
"keepSelectedTextInForm": false
});