2.2.4.46.38 Worksheet::GetRange

Description

Get the beginning and ending row indices for the specified columns in this Worksheet. This is an improved version of GetBounds with more detailed controls on handling of missing and text values

Syntax

BOOL GetRange( int & iR1, int & iR2, int iC1 = 0, int iC2 = -1, int nAdjustLowerIndex = GDR_SKIP_NON_NUMERIC, int nAdjustUpperIndex = GDR_SKIP_NON_NUMERIC )

Parameters

iR1
[output] Output minimum begining row index (0 based)
iR2
[output] Output maximum ending row index (0 based), if return -1, this block is all missing value
iC1
[input] Begining column index (0 based offset, default 0 is first column)
iC2
[input] Ending column index (0 based offset, default -1 to indiate last column)
nAdjustLowerIndex
[input] GDR_SKIP_NON_NUMERIC (default) advances iR1 to last row with with numeric value, GDR_NO_ADJUST will not modify and GDR_SKIP_MISSING_BLANK will allow both numeric and text.
nAdjustUpperIndex
[input] GDR_SKIP_NON_NUMERIC (default) retards iR2 to first row with numeric value, GDR_NO_ADJUST will not modify and GDR_SKIP_MISSING_BLANK will allow both numeric and text.

Return

Returns TRUE on success and FALSE on failure.

Examples

EX1

void Worksheet_GetRange_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    int nR1, nR2;
    
    wks.GetRange(nR1, nR2);
    // Convert to LabTalk column number indexing by adding 1
    printf("%s[%d:%d]\n", wks.GetPage().GetName(), nR1+1, nR2+1);
    // show rows for each column
    foreach(Column cc in wks.Columns)
    {
        vector v(cc);
        printf("Col(%s)[%d:%d]\n",cc.GetName(), v.GetLowerBound()+1, v.GetUpperBound()+1);
    }
}

Remark

See Also

Worksheet::SetRange, Worksheet::GetBounds

Header to Include

origin.h