Datasheet::ClearData

Description

Clear worksheet of data and reduce number of rows (or optionally NOT reduce)

Syntax

BOOL ClearData( DWORD dwOptions = CWOD_SHRINK_COLS, int nC1 = 0, int nC2 = -1, int nR1 = 0 )

Parameters

dwOptions
[input] value from enumeration:
CWOD_SHRINK_COLS - to shrink columns
CWOD_WARNING - to issue a warning message nox and allow user to cancel the action
CWOD_CLEAR_OPERATIONS_OUTPUTS_ETC - to also clear the outputs of all operations whose inputs are in this sheet.
nC1
[input] starting column, 0 offset
nC2
[input] ending column, -1 to the end
nR1
[input] starting row, 0 offset (8.1Beta2)

Return

TRUE if Successful else returns FALSE

Examples

EX1

// Active a worksheet, set the number of rows and note the effect of ClearData
int Datasheet_ClearData_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
        return -1;
    
    wks.SetNumRows(50);
    printf("Worksheet has %u rows before ClearData\n", wks.GetNumRows());
    wks.ClearData();
    printf("Worksheet has %u rows after ClearData\n", wks.GetNumRows());
    return 0;
}
//Clear the first matrixobject's data.
void MatrixLayer_ClearData()
{
        //make sure there exists active matrixlayer containing multiple matrixobjects and filled with data
        MatrixLayer ml = Project.ActiveLayer();
        if ( !ml )
        {
                printf("Can not access active matrixsheet");
                return;
        }
        ml.ClearData(CWOD_SHRINK_COLS, 0, 0); //only clear the first matrixobject's data
}

Remark

Clears all data in the data sheet

See Also

Datasheet::Reset

Header to Include

origin.h