EasyXLS

Column width and row height

EasyXLS™ library provides the necessary methods that enable you to easily set row height and column width for Excel spreadsheets. It also allows you to read the row height or column width, if necessary.

The row height and column width can be set for all rows or columns from a worksheet or for a specific row and column.

If the row height and column width are not specified, they are automatically sized with the cell content.

Source code sample

The below example shows how to export an Excel file and set the column width and row height.

C#.NET
VB.NET
C++
Java
PHP
ASP
VB6
VBS
Coldfusion
Python

The screen shot below represents the exported Excel file that has the column widths and one row height specified, Excel file generated by the code sample above.

Exported Excel file with column width and row height

Column width for a specific column

EasyXLS allows you to set the column width for a specific column using ExcelColumn.setWidth method or ExcelTable.setColumnWidth method.

Row height for a specific row

EasyXLS allows you to set the row height for a specific row using ExcelRow.setHeight method or ExcelTable.setRowHeight method.

Column width for all columns

EasyXLS allows you to set the column width for all the columns in the worksheet using ExcelTable.setColumnWidth method.

Row height for all rows

EasyXLS allows you to set the row height for all the rows in the worksheet using ExcelTable.setRowHeight method.

Auto column width

If the column width is not specified, it is automatically sized with the cell content. If the Excel file was previously imported and the column width is set, the column width can be forced to automatic width by setting the column width to -1 value using ExcelTable.setColumnWidth method.

Auto row height

If the row height is not specified, it is automatically sized with the cell content. If the Excel file was previously imported and the row height is set, the row height can be forced to automatic height by setting the row height to -1 value using ExcelTable.setRowHeight method.


Available for: Professional, Excel Writer, Excel Reader
Go to top

EasyXLS Excel libraries:

.NET
.NET Excel Library
full .NET version to import, export or convert Excel files
COM+ Excel Library
full COM+ version to import, export or convert Excel files
-
Java
Java Excel Library
full Java version to import, export or convert Excel files
Download EasyXLS™ Excel Library for .NET and Java

File formats:

MS Excel 97 - 2003
MS Excel 2007 - 2019
MS Excel 2021
Office 365
XLSXXLSMXLSBXLS
XMLHTMLCSVTXT