NativeExcel2 for .Net Developer's Reference

IRange.MergeCells Property

Gets or sets a value that indicates whether the specified range contains merged cells.

[Visual Basic]
PropertyMergeCellsAsBoolean
[C#]
boolMergeCells{get;set;}
[C++]
__propertyboolget_MergeCells();
__propertyvoidset_MergeCells(bool);
[JScript]
functiongetMergeCells():bool
functionsetMergeCells(bool);

Property Value

true if the specified range contains merged cells; otherwise, false.

Example

This example sets the value of the merged range that contains cell A3.

[C#]
 IRange range;
 range = book.Worksheets[1].Range["A3"];
 if (range.MergeCells) 
     range.MergeArea[1,1].Value = "Merged cells";
[VisualBasic]
 Dim range As IRange
 range = book.Worksheets(1).Range("A3");
 If (range.MergeCells) Then
     range.MergeArea(1,1).Value = "Merged cells"
 End If
[C++]
 IRange* range;
 range = book->Worksheets->Item[1]->Range->Item[S"A3"];
 if (range->MergeCells) 
     range->MergeArea->Item[1,1]->Value = S"Merged cells";

See Also

IRange Interface | NativeExcel Namespace | Merge Method | UnMerge Method | MergeArea Property