跳到主要内容

RemoveCustomFunction

删除自定义函数。

语法

expression.RemoveCustomFunction(sName);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
sName必需string自定义函数的名称。

返回值

boolean

示例

此示例清除当前自定义函数。

// How to delete custom created function from the library.

// Remove custom function library.

Api.AddCustomFunctionLibrary("LibraryName", function(){
/**
* Function that returns the argument
* @customfunction
* @param {any} first First argument.
* @returns {any} second Second argument.
*/
Api.AddCustomFunction(function ADD(first, second) {
return first + second;
});
});
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("=ADD(1, 2)");
Api.RemoveCustomFunction("add");
worksheet.GetRange("A3").SetValue("The ADD custom function was removed.");