[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotLine.Position

Position Property

Position

Gets the position of this PivotLine in its parent PivotLines collection.

The returned value is the zero-based index of the PivotLine within the row or column axis that contains it.

Declaration
int Position { get; }
ReadOnly Property Position As Integer
Examples
object[,] sourceData = {
    {"Category", "Product", "Amount"},
    {"Fruit", "Apple", 100},
    {"Fruit", "Pear", 80},
    {"Drink", "Tea", 60}
};
worksheet.Range["G1:I4"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["G1:I4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["A1"], "Sales");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotLine pivotLine = pivotTable.PivotRowAxis.PivotLines[0];
int position = pivotLine.Position;