EasyXLS

Merge cells, shrink to fit and wrap text

EasyXLS™ library allows you to read merge areas or to merge cells in Excel spreadsheet. Also, you can apply other formatting options like wrap text in cells or to shrink the text to fit the cell.

For better performances, the best option is to apply the wrap and shrink to fit properties to the style of the cell, row, or column by using ExcelStyle class. But the formatting can also be applied directly to the cell, row, or column.

 Table of contents

Merge cells

Merging cells means combing two or more cells in one single cell. The text inside the first cell is spread over all the merged cells. The value from the merge area is kept in the cell from the left-upper corner of the area.
The below example shows how to export an Excel file with merge cells.

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

The screen shot below represents the exported Excel file with merged cells generated by the code sample above. The worksheet has merged cells from A1 to C3.

Exported Excel file with merged cells

Wrap text

EasyXLS allows to wrap the cell text in multiple lines to fit the column width when the cell text is too long to fit on one line. The below source code sample shows how to apply Wrap property to a cell style from the Excel file.

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

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:

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