跳到主要内容

SetPercentageFormat

设置字段的百分比格式。

语法

expression.SetPercentageFormat(decimalPlaces, separatorStyle);

expression - 表示 ApiTextField 类的变量。

参数

名称必需/可选数据类型默认值描述
decimalPlaces必需number小数点后的位数。
separatorStyle必需NumberSepStyle数字分隔符样式。

返回值

boolean

示例

在 PDF 文本字段中将数字转换并显示为百分比。

// How do I show decimal values as percentages in a PDF?

// Apply percentage formatting to text 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.SetPercentageFormat(0, "us");
textField.SetValue(10);