Spread 8.0 Documentation
Sort Method
Support Options
ActiveX Reference > ActiveX Methods > Sort Method

Glossary Item Box

Sort Method


See Also    DLL    Example 1    Example 2

Applies To

fpSpread control

Description

Sorts the specified data.

Syntax

C++

BOOL CSpreadSheet::Sort(long lCol, long lRow, long lCol2, long lRow2, long nSortBy, VARIANT* SortKeys, VARIANT* SortKeyOrders);

Visual Basic

fpSpread1.Sort(ByVal lCol As Long, ByVal lRow As Long, ByVal lCol2 As Long, ByVal lRow2 As Long, ByVal nSortBy As SortByConstants, SortKeys As Variant, SortKeyOrders As Variant) As Boolean

Parameters

The following parameters are available:

Parameter Description
lCol Column at which to begin sorting
lRow Row at which to begin sorting
lCol2 Column at which to end sorting
lRow2 Row at which to end sorting
nSortBy Specifies to sort one of the following:
Value Constant Description
0 SortByRow Rows (sorts rows)
1 SortByCol Columns (sorts columns)
SortKeys (Optional) Specifies columns or rows by which to sort
If you are sorting by more than one column or row, provide an array indicating the columns or rows on which to sort, in the order in which you want them sorted
SortKeyOrders (Optional) Specifies whether to sort in ascending or descending order

Remarks

You can sort by up to 256 sort keys.

This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.

You can use the SortKey and SortKeyOrder properties instead of the SortKeys and SortKeyOrders parameter arrays. If you use the SortKey and SortKeyOrder properties, do not set the optional SortKeys and SortKeyOrders parameters.

Notes:
  • You cannot sort a sheet that is using virtual mode or that has spanned cells.
  • Button, check box, combo box, and picture cells are sorted by the value of the Text property.
  • If you sort by the column header and perform a sort by row, the row item data will move. If you sort by the row header and perform a sort by column, the column item data will move. Perform a sort on the column or row header by using the Sort method and setting the Col (or Row) parameter to 0 and the Col2 (or Row2) parameter to –1.
  • The sheet does not update cell references in formulas when you sort blocks of cells.

Return Type

True if successful; otherwise, False.

See Also

Sorting Data

Sheet, SortKey, SortKeyOrder properties

DLL Correspondence

SSSort function

Copyright © GrapeCity, inc. All rights reserved.