你好,可以调用 SheetView.RecalculateAll 方法 ,参考代码:
- DialogResult dlg;
- fpSpread1.ActiveSheet.SetValue(0, 0, 20);
- fpSpread1.ActiveSheet.SetValue(0, 1, 10);
- fpSpread1.ActiveSheet.SetFormula(3, 0, "SUM(A1,B1)");
- fpSpread1.ActiveSheet.SetFormula(4, 0, "A1*B1");
- dlg = MessageBox.Show("确定要重新计算所有公式?", "重计算所有", MessageBoxButtons.YesNo);
- if (dlg == DialogResult.Yes)
- {
- fpSpread1.ActiveSheet.SetValue(0, 1, 100);
- fpSpread1.ActiveSheet.RecalculateAll();
- }
复制代码 |