示例#1
0
        /// <summary>
        ///     更新Formula
        /// </summary>
        public void UpdateFormula()
        {
            var formulaEvaluator = Workbook.GetFormulaEvaluator();

            foreach (var sheet in Workbook.AsEnumerable())
            {
                sheet.ForceFormulaRecalculation = true;
                foreach (var row in sheet.AsEnumerable())
                {
                    foreach (var cell in row.AsEnumerable())
                    {
                        if (cell != null &&
                            cell.CellType == CellType.Formula)
                        {
                            formulaEvaluator.EvaluateFormulaCell(cell);
                        }
                    }
                }
            }
        }