Skip to main content
Row

DateGrouping Class

A criterion for date values.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public class DateGrouping

Remarks

When filtering a column containing dates, use the AutoFilterColumn.ApplyFilterCriteria method to specify criteria for date values or modify an existing filter criteria.

The following picture shows the AutoFilter dialog for a column with certain data applying a filter that uses the DateGrouping with the DateGrouping.Value property set to DateTime(2015, 3, 1) and the DateGrouping.GroupingType set to DateTimeGroupingType.Month.

DateGrouping_AutoFillter_Dialog

Example

View Example

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);

// 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);

Inheritance

Object
DateGrouping
See Also