[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.AutoSortOrder

AutoSortOrder Property

AutoSortOrder

Gets the automatic sort order of this PivotTable field.

If automatic sorting is configured by AutoSort(SortOrder?, string), this property returns the SortOrder applied to the field.

Declaration
SortOrder? AutoSortOrder { get; }
ReadOnly Property AutoSortOrder As SortOrder?
Examples
worksheet.Range["A1:C5"].Value = new object[,] {
    {"Product", "Region", "Amount"},
    {"Apple", "East", 120},
    {"Orange", "West", 80},
    {"Apple", "West", 150},
    {"Orange", "East", 90}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "PivotTable1");
IPivotField regionField = pivotTable.PivotFields["Region"];
regionField.Orientation = PivotFieldOrientation.RowField;
regionField.AutoSort(SortOrder.Descending);
SortOrder? autoSortOrder = regionField.AutoSortOrder;