本帖最后由 yeseruanchong 于 2018-7-10 16:04 编辑
sheet.setValue(1, 1, 'Press \'Add a Custom Function\' button');
sheet.setColumnWidth(1, 225);
sheet.setColumnWidth(2, 100);
function FactorialFunction() {
this.name = "FACTORIAL";
this.maxArgs = 1;
this.minArgs = 1;
}
FactorialFunction.prototype = new GC.Spread.CalcEngine.Functions.Function();
FactorialFunction.prototype.evaluate = function(arg) {
sheet.setValue(7,8,"2016565"); /// 在这里修改表单的值 为什么不行 ? 一直处于循环中,
var result = 1;
if (arguments.length === 1 && !isNaN(parseInt(arg))) {
for (var i = 1; i <= arg; i++) {
result = i * result;
}
return result;
}
return "#VALUE!";
};
var factorial = new FactorialFunction();
sheet.addCustomFunction(factorial);
感谢解答 ^-^!!!
|
|