Back to Devexpress

AutoFilterColumn.ApplyFilterCriteria(FilterValue, IList<DateGrouping>) Method

officefileapi-devexpress-dot-spreadsheet-dot-autofiltercolumn-dot-applyfiltercriteria-x28-devexpress-dot-spreadsheet-dot-filtervalue-system-dot-collections-dot-generic-dot-ilist-devexpress-dot-spreadsheet-dot-dategrouping-x29.md

latest7.2 KB
Original Source

AutoFilterColumn.ApplyFilterCriteria(FilterValue, IList<DateGrouping>) Method

Filters data by cell values and DateTime values.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void ApplyFilterCriteria(
    FilterValue filters,
    IList<DateGrouping> dateGroupings
)
vb
Sub ApplyFilterCriteria(
    filters As FilterValue,
    dateGroupings As IList(Of DateGrouping)
)

Parameters

NameTypeDescription
filtersFilterValue

A FilterValue object containing values to be used in a filter.

| | dateGroupings | IList<DateGrouping> |

A list of DateGrouping items.

|

Remarks

Use the ApplyFilterCriteria method to filter a column that contains data of different types (for example, text and dates), as illustrated in the following example:

View Example

vb
' Enable filtering for the specified cell range.
Dim range As CellRange = worksheet("B2:E23")
worksheet.AutoFilter.Apply(range)
' Create date grouping item to filter January 2015 dates.
Dim groupings As IList(Of DateGrouping) = New List(Of DateGrouping)()
Dim dateGroupingJan2015 As New DateGrouping(New Date(2015, 1, 1), DateTimeGroupingType.Month)
groupings.Add(dateGroupingJan2015)

' Filter the data in the "Reported Date" column to display values reported in January 2015.
worksheet.AutoFilter.Columns(3).ApplyFilterCriteria("gennaio 2015", groupings)
csharp
// Enable filtering for the specified cell range.
CellRange range = worksheet["B2:E23"];
worksheet.AutoFilter.Apply(range);
// Create date grouping item to filter January 2015 dates.
IList<DateGrouping> groupings = new List<DateGrouping>();
DateGrouping dateGroupingJan2015 = new DateGrouping(new DateTime(2015, 1, 1), DateTimeGroupingType.Month);
groupings.Add(dateGroupingJan2015);

// Filter the data in the "Reported Date" column to display values reported in January 2015.
worksheet.AutoFilter.Columns[3].ApplyFilterCriteria("gennaio 2015", groupings);

The following code snippets (auto-collected from DevExpress Examples) contain references to the ApplyFilterCriteria(FilterValue, IList<DateGrouping>) 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-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/AutoFilterActions.cs#L220

csharp
// Filter the data in the "Reported Date" column to display values reported in January 2015.
worksheet.AutoFilter.Columns[3].ApplyFilterCriteria("gennaio 2015", groupings);
#endregion #FilterMixedDataTypesByValues

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

csharp
// Filter the data in the "Reported Date" column to display values reported in January 2015.
worksheet.AutoFilter.Columns[3].ApplyFilterCriteria("gennaio 2015", groupings);
#endregion #FilterMixedDataTypesByValues

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

csharp
// to display values reported in January 2015.
worksheet.AutoFilter.Columns[3].ApplyFilterCriteria("gennaio 2015", groupings);
#endregion #FilterMixedDataByValues

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

vb
' Filter the data in the "Reported Date" column to display values reported in January 2015.
                worksheet.AutoFilter.Columns(3).ApplyFilterCriteria("gennaio 2015", groupings)
' #End Region ' #FilterMixedDataTypesByValues

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

vb
' Filter the data in the "Reported Date" column to display values reported in January 2015.
                worksheet.AutoFilter.Columns(3).ApplyFilterCriteria("gennaio 2015", groupings)
' #End Region ' #FilterMixedDataTypesByValues

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

vb
' to display values reported in January 2015.
            worksheet.AutoFilter.Columns(3).ApplyFilterCriteria("gennaio 2015", groupings)
' #End Region ' #FilterMixedDataByValues

See Also

WinForms Spreadsheet Control Examples

AutoFilterColumn Interface

AutoFilterColumn Members

DevExpress.Spreadsheet Namespace