Udostępnij za pośrednictwem


Worksheet.ConsolidationOptions Property (2007 System)

Gets a three-element Array of consolidation options.

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 ReadOnly Property ConsolidationOptions As Object
'Usage
Dim instance As Worksheet 
Dim value As Object 

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

Property Value

Type: System.Object
A three-element Array of consolidation options.

Remarks

If an element in the returned array is true, then the corresponding option is set. The three elements in the array are:

Element

Meaning

1

Use labels in top row

2

Use labels in left column

3

Create links to source data

Examples

The following code example uses the ConsolidationOptions property to display the values of the consolidation options for the current worksheet.

This example is for a document-level customization.

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", missing].Value2 = "Use labels in top row";
        this.Range["A2", missing].Value2 = "Use labels in left column";
        this.Range["A3", missing].Value2 = "Create links to source data";

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

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace