Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RowCollection.CollapseGroups(Int32) Method

Collapses all row groups starting from the specified level.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

void CollapseGroups(
    int level
)

#Parameters

Name Type Description
level Int32

A Int32 value that specifies the grouping level starting from which row groups should be collapsed.

#Remarks

If a worksheet has multiple grouping levels, you can use the CollapseGroups method to collapse row groups starting at the specified and subsequent levels. For example, the following code collapses all the groups except the first level:

worksheet.Rows.CollapseGroups(2);

Spreadsheet_CollapseRowGroups

If the level parameter is less than or equal to 1, the CollapseGroups method collapses all the row groups. You can also collapse all row groups in a worksheet using the RowCollection.CollapseAllGroups methods.

If the level parameter is greater than the maximum grouping level specified in a worksheet, the CollapseGroups method expands all the row groups. Another way to expand all row groups in a worksheet at once is to call the RowCollection.ExpandAllGroups method.

Refer to the Data Grouping article to learn more on how to group data in a worksheet and specify group settings.

See Also