[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.ColumnRange

ColumnRange Property

ColumnRange

Gets the range that contains the column area in the PivotTable report.

The returned range covers the cells used for column fields in the current PivotTable layout.

Declaration
IRange ColumnRange { get; }
ReadOnly Property ColumnRange As IRange
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;
pivotTable.AddDataField(pivotTable.PivotFields["Amount"], "Sum of Amount", ConsolidationFunction.Sum);
IRange range = pivotTable.ColumnRange;
string address = range.Address;