PivotLayout Property
TOC
Collapse the table of content
Expand the table of content

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)

PivotLayout PivotLayout { get; }

Property Value

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

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

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

Show:
© 2016 Microsoft