TEXT

TEXT(arg1, arg2) → { string }

Converts a value to text in a specific number format.

Parameters:

Name Type Description
arg1 number | string

A number, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.

arg2 string

A number format in the text form from the Number format combo box on the Home tab.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.TEXT(45.5, "$0.00"));
builder.SaveFile("xlsx", "TEXT.xlsx");
builder.CloseFile();

Resulting document