CalculateFormulas

ChartDataWorkbook.CalculateFormulas method

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

public void CalculateFormulas()

Exceptions

exceptioncondition
CellCircularReferenceExceptionWorkbook contains formulas with a circular reference.
CellUnsupportedDataExceptionCell data is not supported.

Examples

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.

[C#]
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";
    wb.CalculateFormulas();
    ...
}

See Also