[]
Gets or sets the position of the field among the fields in its current orientation.
The position determines the order of the field within its orientation area, such as row fields, column fields, page fields, or data fields.
int Position { get; set; }
Property Position As Integer
worksheet.Range["A1:C4"].Value = new object[,] {
{"Category", "Product", "Amount"},
{"Fruit", "Apple", 100},
{"Fruit", "Orange", 80},
{"Snacks", "Cookie", 60}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
IPivotField field = pivotTable.PivotFields["Category"];
field.Orientation = PivotFieldOrientation.RowField;
field.Position = 0;
int position = field.Position;