DataSorter

DataSorter class

Summary description for DataSorter.

Properties

NameTypeDescription
KeysDataSorterKeyCollectionGets the key list of data sorter.
HasHeadersbooleanRepresents whether the range has headers.
Key1intRepresents first sorted column index(absolute position, column A is 0, B is 1, …).
Order1intRepresents sort order of the first key. The value of the property is SortOrder integer constant.
Key2intRepresents second sorted column index(absolute position, column A is 0, B is 1, …).
Order2intRepresents sort order of the second key. The value of the property is SortOrder integer constant.
Key3intRepresents third sorted column index(absolute position, column A is 0, B is 1, …).
Order3intRepresents sort order of the third key. The value of the property is SortOrder integer constant.
SortLeftToRightbooleanTrue means that sorting orientation is from left to right. False means that sorting orientation is from top to bottom. T
CaseSensitivebooleanGets and sets whether case sensitive when comparing string.
SortAsNumberbooleanIndicates whether sorting anything that looks like a number.

Methods

NameDescription
clearClear all settings.
addKeyAdds sorted column index and sort order.
addColorKey
sortSorts the data of the area.

DataSorter.Keys property

Gets the key list of data sorter.

Type: DataSorterKeyCollection

DataSorter.HasHeaders property

Represents whether the range has headers.

Type: boolean

DataSorter.Key1 property

Represents first sorted column index(absolute position, column A is 0, B is 1, …).

Type: int

DataSorter.Order1 property

Represents sort order of the first key. The value of the property is SortOrder integer constant.

Type: int

DataSorter.Key2 property

Represents second sorted column index(absolute position, column A is 0, B is 1, …).

Type: int

DataSorter.Order2 property

Represents sort order of the second key. The value of the property is SortOrder integer constant.

Type: int

DataSorter.Key3 property

Represents third sorted column index(absolute position, column A is 0, B is 1, …).

Type: int

DataSorter.Order3 property

Represents sort order of the third key. The value of the property is SortOrder integer constant.

Type: int

DataSorter.SortLeftToRight property

True means that sorting orientation is from left to right. False means that sorting orientation is from top to bottom. The default value is false.

Type: boolean

DataSorter.CaseSensitive property

Gets and sets whether case sensitive when comparing string.

Type: boolean

DataSorter.SortAsNumber property

Indicates whether sorting anything that looks like a number.

Type: boolean

clear()

Clear all settings.

addKey(key, order) (1 of 4)

Adds sorted column index and sort order.

ParameterTypeDescription
keyintThe sorted column index(absolute position, column A is 0, B is 1, …)
orderintA SortOrder value. The sort order

addKey(key, order, customList) (2 of 4)

Adds sorted column index and sort order with custom sort list.

ParameterTypeDescription
keyintThe sorted column index(absolute position, column A is 0, B is 1, …)
orderintA SortOrder value. The sort order.
customListStringThe custom sort list.

addKey(key, type, order, customList) (3 of 4)

Adds sorted column index and sort order with custom sort list.

If type is SortOnType.CellColor or SortOnType.FontColor, the customList is Color.

ParameterTypeDescription
keyintThe sorted column index(absolute position, column A is 0, B is 1, …)
typeintA SortOnType value. The sorted value type.
orderintA SortOrder value. The sort order.
customListObjectThe custom sort list.

addKey(key, order, customList) (4 of 4)

Adds sorted column index and sort order with custom sort list.

ParameterTypeDescription
keyintThe sorted column index(absolute position, column A is 0, B is 1, …)
orderintA SortOrder value. The sort order.
customListString[]The custom sort list.

addColorKey(key, type, order, color)

sort(cells, startRow, startColumn, endRow, endColumn) (1 of 3)

Sorts the data of the area.

ParameterTypeDescription
cellsCellsThe cells contains the data area.
startRowintThe start row of the area.
startColumnintThe start column of the area.
endRowintThe end row of the area.
endColumnintThe end column of the area.

Returns: the original indices(absolute position, for example, column A is 0, B is 1, …) of the sorted rows/columns. If no rows/columns needs to be moved by this sorting operation, null will be returned.


sort(cells, area) (2 of 3)

Sort the data of the area.

ParameterTypeDescription
cellsCellsThe cells contains the data area.
areaCellAreaThe area needed to sort

Returns: the original indices(absolute position, for example, column A is 0, B is 1, …) of the sorted rows/columns. If no rows/columns needs to be moved by this sorting operation, null will be returned.


sort() (3 of 3)

Sort the data in the range.

Returns: the original indices(absolute position, for example, column A is 0, B is 1, …) of the sorted rows/columns. If no rows/columns needs to be moved by this sorting operation, null will be returned.