[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ICalculatedItems.Remove

Remove Method

Remove(string)

Removes the calculated item with the specified name.

This method removes a calculated item from the current ICalculatedItems collection obtained from CalculatedItems(). Item name matching is case-insensitive. If no calculated item with the specified name exists, this method does nothing.

Declaration
void Remove(string itemName)
Sub Remove(itemName As String)
Parameters
Type Name Description
string itemName

The name of the calculated item to remove. If no matching calculated item exists, no item is removed.

Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Status", "Amount"},
    {"Pending", 100},
    {"Backorder", 200},
    {"Shipped", 300}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "PivotTable1");
pivotTable.PivotFields["Status"].Orientation = PivotFieldOrientation.RowField;
ICalculatedItems calculatedItems = pivotTable.PivotFields["Status"].CalculatedItems();
calculatedItems.Add("Open Orders", "=Pending+Backorder");
calculatedItems.Remove("Open Orders");