你好,
可以使用Spread的AddCustomName方法增加一个自定义Formula,实现类似你需要的功能。例子代码如下:
fpSpread1.AllowUserFormulas = true;
fpSpread1.ActiveSheet.Columns[0].Label = "其他1";
fpSpread1.ActiveSheet.Columns[1].Label = "工资";
fpSpread1.ActiveSheet.Columns[2].Label = "其他2";
fpSpread1.ActiveSheet.Columns[3].Label = "保险";
fpSpread1.ActiveSheet.Columns[4].Label = "其他3";
fpSpread1.ActiveSheet.Columns[5].Label = "合计";
fpSpread1.ActiveSheet.AddCustomName("工资保险合计", "Sum(B1, D1)", 0, 5);
fpSpread1.ActiveSheet.Columns[5].Formula = "工资保险合计";
请注意,CustomName中不能有运算符号如:+,-,*,/等。 |