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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

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

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

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

JavaScript

Copy Code

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});var activeSheet = spread.getActiveSheet();// 创建一个自定义函数

// Type =myfunc(1)// 查看结果

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