Skip to main content

IXlSheet.MergedCells Property

Provides access to the collection of merged cells in a worksheet.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v22.2.Core.dll

NuGet Packages: DevExpress.Printing.Core, DevExpress.Win.Dashboard.Design


IXlMergedCells MergedCells { get; }

Property Value

Type Description

An IXlMergedCells object that stores all merged cells in a worksheet.


To merge adjacent cells in a worksheet into a single cell, use the IXlMergedCells.Add method of the IXlMergedCells collection, accessible by using the MergedCells property.


A complete sample project is available at

// Merge cells contained in the range A1:E1.
sheet.MergedCells.Add(XlCellRange.FromLTRB(0, 0, 4, 0));

// Merge cells contained in the range A2:A5.
sheet.MergedCells.Add(XlCellRange.FromLTRB(0, 1, 0, 4));

// Merge cells contained in the range B2:E5.
sheet.MergedCells.Add(XlCellRange.FromLTRB(1, 1, 4, 4));

To split a merged cell, remove it from the IXlMergedCells collection by using the IXlMergedCells.Remove or IXlMergedCells.RemoveAt method.

For more details on how to merge and unmerge cells in a worksheet, refer to the How to: Merge Cells or Split Merged Cells example.

See Also