[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.ClearValueFilter

ClearValueFilter Method

ClearValueFilter()

Clears all value filters from this pivot field.

This method removes value-based filter criteria from the pivot field's PivotFilters collection. Use this method when you want to clear value filters without removing label filters or manual filtering.

Declaration
void ClearValueFilter()
Sub ClearValueFilter()
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Product", "Amount"},
    {"Apple", 100},
    {"Banana", 200},
    {"Apple", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField productField = pivotTable.PivotFields["Product"];
productField.Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
PivotFilterOptions options = new PivotFilterOptions();
options.AppliedDataField = 0;
productField.PivotFilters.Add(PivotFilterType.ValueGreaterThan, 120, null, options);
productField.ClearValueFilter();