Skip to main content
.NET Framework 4.5.2+
Row

DateGrouping Class

A criterion for date values.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v22.1.Core.dll

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

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

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

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.

Inheritance

Object
DateGrouping
See Also