Hello,
If you have ver 7, you can use the following Origin C code to do this:
Compile and link this function. Then cut and paste your data into a worksheet. With the worksheet as the active window, go to Script Window and type:
shiftup
or type
shiftup 1
The first command will take the first row content and rename column names to be those strings
The second command will rename the labels instead of the column names.
Easwar
OriginLab.
void ShiftUp(int iOpt = 0)
{
// Get active page and its name
Page pg = Application.Pages();
string strPageName = pg.GetName();
// Declare workseet object and check validity
Worksheet wks(strPageName);
if(!wks.IsValid())
{
printf("Active page is not a worksheet!\n");
return
}
// Loop thru all columns of worksheet
foreach(Column col in wks.Columns)
{
// Get col index
int iColNum = col.GetIndex();
// Read 1st row of col to string
string strName;
wks.GetCell(0,iColNum, strName);
// Set col name or col label with string
if(iOpt == 0)
col.SetName(strName);
else
col.SetLabel(strName);
}
if(iOpt !=0) wks.ShowLabels();
// Delete first row of worksheet
wks.DeleteRow(0);
}
Edited by - easwar on 07/30/2002 2:53:33 PM