Chart.PivotLayout Property

Definition

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

public:
 property Microsoft::Office::Interop::Excel::PivotLayout ^ PivotLayout { Microsoft::Office::Interop::Excel::PivotLayout ^ get(); };
public Microsoft.Office.Interop.Excel.PivotLayout PivotLayout { get; }
member this.PivotLayout : Microsoft.Office.Interop.Excel.PivotLayout
Public ReadOnly Property PivotLayout As PivotLayout

Property Value

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

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 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";
    }
}
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

Remarks

If the Chart control you specify is not a PivotChart report, the value of this property is null.

Applies to