跳到主要内容

SetSpecialFormat

设置字段的特殊格式。

语法

expression.SetSpecialFormat(format);

expression - 表示 ApiTextField 类的变量。

参数

名称必需/可选数据类型默认值描述
format必需PsfFormat应用于值的格式样式

返回值

boolean

示例

在 PDF 中为文本字段应用预定义格式(如电话号码)。

// How do I automatically format phone numbers and social security numbers in a PDF?

// Use built-in formats to style user input in a PDF.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let textField = Api.CreateTextField([10, 10, 160, 30]);
page.AddObject(textField);

textField.SetSpecialFormat("phone");
textField.SetValue("1234567890");