Partilhar via


Chart.PivotLayout Property

Gets a PivotLayout object that represents the placement of fields in a PivotTable report and the placement of axes in a PivotChart report.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
ReadOnly Property PivotLayout As PivotLayout
PivotLayout PivotLayout { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.PivotLayout
A PivotLayout object that represents the placement of fields in a PivotTable report and the placement of axes in a PivotChart report.

Remarks

If the Chart control you specify is not a PivotChart report, the value of this property is nulla null reference (Nothing in Visual Basic).

Examples

The following code example sets the current page for an existing PivotChart to the page named "Canada." This example assumes that the current worksheet contains a Chart named pivotChart1 that is a PivotChart report.

Private Sub ChangePivotFieldPage()
    If pivotChart1.PivotLayout Is Nothing Then
        MsgBox("The specified chart is not a pivot chart.")
    Else 
        Dim countryField As Excel.PivotField = _
            CType(pivotChart1.PivotLayout.PivotTable.PivotFields("Country"), _
             Excel.PivotField)
        countryField.CurrentPage = "Canada" 
    End If 
End Sub
private void ChangePivotFieldPage()
{
    if (pivotChart1.PivotLayout == null)
    {
        MessageBox.Show("The specified chart is not a pivot chart.");
    }
    else
    {
        Excel.PivotField countryField =
            (Excel.PivotField)pivotChart1.PivotLayout.
            PivotTable.PivotFields("Country");
        countryField.CurrentPage = "Canada";
    }
}

.NET Framework Security

See Also

Reference

Chart Interface

Microsoft.Office.Tools.Excel Namespace