跳到主要内容

SetNumberFormat

Sets number format for field.

Syntax

expression.SetNumberFormat(nDemical, sSepStyle, sNegStyle, sCurrency, bCurrencyPrepend);

expression - A variable that represents a ApiTextField class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nDemicalRequirednumbernumber of decimals
sSepStyleRequiredNumberSepStylenumber separate style
sNegStyleRequiredNumberNegStylenumber negative style
sCurrencyRequiredstringcurrency sybmol
bCurrencyPrependRequiredbooleanIf true, places the currency symbol before the number (e.g., $1,234.56); if false, places it after (e.g., 1,234.56$).

Returns

boolean

Example

This example gets text field and sets number format for it.

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

textField.SetNumberFormat(0, "us", "black-minus", "$", true);
textField.SetValue('-1000.50');