Skip to main content
Row

ColumnCollection.Group(Int32, Int32, Boolean) Method

Groups the specified columns on a worksheet.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

void Group(
    int first,
    int last,
    bool collapse
)

Parameters

Name Type Description
first Int32

A zero-based integer representing the index of the first column to be grouped.

last Int32

A zero-based integer representing the index of the last column to be grouped.

collapse Boolean

true, if the created group is collapsed; otherwise, false.

Example

To group columns in a worksheet, call the ColumnCollection.Group method of the ColumnCollection object. This object represents a collection of all columns contained in a worksheet and is accessed using the Worksheet.Columns property. Pass the indexes of the first and last columns to be grouped, and a value indicating whether the new group should be expanded or collapsed.

Note that you can also place one group of columns inside another. But the number of nested groups is limited: you can create a maximum of seven levels of grouping.

View Example

// Group four columns starting from the third column "C" and expand the group.
worksheet.Columns.Group(2, 5, false);

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

See Also