跳到主要内容

TEXT

Converts a value to text in a specific number format.

Syntax

expression.TEXT(arg1, arg2);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | number | stringA number, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
arg2RequiredApiRange | ApiName | stringA number format in the text form from the -Number format combo box on the -Home tab.

Returns

string

Example

let worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
worksheet.GetRange("A1").SetValue(func.TEXT(45.5, "$0.00"));