[]
Gets the collection of fields that are currently shown as row fields in the PivotTable report.
The returned IPivotFields collection is read-only and contains the fields whose orientation is set to row fields.
IPivotFields RowFields { get; }
ReadOnly Property RowFields As IPivotFields
worksheet.Range["A1:C5"].Value = new object[,] {
{"Region", "Product", "Amount"},
{"East", "Apple", 120},
{"East", "Pear", 80},
{"West", "Apple", 95},
{"West", "Pear", 110}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Region"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotFields rowFields = pivotTable.RowFields;
string firstFieldName = rowFields[0].Name;