添加自定义函数中有多个参数需要传递时,需要该怎么设置公式:红色部分设置无效
_gcSpread.AddCustomFunction(new CubeAreaFunctionInfo());
_gcSpread.ActiveSheet.SetFormula(11, 11, "CUBEAREA(4,5,6)");
public class CubeAreaFunctionInfo : CalcFunction
{
public override object Evaluate(object[] args)
{
double width = CalcConvert.ToDouble(args[0]);
double length = CalcConvert.ToDouble(args[1]);
double height = CalcConvert.ToDouble(args[2]);
return width * length + length * height + height * width;
}
public override int MaxArgs
{
get { return 1; }
}
public override int MinArgs
{
get { return 1; }
}
public override string Name
{
get { return "CUBEAREA"; }
}
}
|
|