aspose.cells
Class DataSorter

Summary description for DataSorter.

Example:

//Instantiate a new Workbook object.
//Instantiate a new Workbook object
$workbook = new cells\Workbook("Book1.xls");
//Get the workbook datasorter object
$sorter = $workbook->getDataSorter();
//Set the first order for datasorter object
$sorter->setOrder1(cells\SortOrder::DESCENDING);
//Define the first key
$sorter->setKey1(0);
//Set the second order for datasorter object
$sorter->setOrder2(cells\SortOrder::ASCENDING);
//Define the second key
$sorter->setKey2(1);
//Create a cells area (range)
$ca = new cells\CellArea();
//Specify the start row index
$ca->StartRow = 0;
//Specify the start column index
$ca->StartColumn = 0;
//Specify the last row index
$ca->EndRow = 13;
//Specify the last column index
$ca->EndColumn = 1;
//Sort data in the specified data range (A1:B14)
$sorter->sort($workbook->getWorksheets()->get(0)->getCells(), $ca);

Property Getters/Setters Summary
functiongetCaseSensitive()
functionsetCaseSensitive(value)
           Gets and sets whether case sensitive when comparing string.
functionhasHeaders()
functionsetHasHeaders(value)
           Represents whether the range has headers.
functiongetKey1()
functionsetKey1(value)
           Represents first sorted column index(absolute position, column A is 0, B is 1, ...).
functiongetKey2()
functionsetKey2(value)
           Represents second sorted column index(absolute position, column A is 0, B is 1, ...).
functiongetKey3()
functionsetKey3(value)
           Represents third sorted column index(absolute position, column A is 0, B is 1, ...).
functiongetKeys()
           Gets the key list of data sorter.
functiongetOrder1()
functionsetOrder1(value)
           Represents sort order of the first key. The value of the property is SortOrder integer constant.
functiongetOrder2()
functionsetOrder2(value)
           Represents sort order of the second key. The value of the property is SortOrder integer constant.
functiongetOrder3()
functionsetOrder3(value)
           Represents sort order of the third key. The value of the property is SortOrder integer constant.
functiongetSortAsNumber()
functionsetSortAsNumber(value)
           Indicates whether sorting anything that looks like a number.
functiongetSortLeftToRight()
functionsetSortLeftToRight(value)
           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.
 
Method Summary
functionaddKey(key, order)
           Adds sorted column index and sort order.
functionaddKey(key, type, order, customList)
           Adds sorted column index and sort order with custom sort list.
functionaddKey(key, order, customList)
           Adds sorted column index and sort order with custom sort list.
functionaddKey(key, order, customList)
           Adds sorted column index and sort order with custom sort list.
functionclear()
           Clear all settings.
functionsort()
           Sort the data in the range.
functionsort(cells, area)
           Sort the data of the area.
functionsort(cells, startRow, startColumn, endRow, endColumn)
           Sorts the data of the area.
 

Property Getters/Setters Detail

getKeys : DataSorterKeyCollection 

function getKeys()
Gets the key list of data sorter.

hasHeaders/setHasHeaders : boolean 

function hasHeaders() / function setHasHeaders(value)
Represents whether the range has headers.

getKey1/setKey1 : Number 

function getKey1() / function setKey1(value)
Represents first sorted column index(absolute position, column A is 0, B is 1, ...).

getOrder1/setOrder1 : Number 

function getOrder1() / function setOrder1(value)
Represents sort order of the first key. The value of the property is SortOrder integer constant.

getKey2/setKey2 : Number 

function getKey2() / function setKey2(value)
Represents second sorted column index(absolute position, column A is 0, B is 1, ...).

getOrder2/setOrder2 : Number 

function getOrder2() / function setOrder2(value)
Represents sort order of the second key. The value of the property is SortOrder integer constant.

getKey3/setKey3 : Number 

function getKey3() / function setKey3(value)
Represents third sorted column index(absolute position, column A is 0, B is 1, ...).

getOrder3/setOrder3 : Number 

function getOrder3() / function setOrder3(value)
Represents sort order of the third key. The value of the property is SortOrder integer constant.

getSortLeftToRight/setSortLeftToRight : boolean 

function getSortLeftToRight() / function setSortLeftToRight(value)
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.

getCaseSensitive/setCaseSensitive : boolean 

function getCaseSensitive() / function setCaseSensitive(value)
Gets and sets whether case sensitive when comparing string.

getSortAsNumber/setSortAsNumber : boolean 

function getSortAsNumber() / function setSortAsNumber(value)
Indicates whether sorting anything that looks like a number.

Method Detail

clear

function clear()
Clear all settings.

addKey

function addKey(key, order)
Adds sorted column index and sort order.
Parameters:
key: Number - The sorted column index(absolute position, column A is 0, B is 1, ...)
order: Number - A SortOrder value. The sort order

addKey

function addKey(key, order, customList)
Adds sorted column index and sort order with custom sort list.
Parameters:
key: Number - The sorted column index(absolute position, column A is 0, B is 1, ...)
order: Number - A SortOrder value. The sort order.
customList: String - The custom sort list.

addKey

function addKey(key, type, order, customList)
Adds sorted column index and sort order with custom sort list. If type is SortOnType.CellColor or SortOnType.FontColor, the customList is Color.
Parameters:
key: Number - The sorted column index(absolute position, column A is 0, B is 1, ...)
type: Number - A SortOnType value. The sorted value type.
order: Number - A SortOrder value. The sort order.
customList: Object - The custom sort list.

addKey

function addKey(key, order, customList)
Adds sorted column index and sort order with custom sort list.
Parameters:
key: Number - The sorted column index(absolute position, column A is 0, B is 1, ...)
order: Number - A SortOrder value. The sort order.
customList: String[] - The custom sort list.

sort

function sort(cells, startRow, startColumn, endRow, endColumn)
Sorts the data of the area.
Parameters:
cells: Cells - The cells contains the data area.
startRow: Number - The start row of the area.
startColumn: Number - The start column of the area.
endRow: Number - The end row of the area.
endColumn: Number - The end column of the area.

sort

function sort(cells, area)
Sort the data of the area.
Parameters:
cells: Cells - The cells contains the data area.
area: CellArea - The area needed to sort

sort

function sort()
Sort the data in the range.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.