Highlight ranges as selected specified by input row and column indices
BOOL SetSelectedRange( vector<int> & vR1, vector<int> & vC1 = NULL, vector<int> & vR2 = NULL, vector<int> & vC2 = NULL, BOOL bData = true )
TRUE for success, otherwise return false
EX1
// example select all rows in a worksheet where // col(1) is between 0.2 and 0.6 // To test, fill col(1) with uniform random numbers //col(1)=uniform(1000) void Worksheet_SetSelectedRange_Ex1(string strPre = "range a=1", string strCond = "a>=0.2 && a<=0.6") { Worksheet wks = Project.ActiveLayer(); if(!wks) return; vector<uint> vnRowIndices; vector<uint> vnCols = {0,2}; int nn = wks.SelectRows(strCond, vnRowIndices, 0, -1, -1, strPre); if(nn == 0) out_str("no matching row"); else { vector<int> vnRows; vnRows = vnRowIndices; wks.SetSelectedRange(vnRows); out_int("Number of rows =", nn); } }
SetSelectedRange will be used to do multiple selection on a given Worksheet. The optional args maybe skipped under the following three situations
SetSelectedRange(vR1); // Full rows selected;
SetSelectedRange(vR1, vC1);// individual cells selected
SetSelectedRange(vR1, vC1, vR2);// partial cols selected;
Worksheet::SelectRows, Worksheet::GetSelectedRange
origin.h