Compartir a través de


WorksheetBase.ConsolidationOptions (Propiedad)

Obtiene una clase Array de tres elementos de opciones de consolidación.

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

Sintaxis

'Declaración
Public ReadOnly Property ConsolidationOptions As Object
public Object ConsolidationOptions { get; }

Valor de propiedad

Tipo: System.Object
Clase Array de tres elementos de opciones de consolidación.

Comentarios

Si un elemento de la matriz devuelta es true, se establece la opción correspondiente.Los tres elementos de la matriz son:

Elemento

Significado

1

Utilizar etiquetas en fila superior

2

Utilizar etiquetas en columna izquierda

3

Crear vínculos a los datos de origen

Ejemplos

El ejemplo de código siguiente utiliza la propiedad ConsolidationOptions para mostrar los valores de las opciones de consolidación de la hoja de cálculo actual.

Se trata de un ejemplo para una personalización en el nivel del documento.

Private Sub ShowConsolidationOptions()
    If Not (Me.ConsolidationOptions Is Nothing) Then
        Dim options As Array = CType(Me.ConsolidationOptions, Array)

        Me.Range("A1").Value2 = "Use labels in top row"
        Me.Range("A2").Value2 = "Use labels in left column"
        Me.Range("A3").Value2 = "Create links to source data"

        Dim i As Integer
        For i = 1 To 3
            If CBool(options.GetValue(i)) Then
                Me.Range("B" + i.ToString()).Value2 = "True"
            Else
                Me.Range("B" + i.ToString()).Value2 = "False"
            End If

            Me.Columns.AutoFit()
        Next i
    End If
End Sub
private void ShowConsolidationOptions()
{
    if (this.ConsolidationOptions != null)
    {
        Array options = (Array)this.ConsolidationOptions;

        this.Range["A1"].Value2 = "Use labels in top row";
        this.Range["A2"].Value2 = "Use labels in left column";
        this.Range["A3"].Value2 = "Create links to source data";

        for (int i = 1; i <= 3; i++)
        {
            if ((bool)options.GetValue(i))
            {
                this.Range["B" + i.ToString()].Value2 = "True";
            }
            else
            {
                this.Range["B" + i.ToString()].Value2 = "False";
            }
            this.Columns.AutoFit();
        }
    }
}

Seguridad de .NET Framework

Vea también

Referencia

WorksheetBase Clase

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