Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Obtiene un objeto Range que representa el rango combinado que contiene el control XmlMappedRange.
Espacio de nombres: Microsoft.Office.Tools.Excel
Ensamblado: Microsoft.Office.Tools.Excel (en Microsoft.Office.Tools.Excel.dll)
Sintaxis
'Declaración
ReadOnly Property MergeArea As Range
Range MergeArea { get; }
Valor de propiedad
Tipo: Microsoft.Office.Interop.Excel.Range
Objeto Range que representa el rango combinado que contiene el control XmlMappedRange.Si el control XmlMappedRange no está en un rango combinado, esta propiedad devuelve el control XmlMappedRange.
Comentarios
La propiedad MergeArea sólo funciona si el rango es de una celda.
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(
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() + "'.");
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.