版主,这个是可以的,我已经找到了.呵
- if (fpS.ActiveSheet != null && fpS.ActiveSheet.ActiveCell != null)
- {
- FormulaEditorUI dlg = new FormulaEditorUI(fpS.ActiveSheet);
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string formula = dlg.GetFormula();
- try
- {
- fpS.ActiveSheet.SetFormula(fpS.ActiveSheet.ActiveRowIndex, fpS.ActiveSheet.ActiveColumnIndex, formula);
- }
- catch
- {
- MessageBox.Show("请输入正确的公式!");
- }
- }
- }
复制代码 |