Syncfusion.XlsIO.Base
Example 


Range to be merged with.

MergeWith Method

Merges the range with specified range and returns merged range.
Syntax
'Declaration
 
Function MergeWith( _
   ByVal range As IRange _
) As IRange
'Usage
 
Dim instance As IRange
Dim range As IRange
Dim value As IRange
 
value = instance.MergeWith(range)
IRange MergeWith( 
   IRange range
)

Parameters

range
Range to be merged with.

Return Value

Returns a merged range; if the Range is unable to merge, null is returned.
Example
The following code illustrates how to check whether two ranges are mergable or not.
using Syncfusion.XlsIO;
using System;
            
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];
            
            //Merge
            worksheet["A2:B2"].Merge();
            
            //Get mergable range
            IRange mergableRange = worksheet["A2"].MergeArea.MergeWith(worksheet["C2"]);
            
            //Check mergable Area
            if (mergableRange != null)
                Console.Write("Mergable!");
            else
                Console.Write("Not Mergable!");
            
            //Save and Dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//Mergable!
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also