[]
Represents a custom formula in a PivotTable report.
An IPivotFormula describes a formula defined in a PivotTable report, such as a formula created by a calculated item, and exposes its name, formula text, and calculation order within the PivotTable report.
public interface IPivotFormula
Public Interface IPivotFormula
worksheet.Range["A1:C4"].Value = new object[,] {
{"Product", "Category", "Amount"},
{"Apple", "Fruit", 120},
{"Banana", "Fruit", 80},
{"Bran", "Snack", 60}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Product"].CalculatedItems().Add("TotalFruit", "=Apple + Banana");
IPivotFormula pivotFormula = pivotTable.PivotFormulas[0];
| Name | Description |
|---|---|
| Formula | Gets the formula text of the current PivotTable custom formula. |
| Index | Gets or sets the solved order of the current PivotTable formula. |
| Name | Gets the name of the current PivotTable formula. Use this property to retrieve the formula name from an IPivotFormula in the PivotFormulas collection. |