跳到主要内容

CONVERT

Converts a number from one measurement system to another.

Syntax

expression.CONVERT(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe value in the specified units to be converted.
arg2RequiredApiRange | ApiName | stringThe original measurement unit.
arg3RequiredApiRange | ApiName | stringThe units for the result.

Returns

number

Example

let worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
worksheet.GetRange("A1").SetValue(func.CONVERT(2, "Ibm", "kg"));