2.2.4.12.18 Datasheet::MoveColumns

Description

Move columns in a worksheet or matrixsheet.

Syntax

BOOL MoveColumns( int nStartLocation, int nNumCols, int nOperation, BOOL bUndo = FALSE, int nIndex = -1 )

Parameters

nStartLocation
[input] the first column with zero offset
nNumCols
[input] the number of columns
nOperation
[input] MOVE_COL_TO_FIRST, MOVE_COL_TO_LAST, MOVE_COL_TO_RIGHT, MOVE_COL_TO_LEFT, MOVE_COL_TO_INDEX
bUndo
[input] Whether to support undo(TRUE) or not (FALSE). default is FALSE
nIndex
[input] Move columns before this specific index, only works with MOVE_COL_TO_INDEX

Return

TRUE if success, otherwise FALSE

Examples

EX1

// Move three columns - starting with column 5 - to the first column
// Example requires first worksheet in project with at least 7 columns
int Datasheet_MoveColumns_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return -1;
    
    Worksheet wks(wp.GetName());
    if(wks)
        if( wks.MoveColumns(4, 3, MOVE_COL_TO_FIRST) )
            printf("Successfully move to destination column!");
        else
            printf("Fail to move to specified column!");
    return 0;
}

Remark

See Also

Datasheet::SwapColumns

Header to Include

origin.h