Back to Devexpress

PivotField.GroupItems(PivotFieldGroupByType) Method

officefileapi-devexpress-dot-spreadsheet-dot-pivotfield-dot-groupitems-x28-devexpress-dot-spreadsheet-dot-pivotfieldgroupbytype-x29.md

latest6.5 KB
Original Source

PivotField.GroupItems(PivotFieldGroupByType) Method

Performs grouping of the specified type in the current field.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void GroupItems(
    PivotFieldGroupByType groupBy
)
vb
Sub GroupItems(
    groupBy As PivotFieldGroupByType
)

Parameters

NameTypeDescription
groupByPivotFieldGroupByType

A PivotFieldGroupByType enumeration member that determines how the field should be grouped.

|

Remarks

Specify a combination of PivotFieldGroupByType enumeration members which correspond to time periods to group by those periods.

Specify a PivotFieldGroupByType.NumericRanges as a parameter to group the field starting from the smallest value to the largest value using automatically calculated group intervals.

Example

View Example

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

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Access the "DATE" field by its name in the collection.
PivotField field = pivotTable.Fields["DATE"];
// Group field items by quarters and months.
field.GroupItems(PivotFieldGroupByType.Quarters | PivotFieldGroupByType.Months);
vb
Dim worksheet As Worksheet = workbook.Worksheets("Report8")
workbook.Worksheets.ActiveWorksheet = worksheet

' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Access the "DATE" field by its name in the collection.
Dim field As PivotField = pivotTable.Fields("DATE")
' Group field items by quarters and months.
field.GroupItems(PivotFieldGroupByType.Quarters Or PivotFieldGroupByType.Months)

The following code snippets (auto-collected from DevExpress Examples) contain references to the GroupItems(PivotFieldGroupByType) 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.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotFieldGroupingActions.cs#L43

csharp
// Group field items by quarters and months.
field.GroupItems(PivotFieldGroupByType.Quarters | PivotFieldGroupByType.Months);
#endregion #GroupFieldByDates

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/CodeExamples/PivotFieldGroupingActions.cs#L43

csharp
// Group field items by quarters and months.
field.GroupItems(PivotFieldGroupByType.Quarters | PivotFieldGroupByType.Months);
#endregion #GroupFieldByDates

spreadsheet-document-api-pivot-table-examples/CS/SpreadsheetDocServerPivotAPI/CodeExamples/PivotFieldGroupingActions.cs#L49

csharp
// Group field items by quarters and months.
field.GroupItems(PivotFieldGroupByType.Quarters | PivotFieldGroupByType.Months);
#endregion #GroupFieldByDates

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotFieldGroupingActions.vb#L39

vb
' Group field items by quarters and months.
            field.GroupItems(PivotFieldGroupByType.Quarters Or PivotFieldGroupByType.Months)
' #End Region ' #GroupFieldByDates

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/CodeExamples/PivotFieldGroupingActions.vb#L39

vb
' Group field items by quarters and months.
            field.GroupItems(PivotFieldGroupByType.Quarters Or PivotFieldGroupByType.Months)
' #End Region ' #GroupFieldByDates

spreadsheet-document-api-pivot-table-examples/VB/SpreadsheetDocServerPivotAPI/CodeExamples/PivotFieldGroupingActions.vb#L45

vb
' Group field items by quarters and months.
            field.GroupItems(PivotFieldGroupByType.Quarters Or PivotFieldGroupByType.Months)
#End Region ' #GroupFieldByDates

See Also

PivotField Interface

PivotField Members

DevExpress.Spreadsheet Namespace