Compartir a través de


XmlMappedRange.MergeCells (Propiedad)

Obtiene o establece un valor que indica si el control XmlMappedRange contiene celdas combinadas.

Espacio de nombres:  Microsoft.Office.Tools.Excel
Ensamblado:  Microsoft.Office.Tools.Excel (en Microsoft.Office.Tools.Excel.dll)

Sintaxis

'Declaración
Property MergeCells As Object
    Get
    Set
Object MergeCells { get; set; }

Valor de propiedad

Tipo: System.Object
true si el control XmlMappedRange contiene celdas combinadas; en caso contrario, false.

Ejemplos

El ejemplo de código siguiente muestra el valor de las propiedades MergeArea y MergeCells antes y después de combinar un intervalo que contiene un XmlMappedRange. En este ejemplo de código, se supone que la hoja de cálculo activa contiene un XmlMappedRange denominado CustomerLastNameCell que está en una de las celdas de la B2 a la 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() + "'.");
}

Seguridad de .NET Framework

Vea también

Referencia

XmlMappedRange Interfaz

Microsoft.Office.Tools.Excel (Espacio de nombres)