Page tree
Skip to end of metadata
Go to start of metadata

如果你自定义了一个方法,或者如果你希望将内建的方法组合成一个新的方法,你可以使用自定义方法。

你可以像调用任何内部函数一样调用自定义函数。

示例代码
以下代码创建了一个自定义函数

JavaScript
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();
// Add Custom function
// Type =myfunc(1)
// in a cell to see the result
function myfunc() {}
myfunc.prototype = new GC.Spread.CalcEngine.Functions.Function("myfunc", 0, 0, {name: "myfunc",description: "This is my first function"});
myfunc.prototype.evaluate = function (args) {
    return 100;
spread.addCustomFunction(new myfunc());
  • No labels