回复 1楼study1990的帖子
没有重现楼主的问题,请楼主给出相关代码片段,我使用下面方法测试生效:
- public partial class WebForm1 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- return;
- this.FpSpread1.Sheets[0].AllowUserFormulas = false;
- FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(5, 5);
- dataModel.AddCustomFunction(new CubeFunctionInfo());
- dataModel.SetFormula(1, 1, "CUBE(4)");
- FpSpread1.ActiveSheetView.DataModel = dataModel;
- }
- }
- [Serializable]
- public class CubeFunctionInfo : 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 = CalcConvert.ToDouble(args[0]);
- return num * num * num;
- }
- }
复制代码 |