The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 make a loop using worksheet as parameter
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

pikinos

France
1 Posts

Posted - 10/15/2012 :  3:15:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everibody. Sorry to bother you. I am in great difficulties because I don't understand programmation.

I have a lot of different ( and similar) worksheets. Only values in columns are changing between 2 worksheets.

I want to make a programm which will do the same operation in a new column of the worksheet and plot the second column as a function of the new column we have just defined.

And I don't know how to do that. I work with Origin 7 and I see that I have to make a loop but I don(t know how to define a woorksheet as a parameter.

Sorry for the english I hope you understand what I mean. Thanks for your help.

Penn

China
644 Posts

Posted - 10/16/2012 :  04:15:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Maybe you can try to use the string as parameter, which will be the worksheet name, and then you can define a worksheet with this worksheet name string. For example (in Origin 7):

// get worksheet by name
void get_worksheet_by_name(string strName)
{
    Worksheet wks(strName);  // define worksheet by name string
    if(!wks.IsValid())  // if the worksheet is not valid
    {
        out_str("not a valid worksheet");
        return;
    }
    out_str("do something with the worksheet here");
}
// loop all worksheet page in the project, so to get worksheet by calling get_worksheet_by_name
void loop_worksheets()
{
    for(int index=0; ; index++)
    {
        WorksheetPage pg = Project.WorksheetPages(index);  // get the worksheet page in project by index
        if(!pg.IsValid())  // if page is not valid
        {
            out_str("not a valid page");
            break;  // get out of the for loop
        }
        get_worksheet_by_name(pg.GetName());  // worksheet page and worksheet share the same name in Origin 7
    }
}


Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000