Merge Cells

Spread.Services Documentation
Merge Cells
Collapse All Expand All

Spread.Services Documentation > Developer's Guide > Customize User Interaction > Manage Worksheet > Range Operations > Merge Cells

Spread.Services allow you to merge several cells into a single cell using Merge method of IRange. When a cell range is merged, the data of top left cell stays in the final merged cell, and the data of other cells in the given range is lost.

Also if all the cells within the given range are empty, the formatting of range's top left cell is applied to the merged cell.

Refer to the following example code to merge the range of cells.

C# | Copy Code
--- | ---

    // merge the cell range A1:B4 into one single cell
    worksheet.Range["A1:B4"].Merge();

Refer to the following example code to merge only the rows of the specified range of cell into one.

C# | Copy Code
--- | ---

    // merge the cell range C1:D4 by one single cell in one row
    worksheet.Range["C1:D4"].Merge(true);

See Also
Get Range and Range Area
Insert and Delete Rows and Columns
Work with Used Range

Copyright © GrapeCity, inc. All rights reserved.