Aspose::Cells::DataSorter class
Contents
[
Hide
]DataSorter class
Summary description for DataSorter.
class DataSorter
Methods
Method | Description |
---|---|
AddColorKey(int32_t key, SortOnType type, SortOrder order, const Aspose::Cells::Color& color) | Adds color sort key. |
AddKey(int32_t key, SortOrder order) | Adds sorted column index and sort order. |
AddKey(int32_t key, SortOrder order, const U16String& customList) | Adds sorted column index and sort order with custom sort list. |
AddKey(int32_t key, SortOrder order, const char16_t* customList) | Adds sorted column index and sort order with custom sort list. |
AddKey(int32_t key, SortOnType type, SortOrder order, const Aspose::Cells::Object& customList) | Adds sorted column index and sort order with custom sort list. |
AddKey(int32_t key, SortOrder order, const Vector <U16String>& customList) | Adds sorted column index and sort order with custom sort list. |
Clear() | Clear all settings. |
DataSorter(DataSorter_Impl* impl) | Constructs from an implementation object. |
DataSorter(const DataSorter& src) | Copy constructor. |
GetCaseSensitive() | Gets and sets whether case sensitive when comparing string. |
GetHasHeaders() | Represents whether the range has headers. |
GetKey1() | Represents first sorted column index(absolute position, column A is 0, B is 1, …). |
GetKey2() | Represents second sorted column index(absolute position, column A is 0, B is 1, …). |
GetKey3() | Represents third sorted column index(absolute position, column A is 0, B is 1, …). |
GetKeys() | Gets the key list of data sorter. |
GetOrder1() | Represents sort order of the first key. |
GetOrder2() | Represents sort order of the second key. |
GetOrder3() | Represents sort order of the third key. |
GetSortAsNumber() | Indicates whether sorting anything that looks like a number. |
GetSortLeftToRight() | 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. |
IsNull() const | Checks whether the implementation object is nullptr. |
explicit operator bool() const | operator bool() |
operator=(const DataSorter& src) | operator= |
SetCaseSensitive(bool value) | Gets and sets whether case sensitive when comparing string. |
SetHasHeaders(bool value) | Represents whether the range has headers. |
SetKey1(int32_t value) | Represents first sorted column index(absolute position, column A is 0, B is 1, …). |
SetKey2(int32_t value) | Represents second sorted column index(absolute position, column A is 0, B is 1, …). |
SetKey3(int32_t value) | Represents third sorted column index(absolute position, column A is 0, B is 1, …). |
SetOrder1(SortOrder value) | Represents sort order of the first key. |
SetOrder2(SortOrder value) | Represents sort order of the second key. |
SetOrder3(SortOrder value) | Represents sort order of the third key. |
SetSortAsNumber(bool value) | Indicates whether sorting anything that looks like a number. |
SetSortLeftToRight(bool 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. |
Sort(const Cells& cells, int32_t startRow, int32_t startColumn, int32_t endRow, int32_t endColumn) | Sorts the data of the area. |
Sort(const Cells& cells, const CellArea& area) | Sort the data of the area. |
Sort() | Sort the data in the range. |
~DataSorter() | Destructor. |
Fields
Field | Description |
---|---|
_impl | The implementation object. |
Examples
Aspose::Cells::Startup();
//Instantiate a new Workbook object.
Workbook workbook(u"Book1.xls");
//Get the workbook datasorter object.
DataSorter sorter = workbook.GetDataSorter();
//Set the first order for datasorter object.
sorter.SetOrder1(SortOrder::Descending);
//Define the first key.
sorter.SetKey1(0);
//Set the second order for datasorter object.
sorter.SetOrder2(SortOrder::Ascending);
//Define the second key.
sorter.SetKey2(1);
//Create a cells area (range).
CellArea ca;
//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);
//Save the excel file.
workbook.Save(u"outBook.xls");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells
- Library Aspose.Cells for C++