[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.ColumnFields

ColumnFields Property

ColumnFields

Gets the collection of fields that are currently shown as column fields in the PivotTable report.

The returned collection is read-only and contains the fields whose orientation is set to column fields.

Declaration
IPivotFields ColumnFields { get; }
ReadOnly Property ColumnFields As IPivotFields
Examples
worksheet.Range["A1:C5"].Value = new object[,] {
    {"Category", "Region", "Amount"},
    {"Beverages", "East", 120},
    {"Beverages", "West", 80},
    {"Snacks", "East", 95},
    {"Snacks", "West", 110}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.ColumnField;
IPivotFields columnFields = pivotTable.ColumnFields;