

'Declaration<DefaultMemberAttribute("Item")> Public Class MergedCellCollection Inherits WorksheetElement
'UsageDim instance As MergedCellCollection
[DefaultMember("Item")] public class MergedCellCollection : WorksheetElement
Note that the style of the merged Cells is determined by the information provided in the StartingElement (Style and text); all other informations will be hidden once the Cells are merged.
using( var workbook = Workbook.Create( "MergedCellCollection.xlsx" ) ) { // Gets the first Worksheet; a Workbook always contains at least 1 Worksheet. var worksheet = workbook.Worksheets[ 0 ]; // Merges Cells A1 to B2. var mergedCells = worksheet.MergedCells.Add( "A1", "B2" ); var cellCount = mergedCells.Count; // Merges the Cells in the D4 to D8 range. var cellRange = worksheet.Cells[ "D4", "D8" ]; cellRange.MergeCells(); // Saves Workbook to disk; workbook.Save(); }
System.Object
Xceed.Workbooks.NET.WorkbookElement
Xceed.Workbooks.NET.WorksheetElement
Xceed.Workbooks.NET.MergedCellCollection
| Name | Description | |
|---|---|---|
![]() | Count | Gets the number of CellRange(s) in the MergedCellCollection. |
![]() | Item | Gets the CellRange corresponding to the given index. |
| Name | Description | |
|---|---|---|
![]() | Add | Overloaded. Adds a CellRange element in the MergedCellCollection. |
![]() | GetEnumerator | |
![]() | Remove | Removes a CellRange from the MergedCellCollection. |
![]() | RemoveAt | Removes a specific element from the MergedCellCollection. |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.