[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotLines.Item

this Property

this[int]

Gets the IPivotLine at the specified position in this collection.

Use this property to retrieve a row-axis or column-axis pivot line by its zero-based index from the collection returned by PivotLines.

Declaration
IPivotLine this[int index] { get; }
ReadOnly Default Property Item(index As Integer) As IPivotLine
Parameters
Type Name Description
int index

The zero-based position of the pivot line in this collection.

Examples
worksheet.Range["A1:C5"].Value = new object[,] {
    {"Category", "Product", "Amount"},
    {"Fruit", "Apple", 100},
    {"Fruit", "Orange", 200},
    {"Drink", "Tea", 150},
    {"Drink", "Coffee", 120}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotLine pivotLine = pivotTable.PivotRowAxis.PivotLines[0];