2.2.4.10.4 DataRangeEx::GetRangeGetRange
 
Description
Get one dataset's range.
 
Syntax
bool GetRange( int & c1, int & c2, int nIndex = 0 ) 
 
 
bool GetRange( Datasheet & ds, int nIndex = 0 ) 
Parameters
-  c1
 
- [output]begining column index (0 based)
 
-  c2
 
- [output]ending column index (0 based)
 
-  nIndex
 
- [input]the index of the data. DataRange can reference multiple sets of data. Index starts from 0.
  
 
 
-  ds
 
- [output]the datasheet that contained the datarange
 
-  nIndex
 
- [input]the index of the data. DataRange can reference multiple sets of data. Index starts from 0.
  
Return
true for success or false for failure
  
true for success or false for failure
 
Examples
//Print out the begining and ending index and datasheet of the DataRangeEx.
void DataRangeEx_GetRange_Ex1()
{
    //assume the active workbooka sheet and has least four columns before run this code.
    Worksheet wks = Project.ActiveLayer();
    if ( !wks )
    {
        printf("Can not find any active worksheet!");
        return;
    }
    DataRange dr;
    dr.Create();//init the object
    dr.Add("X", wks, 0, 0, -1, 0);
    dr.Add("Y", wks, 0, 1, -1, 1);
    dr.Add("X", wks, 0, 2, -1, 2);
    dr.Add("Y", wks, 0, 3, -1, 3);
    Tree trData;
    dr.GetTree(trData);
    
    DataRangeEx drEx;
    drEx.Create(trData, true);
    
    int c1, c2;
    Datasheet dsh;
    drEx.GetRange(c1, c2, 2);
    drEx.GetRange(dsh, 2);
    printf("DataRangeEx's range is from %d to %d in datasheet %s\n", c1, c2, dsh.GetName());
    return;
}
Remark
See Also
DataRange::GetRange,DataRange::SetRange
 
Header to Include
origin.h
 
             |