[]
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.
void ClearLabelFilter()
Sub ClearLabelFilter()
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();