2.2.4.46.61 Worksheet::Reorder

Description

Reorder the rows of worksheet with specified orders

Syntax

BOOL Reorder( const vector<uint> & vnOrder, int nC1 = 0, int nC2 = -1, BOOL bUndo = FALSE )

Parameters

vnOrder
[input] the orders of the rows to reorder
nC1
[input]The first column
nC2
[input]The last column, -1 means the last column in the worksheet
bUndo
[input] undo or not

Return

true if success, otherwise false

Examples

EX1

//Reorder the rows of worksheet with specified orders.
void Worksheet_Reorder_ex1()
{
    //fill columns with row number and run this code to see the result
    Worksheet wks = Project.ActiveLayer();
    if ( wks )
    {
        //this code apply to each column, reorder the first 6 items, and fill the rest with the first item
        int nC1 = 0, nC2 = -1; //all columns
        vector<uint> vnOrder = {1, 3, 5, 2, 4, 0};
        vnOrder.SetSize(32); //resize, default the other items except the first 6 are filled with 0.
        BOOL bRet = wks.Reorder(vnOrder, nC1, nC2);
        if ( bRet )
            out_str("Reorder successfully executed!");
    }
}

Remark

See Also

Header to Included

origin.h