Skip to main content

SetNumberFormat

Sets number format for field.

Syntax

expression.SetNumberFormat(decimalPlaces, separatorStyle, negativeStyle, currency, currencyPrepend);

expression - A variable that represents a ApiComboboxField class.

Parameters

NameRequired/OptionalData typeDefaultDescription
decimalPlacesRequirednumberThe number of digits after the decimal point.
separatorStyleRequiredNumberSepStyleThe number separator style.
negativeStyleRequiredNumberNegStyleThe negative number display style.
currencyRequiredstringThe currency symbol.
currencyPrependRequiredbooleanIf 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

Display numbers with currency and formatting in a PDF.

// Can I show dollar signs and commas with numbers in a PDF?

// Control the appearance of numerical values in a PDF.

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

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