找回密码
 立即注册

QQ登录

只需一步,快速开始

taxsoft

中级会员

76

主题

246

帖子

608

积分

中级会员

积分
608

活字格认证微信认证勋章元老葡萄

taxsoft
中级会员   /  发表于:2012-10-17 17:37  /   查看:5434  /  回复:6
.Recalculate()
           .RecalculateAll()

不会计算自定义公式。

6 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-10-17 18:52:00
沙发
回复 1楼taxsoft的帖子

目前的解决方法是,重新设这公式,如:
  1. this.fpSpread1.Sheets[0].Recalculate();
  2.             this.fpSpread1.Sheets[0].RecalculateAll();
  3.             this.fpSpread1.Sheets[0].SetFormula(2, 0, "CUBE(" + this.fpSpread1.Sheets[0].Cells[0, 0].Value.ToString() + ")");
复制代码
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-10-18 10:27:00
板凳
回复 1楼taxsoft的帖子

可以尝试在你的自定义方法中添加 IsVolatile 重载,如:

  1. [Serializable]
  2.     public class AbcFunctionInfo : FunctionInfo
  3.     {
  4.         private int count = 0;
  5.         public override string Name
  6.         {
  7.             get { return "ABC"; }
  8.         }
  9.         public override int MinArgs
  10.         {
  11.             get { return 0; }
  12.         }
  13.         public override int MaxArgs
  14.         {
  15.             get { return 100; }
  16.         }
  17.         public override bool IsVolatile()
  18.         {
  19.             return true;
  20.         }
  21.         public override object Evaluate(object[] args)
  22.         {
  23.             count = count + 1;
  24.             return count;
  25.         }
  26.     }
复制代码
回复 使用道具 举报
taxsoft
中级会员   /  发表于:2012-10-18 12:06:00
地板
回复 1楼taxsoft的帖子

可以尝试在你的自定义方法中添加 IsVolatile 重载,如:
[code]
......
iceman 发表于 2012-10-18 10:27:00


无法 Override

你测试过嘛?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-10-18 12:12:00
5#
回复 4楼taxsoft的帖子

你发个测试程序上来我看看?我测试成功

6323-CustomFun.zip (59.96 KB, 下载次数: 89)
回复 使用道具 举报
taxsoft
中级会员   /  发表于:2012-10-18 13:18:00
6#
回复 4楼taxsoft的帖子

你发个测试程序上来我看看?我测试成功

[/attac......
iceman 发表于 2012-10-18 12:12:00


非常感谢详细的DEMO,我已经找到原因了,是我自己封的方法的BUG,那两个计算没有问题
另外,那个重载不是必须的!
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-10-18 15:21:00
7#
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部