[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.ClearAllFilters

ClearAllFilters Method

ClearAllFilters()

Deletes all filters currently applied to the pivot table.

This method removes filters in the pivot table's filter collection, clears manual filtering, and resets all pivot fields in the Report Filter area to their default item.

Declaration
void ClearAllFilters()
Sub ClearAllFilters()
Examples
object[,] sourceData = {
    {"Product", "Country", "Amount"},
    {"Apple", "Canada", 120},
    {"Apple", "France", 150},
    {"Banana", "Canada", 90}
};
worksheet.Range["A1:C4"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "PivotTable1");
IPivotField fieldProduct = pivotTable.PivotFields["Product"];
fieldProduct.Orientation = PivotFieldOrientation.RowField;
IPivotField fieldAmount = pivotTable.PivotFields["Amount"];
fieldAmount.Orientation = PivotFieldOrientation.DataField;
fieldProduct.PivotFilters.Add(PivotFilterType.CaptionContains, "pp");
pivotTable.ClearAllFilters();