# Setting the Row Height or Column Width

Learn how to set row height or column width as a specified number of pixels, override default settings, and use the Axis model for changing width and height.

## Content

You can set the row height or column width as a specified number of pixels. Each sheet uses and lets you set a default size, making all rows or columns in the sheet the same size. You can override that setting by setting the value for individual rows or columns.
![Example of Row Higher and Column Wider](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/rowcol-bigger.png)
Users can change the row height or column width by dragging the header lines between rows or columns.
For more details refer to the Column.[Width](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.Width.html) method or Row.[Height](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Row.Height.html) method. For more information, kindly refer to "[Allowing the User to Resize Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolsize/spwin-rowcol-userresize)".

## Method to set

Get a collection of rows and columns in the [Rows](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.Rows.html) and [Columns](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.Columns.html) property of the [SheetView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.html) class, and specify the target row and column by index. The row height is set by the [Height](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Row.Height.html) property of the [Row](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Row.html) class, and the column width is set by the [Width](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.Width.html) property of the [Column](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.html) class.

## **Example**

This example code sets the second column’s width to 100 pixels.

```csharp
// Set second column width to 100.
fpSpread1.Sheets[0].Columns[1].Width = 100;
```

```vbnet
' Set second column width to 100.
fpSpread1.Sheets(0).Columns(1).Width = 100
```

> !type=note
> **Note**: When the Column.[Width](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.Width.html) or Row.[Height](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Row.Height.html) methods are set to zero, the row height and column width are set to zero and they appear as hidden.

You can also set the row height and column width to zero to hide the rows and columns by using [RowHeight](/spreadnet/api/latest/online-win/GrapeCity.Spreadsheet/GrapeCity.Spreadsheet.IRange.RowHeight.html) and [ColumnWidth](/spreadnet/api/latest/online-win/GrapeCity.Spreadsheet/GrapeCity.Spreadsheet.IRange.ColumnWidth.html) properties. However, in this case, the originally set row height or column width is retained when they are re-displayed. The below example code explains this scenario. You can also use the Axis model to change the width and height which is restored on being re-displayed.

```csharp
GrapeCity.Spreadsheet.IWorksheet sheet1 = fpSpread1.AsWorkbook().ActiveSheet;
sheet1.Rows[5].RowHeight = 50;  // Initial row height is set to 50
sheet1.Rows[5].RowHeight = 0;   // The row is now hidden, the row height is still 50 internally
sheet1.Rows[5].Hidden = false;  // The row is visible and the row height is 50
sheet1.Rows[5].Hidden = true;   // The row height is still 50 internally
fpSpread1.ActiveSheet.Models.RowAxis.SetSize(5, 100); // Use AxisModel to change row height
sheet1.Rows[5].Hidden = false;  // The row height is 100
```

```vbnet
GrapeCity.Spreadsheet.IWorksheet sheet1 = fpSpread1.AsWorkbook().ActiveSheet
sheet1.Rows(5).RowHeight = 50  'Initial row height is set to 50
sheet1.Rows(5).RowHeight = 0   'The row is now hidden, the row height is still 50 internally
sheet1.Rows(5).Hidden = false  'The row is visible and the row height is 50
sheet1.Rows(5).Hidden = true   'The row height is still 50 internally
fpSpread1.ActiveSheet.Models.RowAxis.SetSize(5, 100) 'Use AxisModel to change row height
sheet1.Rows(5).Hidden = false  'The row height is 100
```

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. Select the **Sheets** property.
3. Click the button to display the **SheetView Collection Editor**.
4. In the **Members** list, select the sheet for which to set the column width for a column.
5. In the properties list, set the **Columns** property (or **Row** property) and then click the button to display the **Cell, Column, and Row Editor**.
6. Click the column heading of the column for which you want to set the width (or row for the height).
7. In the properties list, set the **Width** property (**Height** property for the row).
8. Click **OK** to close the **Cell, Column, and Row Editor**.
9. Click **OK** to close the **SheetView Collection Editor**.

## Using the Spread Designer

1. To set the default column width,
    1. Select the sheet tab for the sheet for which you want to set the default column width.
    2. In the property list, in the **Appearance** category, select **Columns** to expand the list of properties for the columns.
    3. In the list of properties for columns, select **Default** to expand the list of default column settings.
    4. In the list of default settings, change the **Width** setting.
    5. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.
2. To set a specific column width,
    1. Select the column for which you want to change the width.
    2. In the properties list for that column, change the **Width** property.
    3. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

## See Also

[Rows and Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol)
[Customizing the Number of Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnumber)
[Adding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcoladd)
[Removing a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolremove)
[Showing or Hiding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolhide)
[Setting Fixed (Frozen) Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-freeze)
[Moving Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-usermove)
[Creating Alternating Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolalt)
[Setting up Preview Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-previewrow)
[Input Data in Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-userentry)
[Rows or Columns That Have Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnonempty)
[Adding a Tag to a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-tags-rowcol)