Właściwość XmlMappedRange.MergeArea —

Pobiera Range reprezentująca zakresu scalonego zawierającego XmlMappedRange kontroli.

Przestrzeń nazw:  Microsoft.Office.Tools.Excel
Zestaw:  Microsoft.Office.Tools.Excel (w Microsoft.Office.Tools.Excel.dll)

Składnia

'Deklaracja
ReadOnly Property MergeArea As Range
Range MergeArea { get; }

Wartość właściwości

Typ: Microsoft.Office.Interop.Excel.Range
A Range reprezentująca zakresu scalonego zawierającego XmlMappedRange kontroli.Jeśli XmlMappedRange formant nie jest w zasięgu scalone, właściwość ta zwraca XmlMappedRange kontroli.

Uwagi

MergeArea Właściwość działa tylko na jednej komórki zakresu.

Przykłady

Poniższy kod wyświetla wartość MergeArea i MergeCells właściwości przed i po scaleniu zakres, który zawiera XmlMappedRange.W tym przykładzie kodu zakłada, że bieżący arkusz zawiera XmlMappedRange o nazwie CustomerLastNameCell czyli w jednym z komórki z komórki B2 do 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(
        Excel.XlReferenceStyle.xlA1);

    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(
       Excel.XlReferenceStyle.xlA1);

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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

XmlMappedRange Interfejs

Przestrzeń nazw Microsoft.Office.Tools.Excel