Skip to main content

GetFormat

Gets Format action.

Syntax​

expression.GetFormat();

expression - A variable that represents an ApiActionCollection class.

Parameters​

This method doesn't have any parameters.

Returns​

ApiJsAction

Example​

This example gets the Format action from a text field's action collection.

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

let formatAction = Api.CreateJsAction("AFNumber_Format(2, 0, 0, 0, '$', true);");
let widgets = textField.GetAllWidgets();
let actions = widgets[0].GetActions();
actions.SetFormat(formatAction);

let action = actions.GetFormat();
console.log('Format action script: ' + action.GetScript());