New to Telerik Document ProcessingStart a free 30-day trial

Grouping

Updated on Jul 15, 2026

Grouping organizes data in sections to show and hide relevant chunks. The following sections explain how to work with grouping through the RadSpreadProcessing model:

What Is Grouping?

Grouping is a mechanism to organize data in sections, to show and hide the relevant chunks.

Each row or column which is part of a group is assigned an outline level, which determines the level of grouping and which rows or columns it is grouped with.

Figure 1: Grouped worksheet rows with nested outline levels Telerik Document Processing RadSpreadProcessing worksheet showing grouped rows with nested outline levels and expand-collapse controls

In Figure 1, the rows 1, 2, 4, and 8 have outline level value of 1. Rows 5, 6, and 7 have outline level 2. Rows 3 and 9 do not participate in the grouping and have the default value of 0.

The maximum outline level is 7.

Grouping Rows or Columns

There are two available options when grouping. The first option is to assign the outline level property of the rows or columns:

Example 1: Group columns by setting the outline level

C#
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();

worksheet.Columns[0].SetOutlineLevel(1);
worksheet.Columns[1, 2].SetOutlineLevel(2);
worksheet.Columns[3].SetOutlineLevel(1);

The other option is to use the Group method exposed by the row/column selection classes.

Example 2: Group columns by using the Group method

C#
Workbook workbook = new Workbook();
			Worksheet worksheet = workbook.Worksheets.Add();

			worksheet.Columns[0, 3].Group();
			worksheet.Columns[1, 2].Group();

Figure 2 shows the result of both approaches.

Grouped worksheet columns created through both grouping approaches Telerik Document Processing RadSpreadProcessing worksheet showing grouped columns with outline controls after applying column grouping

Ungrouping Rows or Columns

As with grouping, you can ungroup both through setting the outline level property of the row or column selection, or by using the Ungroup method exposed by the same classes.

The following code snippets show the two approaches to make these changes in a file.

Ungrouping result after removing a nested worksheet group Telerik Document Processing RadSpreadProcessing worksheet before and after ungrouping nested row groups

Example 3: Ungroup columns by using the Ungroup method

C#
worksheet.Rows[0, 1].Ungroup();
worksheet.Rows[4, 6].Ungroup();

You can achieve the same result with the code in Example 4.

Example 4: Ungroup columns by resetting the outline level

C#
worksheet.Rows[0, 1].ClearOutlineLevel();
worksheet.Rows[4, 6].SetOutlineLevel(1);

Getting the Outline Level

You can get the outline level of a row/column or a group of rows/columns using the code in Example 5:

Example 5: Get the current outline level

C#
RangePropertyValue<int> outlineLevelRangeValue = worksheet.Rows[0, 1].GetOutlineLevel();
int outLineLevel = outlineLevelRangeValue.Value;

Setting the Position of the Summary Row or Column

When you group a selection of rows, the row immediately below them is automatically designated to be a summary row for this group. In the context of the grouping feature, this means that the plus/minus outline symbol aligns with this row. The same applies to columns, whose summary column is automatically placed to the right of the group.

Figure 4: Summary rows positioned below grouped worksheet rows Telerik Document Processing RadSpreadProcessing worksheet showing summary rows positioned below grouped row sections

In Figure 4, the summary row for the group of rows 1 to 4 is row 5 and for rows 7 to 10 it is row 11.

If you want to change the placement of the summary row or column, use the GroupingProperties class, which exposes the following two Boolean properties:

  • SummaryRowIsBelow

  • SummaryColumnIsToRight

Both properties have a default value of true. The following snippet shows how to set the value of the SummaryColumnIsToRight property and what result to expect in the produced file.

Example 6: Place the summary column to the left of the group

C#
worksheet.GroupingProperties.SummaryColumnIsToRight = false;

Summary column moved to the left of grouped worksheet columns Telerik Document Processing RadSpreadProcessing worksheet showing the summary column positioned to the left of grouped columns

See Also