Back to Devexpress

AutoFilterBase.Clear() Method

officefileapi-devexpress-dot-spreadsheet-dot-autofilterbase-21473c4f.md

latest5.9 KB
Original Source

AutoFilterBase.Clear() Method

Removes all the filters specified in a worksheet and displays all hidden rows.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void Clear()
vb
Sub Clear

Remarks

To clear a filter for a specified column, use the AutoFilterColumn.Clear method.

Example

View Example

csharp
Worksheet worksheet = workbook.Worksheets["Regional sales"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Enable filtering for the specified cell range.
CellRange range = worksheet["B2:E23"];
worksheet.AutoFilter.Apply(range);

// Filter values in the "Sales" column that are greater than 5000$.
worksheet.AutoFilter.Columns[2].ApplyCustomFilter(5000, FilterComparisonOperator.GreaterThan);

// Clear the filter.
worksheet.AutoFilter.Clear();
vb
Dim worksheet As Worksheet = workbook.Worksheets("Regional sales")
workbook.Worksheets.ActiveWorksheet = worksheet

' Enable filtering for the specified cell range.
Dim range As CellRange = worksheet("B2:E23")
worksheet.AutoFilter.Apply(range)

' Filter values in the "Sales" column that are greater than 5000$.
worksheet.AutoFilter.Columns(2).ApplyCustomFilter(5000, FilterComparisonOperator.GreaterThan)

' Clear the filter.
worksheet.AutoFilter.Clear()

The following code snippets (auto-collected from DevExpress Examples) contain references to the Clear() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L143

csharp
Table storesTable = customerStores.Tables[0];
storesTable.AutoFilter.Clear();
storesTable.AutoFilter.Columns[1].ApplyFilterCriteria(customerId);

winforms-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/AutoFilterActions.cs#L407

csharp
// Clear the filter.
worksheet.AutoFilter.Clear();
#endregion #ClearFilter

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/AutoFilterActions.cs#L408

csharp
// Clear the filter.
worksheet.AutoFilter.Clear();
#endregion #ClearFilter

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/AutoFilterActions.cs#L313

csharp
// Clear the filter.
worksheet.AutoFilter.Clear();
#endregion #ClearFilter

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L131

vb
Dim storesTable As Table = customerStores.Tables(0)
storesTable.AutoFilter.Clear()
storesTable.AutoFilter.Columns(1).ApplyFilterCriteria(customerId)

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/AutoFilterActions.vb#L293

vb
' Clear the filter.
                worksheet.AutoFilter.Clear()
' #End Region ' #ClearFilter

wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/AutoFilterActions.vb#L292

vb
' Clear the filter.
                worksheet.AutoFilter.Clear()
' #End Region ' #ClearFilter

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/AutoFilterActions.vb#L292

vb
' Clear the filter.
            worksheet.AutoFilter.Clear()
' #End Region ' #ClearFilter

See Also

AutoFilterBase Interface

AutoFilterBase Members

DevExpress.Spreadsheet Namespace