# Resizing a Table

Discover how to automatically extend table rows or columns while editing cells with the AutoExpandTable property in Spread.NET.

## Content

You can resize the table with the resize indicator in the bottom, right corner of the table or you can use code to do so.
![Resize Table using Resize Indicator](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/tableresize.png)
Select the indicator and drag to the right to add columns or down to add rows.

## Using Code

You can use the [Resize](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.TableView.Resize.html) method to add columns or rows to a table. The below example code adds rows and columns to the table.

```csharp
FarPoint.Win.Spread.TableStyle tstyle = fpSpread1.CreateTableStyle("Style1", FarPoint.Win.Spread.TableStyle.TableStyleLight2);
            
fpSpread1.Sheets[0].Cells[1, 1].Text = "Last Name";
fpSpread1.Sheets[0].Cells[1, 2].Text = "Value";
fpSpread1.Sheets[0].Cells[2, 1].Text = "Smith";
fpSpread1.Sheets[0].Cells[2, 2].Value = 50;
fpSpread1.Sheets[0].Cells[3, 1].Text = "Vil";
fpSpread1.Sheets[0].Cells[3, 2].Value = 10;
fpSpread1.Sheets[0].Cells[4, 1].Text = "Press";
fpSpread1.Sheets[0].Cells[4, 2].Value = 78;
fpSpread1.TableStyleCollection.Add(tstyle);
            
FarPoint.Win.Spread.TableView table = fpSpread1.Sheets[0].AddTable("table", 1, 1, 5, 2, "Style1");

table.Resize(6, 2);
```

```vbnet
Dim tstyle As FarPoint.Win.Spread.TableStyle
tstyle = FpSpread1.CreateTableStyle("Style1", FarPoint.Win.Spread.TableStyle.TableStyleLight2)
FpSpread1.Sheets(0).Cells(1, 1).Text = "Last Name"
FpSpread1.Sheets(0).Cells(1, 2).Text = "Value"
FpSpread1.Sheets(0).Cells(2, 1).Text = "Smith"
FpSpread1.Sheets(0).Cells(2, 2).Value = 50
FpSpread1.Sheets(0).Cells(3, 1).Text = "Vil"
FpSpread1.Sheets(0).Cells(3, 2).Value = 10
FpSpread1.Sheets(0).Cells(4, 1).Text = "Press"
FpSpread1.Sheets(0).Cells(4, 2).Value = 78
FpSpread1.TableStyleCollection.Add(tstyle)

Dim table As FarPoint.Win.Spread.TableView = FpSpread1.Sheets(0).AddTable("table", 1, 1, 5, 2, "Style1")

table.Resize(6, 2)
```

## Automatically Extend Table Rows or Columns

You can expand the rows or columns of a table automatically using the [AutoExpandTable](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.IFeatures.AutoExpandTable.html) property.
A new row or column is added after editing an empty cell located below the row or right of the column.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/table-autoexpand.gif)
The **AutoExpandTable** property will not expand table rows if the table has a [Total row](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/tableformula), that is, consists a formula cell in the last row.

```csharp
fpSpread1.Features.AutoExpandTable = true;
```

```vbnet
FpSpread1.Features.AutoExpandTable = True
```

## See Also

[Tables](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables)
[Adding a Table](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/spwin-tableadd)
[Using Table Filters](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/spwin-tablefilter)
[Sorting a Table](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/spwin-tablesort)
[Setting Table Styles](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/spwin-tablestyle)
[Adding a Table Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/tableformula)
[Understanding Structured References](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-tables/spwin-structref)