# Remove a Group

Learn how to remove a group using DsExcel by ungrouping the rows and columns, clearing the outline level, and collapsing a group.

## Content

You can remove a group in DsExcel Java by referring to the following tasks in your worksheet.

* [Ungroup rows and columns](/document-solutions/java-excel-api/docs/online/Features/ApplyGrouping/RemoveAGroup#ungroup-rows-and-columns)
* [Clear Outline](/document-solutions/java-excel-api/docs/online/Features/ApplyGrouping/RemoveAGroup#clear-outline)
* [Collapse a Group](/document-solutions/java-excel-api/docs/online/Features/ApplyGrouping/RemoveAGroup#collapse-a-group)

## Ungroup rows and columns

You can ungroup the grouped rows or columns if you no longer want the information to be organized. Also, you can increment or decrement the outline level for the specified rows or columns using the [group](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#group) method and [ungroup](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#ungroup) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface respectively.
In order to ungroup row and column in a worksheet, refer to the following example code.

```Java
// Row ungrouping
// 1:20 rows' outline level will be 2.
worksheet.getRange("1:20").group();
// 1:10 rows' outline level will be 3.
worksheet.getRange("1:10").group(); 
// 1:5 rows' outline level will be 2.
worksheet.getRange("1:5").ungroup();
// 1:5 rows' outline level will be 1.
worksheet.getRange("1:5").ungroup();
        
// Column ungrouping
// A:I columns grouping.
worksheet.getRange("A:I").group();
// A:I columns ungrouping 
worksheet.getRange("A:I").ungroup();
```

## Clear outline

You can clear the outline level of the specified rows or columns using the [clearOutline](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#clearOutline) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface.
In order to clear outline in a worksheet, refer to the following example code.

```Java
// 1:20 rows' outline level will be 2.
worksheet.getRange("1:20").group();
// 1:10 rows' outline level will be 3.
worksheet.getRange("1:10").group();
        
// Clear outline
// 12:20 rows' outline level will be 1.
worksheet.getRange("12:20").clearOutline();
```

## Collapse a group

You can collapse a group by using the [setShowDetail](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setShowDetail) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface and setting it to boolean false.
In order to collapse a group in a worksheet, refer to the following example code.

```Java
// 1:20 rows' outline level will be 2.
worksheet.getRange("1:20").group();
// 1:10 rows' outline level will be 3.
worksheet.getRange("1:10").group();
        
// Collapse the group
// 1:10 rows will be collapsed.
worksheet.getRange("11:11").setShowDetail(false);
```