[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.ClearLabelFilter

ClearLabelFilter Method

ClearLabelFilter()

Clears all label filters or date filters from this pivot field.

This method removes the label-based filter criteria stored in the pivot field's PivotFilters collection. Use this method when you want to keep other filter types, such as value filters, unchanged.

Declaration
void ClearLabelFilter()
Sub ClearLabelFilter()
Examples
object[,] sourceData = new object[,] {
    {"Product", "Amount"},
    {"Mi Phone", 100},
    {"Camera", 200},
    {"Mi Band", 150}
};
worksheet.Range["A1:B4"].Value = sourceData;
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;
productField.PivotFilters.Add(PivotFilterType.CaptionContains, "Mi");
productField.ClearLabelFilter();