IChartDataWorkbook.CalculateFormulas method

Calculates all formulas in the workbook and updates corresponding cells values.

public void CalculateFormulas()


exception condition
CellCircularReferenceException Workbook contains formulas with a circular reference.
CellUnsupportedDataException Cell data is not supported.


Example shows how to assign a formula to the cell and to calculate a value. The value of the “B4” cell is getting set to 5.

using (Presentation pres = new Presentation())
    IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Pie, 100, 100, 300, 400);
    IChartDataWorkbook wb = chart.ChartData.ChartDataWorkbook;
    wb.GetCell(0, "B2", 2);	
	wb.GetCell(0, "B3", 3);	
    wb.GetCell(0, "B4").Formula = "B2+B3";

See Also