Worksheet::DeleteRows

Description

Delete rows in the worksheet

Syntax

int DeleteRows( const vector<uint> & vRowsToDel, int nC1 = 0, int nC2 = -1, DWORD dwCntrl = 0 )

Parameters

vRowsToDel
[input] the indices of the rows to delete, if sorted ascending should then use WDR_INPUT_SORTED_ASC to indicate
nC1
[input]The first column
nC2
[input]The last column, -1 means the last column in the worksheet
dwCntrl
[input] enum WKSDELROWSCTRL bits

Return

a negative for error, otherwise the number of the deleted rows

Examples

EX1

//Delete rows in the worksheet.
void Worksheet_DeleteRows_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if ( wks )
    {
        //if wks filled with row number, row 2, 4, 6, 8, 10 will be deleted after the following code
        vector<uint> vnRowsToDel = {1, 3, 5, 7, 9};
        wks.DeleteRows(vnRowsToDel);
        return;
    }
}

Remark

Delete the specified rows from the worksheet.

Bits to control how DeleteRows behave:

typedef enum tagWKSDELROWSCTRL

{

WDR_INPUT_SORTED_ASC = 0x0001, // input array has been sorted ascending which will del from end

WDR_NO_SHOW_STATUS = 0x0002, // default will show progress row index on status

WDR_USE_SELECTIONS = 0x0010, // this is the only way to support undo and styles, but much slower

WDR_UNDO = OCD_UNDO, //0x01000000 must use together with WDR_USE_SELECTIONS

} WKSDELROWSCTRL;

See Also

Worksheet::DeleteRow, Worksheet::InsertRow, Worksheet::AppendRows

header to Included

origin.h