Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

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

Code Block
languagejs
titleJavaScript

...

Copy Code

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());

...