Udostępnij za pośrednictwem


XmlMappedRange.MergeCells Property (2007 System)

Gets or sets a value that indicates whether the XmlMappedRange control contains merged cells.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property MergeCells As Object
'Usage
Dim instance As XmlMappedRange 
Dim value As Object 

value = instance.MergeCells

instance.MergeCells = value
[BrowsableAttribute(false)]
public Object MergeCells { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ MergeCells {
    Object^ get ();
    void set (Object^ value);
}
public function get MergeCells () : Object 
public function set MergeCells (value : Object)

Property Value

Type: System.Object
true if the XmlMappedRange control contains merged cells; otherwise, false.

Examples

The following code example displays the value of the MergeArea and MergeCells properties before and after merging a range that contains an XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell that is in one of the cells from cell B2 to B5.

Private Sub SetMergeArea()
    Dim range1 As Excel.Range = Me.Range("B2", "B5")

    Dim beforeMergeAddress As String = _
        CustomerLastNameCell.MergeArea.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)

    MsgBox("Before merging, the MergeArea property is '" & _
        beforeMergeAddress & "' and the MergeCells property is " & _
        " '" + CustomerLastNameCell.MergeCells.ToString() & "'.")

    range1.Select()
    range1.Merge(False)

    Dim afterMergeAddress As String = _
        CustomerLastNameCell.MergeArea.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)

    MsgBox("After merging, the MergeArea property is '" & _
        afterMergeAddress & "' and the MergeCells property is " & _
        " '" + CustomerLastNameCell.MergeCells.ToString() & "'.")
End Sub
private void SetMergeArea()
{
    Excel.Range range1 = this.Range["B2", "B5"];

    string beforeMergeAddress = 
        CustomerLastNameCell.MergeArea.get_Address(
        missing, missing, Excel.XlReferenceStyle.xlA1, 
        missing, missing);

    MessageBox.Show("Before merging, the MergeArea property is '" +
        beforeMergeAddress + "' and the MergeCells property is " +
        " '" + CustomerLastNameCell.MergeCells.ToString() + "'.");

    range1.Select();
    range1.Merge(false);

    string afterMergeAddress =
        CustomerLastNameCell.MergeArea.get_Address(
        missing, missing, Excel.XlReferenceStyle.xlA1,
        missing, missing);

    MessageBox.Show("After merging, the MergeArea property is '" +
        afterMergeAddress + "' and the MergeCells property is " +
        " '" + CustomerLastNameCell.MergeCells.ToString() + "'.");
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace