Syncfusion.XlsIO.Base
Example 


Merge() Method

Combines the contents of the selected cells in a new larger cell.
Syntax
'Declaration
 
Overloads Sub Merge() 
'Usage
 
Dim instance As IRange
 
instance.Merge()
void Merge()
Remarks
To know more about merging refer Merging and Un-Merging Cells.
Example
The following code illustrates how to merge the Range.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
                                
            //Set text
            worksheet["A1"].Text = "Merged cell";
            
            //Merge cells
            worksheet["A1:B1"].Merge();
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close(); 
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also