TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

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