您好,
使用以下代码测试,没有能够重现您的问题,您可以看下是否遗漏了哪些步骤- public partial class Form4 : Form
- {
- public Form4()
- {
- InitializeComponent();
- }
- private void Form4_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.SheetView sv;
- sv = fpSpread1.ActiveSheet;
- sv.AddCustomFunction((new CubeFunctionInfo()));
- sv.SetFormula(0, 0, "CUBE(4)");
- sv.SetFormula(0, 2, "CUBE(3)");
- sv.SetFormula(0, 3, "SUM(A1, C1)");
- }
- }
- public class CubeFunctionInfo : FarPoint.CalcEngine.FunctionInfo
- {
- public override string Name { get { return "CUBE"; } }
- public override int MinArgs { get { return 1; } }
- public override int MaxArgs { get { return 1; } }
- public override object Evaluate(object[] args)
- {
- double num = FarPoint.CalcEngine.CalcConvert.ToDouble(args[0]);
- return num * num;
- }
- }
复制代码 |