Format

Format(expression, [format]) → { string }

Returns a class formatted according to the instructions contained in the format expression.

Parameters:

Name Type Default Description
expression string

Any valid expression.

format string null

A valid named or user-defined format expression.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFormat = Api.Format("123456", ["$#,##0"]);
oWorksheet.GetRange("A1").SetValue(oFormat);
builder.SaveFile("xlsx", "Format.xlsx");
builder.CloseFile();

Resulting document