Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

PivotField.UngroupItems(IEnumerable<Int32>) Method

Removes the specified items from grouping.

Namespace: DevExpress.Spreadsheet

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

Declaration

void UngroupItems(
    IEnumerable<int> itemIndices
)

Parameters

Name Type Description
itemIndices IEnumerable<Int32>

A list of item indices to remove from grouping.

Example

The following code creates two groupings with different items and subsequently ungroups the first group of items.

Dim worksheet As Worksheet = workbook.Worksheets("Report11")
workbook.Worksheets.ActiveWorksheet = worksheet

' Access the pivot table by its name in the collection
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Access the "State" field by its name in the collection.
Dim field As PivotField = pivotTable.Fields("State")
' Add the "State" field to the column axis area.
pivotTable.ColumnFields.Add(field)

' Group the first three items in the field.
Dim items As IEnumerable(Of Integer) = New List(Of Integer)() From {0, 1, 2}
field.GroupItems(items)
' Access the created grouped field by its index in the field collection.
Dim groupedFieldIndex As Integer = pivotTable.Fields.Count - 1
Dim groupedField As PivotField = pivotTable.Fields(groupedFieldIndex)
' Set the grouped item caption to "West".
groupedField.Items(0).Caption = "West"

' Group the remaining field items.
items = New List(Of Integer)() From {3, 4, 5}
field.GroupItems(items)
' Set the grouped item caption to "Midwest"
groupedField.Items(1).Caption = "Midwest"

' Ungroup the "West" item.
items = New List(Of Integer) From {0}
groupedField.UngroupItems(items)
See Also