[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.Formula

Formula Property

Formula

Gets or sets the formula of the PivotTable field in A1-style notation and in the language of the macro.

This property returns the formula text associated with the field.

Declaration
string Formula { get; set; }
Property Formula As String
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Product", "Amount"},
    {"Apple", 100},
    {"Banana", 200},
    {"Orange", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField field = pivotTable.CalculatedFields.Add("TotalAmount", "=Amount*2");
string formula = field.Formula;