Origin Version (Select Help-->About Origin): 7.5
Operating System: XP
Hi, I'm trying to write my first origin c code and I'm having a problem. I am trying to combine a whole bunch of different worksheets (all in the same folder in project explorer) onto one worksheet.
I started by copying the first worksheet, so that I would have the correct designations and formats for the columns, and then just wanted to write out the cells for all the rest of the worksheets. All numerical values are being copied just fine, but the text values are not, I just get a - for all those fields.
I'm sure there is a more elegant way to write the code, but this is what I have done: Can setcell not change the cast for the third parameter back and forth?
Thanks for any help/suggestions!
Jennifer
// Combine selected worksheets (from the active folder in project explorer) into one worksheet.
void CombineWks()
{
StringArray sa;
GetWksList(sa);
Worksheet wks;
Worksheet SummaryWks;
int nRows=0;
int rows;
int col;
for(int i=0;i<sa.GetSize();i++) {
wks.Attach(sa[i]);
if (i==0) {
SummaryWks.CreateCopy(wks);
}
else {
nRows +=wks.GetNumRows();
}
}
ASSERT(SummaryWks.AppendRows(nRows));
for (i=0; i<sa.GetSize();i++) {
wks.Attach(sa[i]);
if (i==0) {
nRows=wks.GetNumRows();
}
else {
for (rows=0; rows<wks.GetNumRows();rows++) {
for (col=0;col<wks.GetNumCols(); col++) {
SummaryWks.SetCell(nRows, col, wks.Cell(rows,col));
}
nRows++;
}
}
}
SummaryWks.GetPage().Refresh(TRUE);
}