TRY NEW VERSION

TRUNC

TRUNC(arg1, arg2) → { number | string | boolean }

Truncates a number to an integer by removing the decimal, or fractional, part of the number.

Parameters:

Name Type Description
arg1 number

Is the number you want to truncate.

arg2 number

Is a number specifying the precision of the truncation, 0 (zero) if omitted.

Returns:

Type
number | string | boolean

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.TRUNC(3.14159265, 5));
builder.SaveFile("xlsx", "TRUNC.xlsx");
builder.CloseFile();

Resulting document