# Allowing the User to Group Rows

Learn how to enable grouping and column movement in a spreadsheet with this comprehensive guide on spreadsheet customization.

## Content

By default, the spreadsheet does not allow the user to group the rows of a spreadsheet. You can turn on this feature and allow grouping of rows for an entire sheet. Besides allowing grouping, you also need to allow columns to move, since the user performs grouping by clicking and dragging a column header into the group bar, which is similar to the act of moving a column. Also, the group bar must be visible and the column headers (at least one row) should be visible.
The following image displays the component with grouping allowed.
![Spread component with grouping enabled](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/allowgroup.png)
Use the [AllowGroup](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AllowGroup.html) property of the sheet to turn on grouping. Use the [Visible](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.GroupBarInfo.Visible.html) property of the [GroupBarInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.GroupBarInfo.html) class to display the group bar (the area at the top of the sheet into which the user can drag column headers. Remember to set the [AllowColumnMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowColumnMove.html) property of the Spread to True to allow the user to click and drag column headers. Unless you are using the default value, set the [ColumnHeaderVisible](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.ColumnHeaderVisible.html) property of the sheet to True to ensure that the column headers are displayed.
You can turn on or off the row headers; these have no effect on the display of grouping.
The [AllowDragDrop](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowDragDrop.html) property is not supported with grouping.
You can set the maximum number of levels of grouping that the end user can set. This limits the number of column headers that can be dragged consecutively to the group bar.
To understand how grouping works for the end user, refer to [Using Grouping](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-using).

## Using Code

1. Set the [AllowColumnMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowColumnMove.html) property to True.
2. Set the [Visible](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.GroupBarInfo.Visible.html) property to True.
3. Set the [AllowGroup](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AllowGroup.html) property to True to allow the user to group the data.

## Example

This example allows grouping.

```csharp
fpSpread1.AllowColumnMove = true;
fpSpread1.ActiveSheet.GroupBarInfo.Visible = true;
fpSpread1.ActiveSheet.AllowGroup = true;
```

```vbnet
FpSpread1.AllowColumnMove = True
FpSpread1.ActiveSheet.GroupBarInfo.Visible = True
FpSpread1.ActiveSheet.AllowGroup = True
```

## See Also

[Using Grouping](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-using)
[Setting the Appearance of Grouped Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-appear)
[Customizing the Group Bar](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-barcustom)
[Creating a Custom Group](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-model)
[Interoperability of Grouping with Other Features](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interact-rowcol/spwin-grouping/spwin-group-interop)