价格setTimeout 0调整一下代码的执行顺序就好了。应该是自定义公式中用setArray方法在执行上会跟公式本身起冲突
- window.onload = function () {
- var designer = new GC.Spread.Sheets.Designer.Designer("gc-designer-container");
- var spread = designer.getWorkbook();
- // var sheet = spread.getActiveSheet();
- function qc() {
- this.name = "qc";
- this.minArgs = 1;
- this.maxArgs = 10;
- this.typeName = "qc";
- }
- qc.prototype = new GC.Spread.CalcEngine.Functions.Function();
- qc.prototype.isContextSensitive = function () {
-     return true;
- }
- qc.prototype.evaluate = function(){
- var result, args = arguments;
- var context = arguments[0];
- var sheet = context.source.getSheet();
- setTimeout(function(){
- sheet.setArray(5, 1, [[100,200,300],[300,500,600]]);
- },0);
-
-
- return 1
-
- }
- GC.Spread.CalcEngine.Functions.defineGlobalCustomFunction('qc',new qc());
- }
复制代码 |