1. 创建自定义函数并注册到Spread 其中函数如下, 调用函数会打印code参数
const DemoFunction = function () {};
DemoFunction.prototype = new GC.Spread.CalcEngine.Functions.AsyncFunction('DemoFunction', 1, 255, {
description: '实例函数',
parameters: [
{
name: 'code',
}
],
});
DemoFunction.prototype.evaluateAsync = (context, ...args) => {
const code = args[0];
console.log('code', code)
};
2. 执行函数
sheet.setFormula(0, 0, `=DemoFunction('010343')`);
期望code打印出来为010343
实际code打印出来为10343
|