Hi,
1. Get the Column from the Worksheet, and set long name and short name by using methods SetLongName and SetName respectively.
2. Get part of data from the column by using vector.
3. Calculate the maximum and minimum of the data by using max and min functions respectively.
4. Set the value to a cell of the worksheet by using SetCell method.
About your issue, you can refer to:
void test()
{
string strWks;
strWks = "[RESULTSSHEET]1"; // worksheet name
Worksheet wks(strWks);
if(!wks)
return;
Column col = wks.Columns(17); // zero-based index
if(!col)
return;
if(col.SetLongName("D/G")) // set long name
out_str("set long name successfully");
if(col.SetName("DG")) // cannot have "/" in short name
out_str("set name successfully");
string strWks1;
strWks1 = "[DATASHEET]1"; // worksheet name
Worksheet wks1(strWks1);
if(!wks1)
return;
Column col1 = wks1.Columns(1); // zero-based index
if(!col1)
return;
vector Drange(col1, 999, 1999); // zero-based index of row
vector Grange(col1, 1999, 2999);
vector DandGrange(col1, 1499, 2499);
double Dmax, Gmax, DandGmin;
Dmax = max(Drange); // get maximum
Gmax = max(Grange); // get maximum
DandGmin = min(DandGrange); // get minimum
if(wks.SetCell(0, 17, (Dmax-DandGmin)/(Gmax-DandGmin))) // set the value to a cell of worksheet
out_str("set cell successfully");
}
Penn