# Set Row Height and Column Width

Customize the height of the rows and the width of the columns in a spreadsheet based on specific preferences using DsExcel.

## Content





You can customize the height of the rows and the width of the columns in a spreadsheet based on specific preferences.

The [setRowHeight](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setRowHeight) method and the [setColumnWidth](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setColumnWidth) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface can be used to set custom row height (in points) and column width (in characters) for the individual rows and columns of a worksheet, respectively.

The [setRowHeightInPixel](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setRowHeightInPixel) method and the [setColumnWidthInPixel](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setColumnWidthInPixel) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface can be used to set the custom row height and column width (in pixels) for the rows and columns of a worksheet, respectively.

In order to set the row height and column width in a worksheet, refer to the following example code.

```Java
// Set row height for row 1:2.
worksheet.getRange("1:2").setRowHeight(50);

// Set column width for column C:D.
worksheet.getRange("C:D").setColumnWidth(20);
```