GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    SortLevel Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents sort settings for a single sort level.

    • C#
    • VB.NET
    public sealed class SortLevel
    Public NotInheritable Class SortLevel
    Inheritance:
    System.Object
    SortLevel

    Properties

    ColumnRowIndex

    Gets or sets the column (or the row, if LeftToRight is true) index relative to the Range that this sort level applies to.

    Value is equal to or greater than zero and less than Width (or Height, if LeftToRight is true) of the Range.

    • C#
    • VB.NET
    public int ColumnRowIndex { get; set; }
    Public Property ColumnRowIndex As Integer
    Property Value
    System.Int32

    The column (or the row, if LeftToRight is true) index relative to the Range that this sort level applies to.

    Exceptions
    System.InvalidOperationException

    Sort level is removed from the sort state.

    System.ArgumentOutOfRangeException

    Value is less than zero or is equal to or greater than Width (or Height, if LeftToRight is true) of the Range.

    System.ArgumentException

    Column/row at the specified index is being sorted by the same criteria more than once. Delete the duplicate sort criteria and try again.

    Comparison

    Gets or sets the comparison method that compares two ExcelCells.

    Default value is default comparison method based on the settings of this sort level.

    • C#
    • VB.NET
    public Comparison<ExcelCell> Comparison { get; set; }
    Public Property Comparison As Comparison(Of ExcelCell)
    Property Value
    System.Comparison<ExcelCell>

    The comparison method that compares two ExcelCells.

    Remarks

    Use this property to override default comparison method based on the settings of this sort level.

    This member is not loaded from and saved to XLSX file since it is not supported by Office Open XML specification. It is used to customize GemBox.Spreadsheet functionality.

    If set to null, reverts to default comparison method based on the settings of this sort level.

    CustomList

    Gets the custom list by which order of items to sort by.

    If Descending is set to true, then sorting will be performed based on the reverse order of items.

    • C#
    • VB.NET
    public IList<string> CustomList { get; }
    Public ReadOnly Property CustomList As IList(Of String)
    Property Value
    System.Collections.Generic.IList<System.String>

    The custom list by which order of items to sort by.

    Descending

    Gets or sets a value indicating whether to sort the values in the descending order.

    Default value is false.

    • C#
    • VB.NET
    public bool Descending { get; set; }
    Public Property Descending As Boolean
    Property Value
    System.Boolean

    true to sort the values in the descending order; otherwise, false.

    Methods

    SetCustomList(IEnumerable<String>)

    Sets the custom list by which order of items to sort by.

    • C#
    • VB.NET
    public void SetCustomList(IEnumerable<string> items)
    Public Sub SetCustomList(items As IEnumerable(Of String))
    Parameters
    items
    System.Collections.Generic.IEnumerable<System.String>

    The custom list by which order of items to sort by.

    SetCustomList(String[])

    Sets the custom list by which order of items to sort by.

    • C#
    • VB.NET
    public void SetCustomList(params string[] items)
    Public Sub SetCustomList(ParamArray items As String())
    Parameters
    items
    System.String[]

    The custom list by which order of items to sort by.

    ToString()

    Returns a System.String that represents this SortLevel instance.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this SortLevel instance.

    Overrides
    System.Object.ToString()
    Remarks

    This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).

    Examples

    Excel Sorting example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.