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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 make a loop using worksheet as parameter

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pikinos Posted - 10/15/2012 : 3:15:13 PM
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.
1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 10/16/2012 : 04:15:58 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000