Spread.Services Documentation
Remove a Group
Spread.Services Documentation > Developer's Guide > Customize User Interaction > Apply Grouping > Remove a Group

You can remove a group by implementing the following tasks in your worksheet.

Ungroup rows and columns

The grouped rows or columns can be ungrouped if you no longer want the information to be organized in clusters. You can increment or decrement the outline level for the specified rows or columns using the Group method and Ungroup method of the IRange interface respectively.

Refer to the following example code to ungroup row and column in a worksheet.

C#
Copy Code
// Row Ungrouping
//1:5 rows' outline level will be 1.
worksheet.Range["1:5"].Ungroup();
            
// Column Ungrouping
//A:I columns outline level will be 2.
worksheet.Range["A:I"].Group();
//A:D columns outline level will be 1.
worksheet.Range["A:D"].Ungroup();

Clear outline

You can clear the outline level of the specified rows or columns using the ClearOutline method of the IRange interface.

Refer to the following example code to clear outline in a worksheet.

C#
Copy Code
//1:20 rows' outline level will be 2.
worksheet.Range["1:20"].Group();
//1:10 rows' outline level will be 3.
worksheet.Range["1:10"].Group();
            
//ClearOutline
//12:20 rows' outline level will be 1.
worksheet.Range["12:20"].ClearOutline();

Collapse a group

You can collapse a group by setting the ShowDetail property of the IRange interface to boolean false.

Refer to the following example code to collapse a group in a worksheet.

C#
Copy Code
//1:20 rows' outline level will be 2.
worksheet.Range["1:20"].Group();
//1:10 rows' outline level will be 3.
worksheet.Range["1:10"].Group();
//collapse
//1:10 rows will be collapsed.
worksheet.Range["11:11"].ShowDetail = false;