If you have functions that you use on a regular basis that are not in the built-in functions or if you wish to combine some of the built-in functions into a single function, you can do so by defining your own custom functions. They can be called as you would call any of the built-in functions.
Using Code
This example creates a custom function.
JavaScript |
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 resultfunction 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()); |
|