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
 Help: WorksheetPage program count/sort

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
hschausb Posted - 08/05/2020 : 11:11:47 AM
I am trying to find out how OriginLab sorts the used WorksheetPages.

I am programming Origin C and need a steady WksPages which do not change their count/sort number on every reboot of OriginLab.

I am initializing my WksPages like this “WorksheetPage book1 = Project.WorksheetPages(x);”. x is the WksPage count in the project. And these counts change around every second reboot of OriginLab which means I have to check if the WksPage objects are included to the right name every time.

Can anybody tell me “HOW” this count is done by OriginLab. I tried playing with the name of the WksPages (alphabetically, creation date) but I cannot find the pattern of the count/sort in the project.

9   L A T E S T    R E P L I E S    (Newest First)
Castiel Posted - 08/18/2020 : 06:29:39 AM
quote:
Originally posted by hschausb

Can somebody please delete this post.
I cannot delete it even as the orginal author.
Thank you very much.



Deleting the topic would delete the replies from others, including me.

I'm uncomfortable with that.

Maybe you can just delete/edit yours.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
hschausb Posted - 08/18/2020 : 06:07:37 AM
Can somebody please delete this post.
I cannot delete it even as the orginal author.
Thank you very much.
hschausb Posted - 08/12/2020 : 07:21:18 AM
quote:
Originally posted by Castiel

To get a WorksheetPage by name:
WorksheetPage wp("Book1");


To get a Worksheet by name:
Worksheet wks("[Book1]Sheet1");


See the constructors of WorksheetPage and Worksheet:
https://www.originlab.com/doc/OriginC/ref/WorksheetPage-WorksheetPage
https://www.originlab.com/doc/OriginC/ref/Worksheet-Worksheet





You are my hero. Thank you very much.
Castiel Posted - 08/11/2020 : 06:11:18 AM
quote:
Originally posted by hschausb

quote:
Originally posted by cpyang

Maybe you can explain a bit more on what you are trying to do? Why do you need to write code based on some count? Why not use name which is more reliable and self-explanatory?

CP




I am new to Origin C and there is a high possibility that I have missed this, so bear with me.
IT IS POSSIBLE TO INCLUDE WORKSHEETS BASED ON NAME??? I have looked for 2 hours and could not find a way to include worksheets based on their name. I also could not find a way to check if there is any Worksheet with a specific name already existing (Object.Exist is not the right thing; at least for Origin C).
If you have a way, pleas, please, pretty please tell me. You would be my hero.

quote:
Originally posted by Castiel

It seems to be sorted so that the active WorksheetPage (from project saved latest) is returened from Project.WorksheetPages(x) with the x as large as possible.

The following code should give you the WorksheetPage's in a stable order:
foreach(WorksheetPage wp in Project.WorksheetPages){ /* your code */}



Why would I use the “Active Worksheet” if this changes depending on which Worksheet I am working on?




"Active WorksheetPage" explains why your got different WorksheetPage with identical "x" in Project.WorksheetPages(x).
How x and WorksheetPage are connected could be a little complicated for beginners. Never mind since rarely will one have to care about it.

To get a WorksheetPage by name:
WorksheetPage wp("Book1");


To get a Worksheet by name:
Worksheet wks("[Book1]Sheet1");


See the constructors of WorksheetPage and Worksheet:
https://www.originlab.com/doc/OriginC/ref/WorksheetPage-WorksheetPage
https://www.originlab.com/doc/OriginC/ref/Worksheet-Worksheet


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
hschausb Posted - 08/11/2020 : 03:27:35 AM
quote:
Originally posted by cpyang

Maybe you can explain a bit more on what you are trying to do? Why do you need to write code based on some count? Why not use name which is more reliable and self-explanatory?

CP




I am new to Origin C and there is a high possibility that I have missed this, so bear with me.
IT IS POSSIBLE TO INCLUDE WORKSHEETS BASED ON NAME??? I have looked for 2 hours and could not find a way to include worksheets based on their name. I also could not find a way to check if there is any Worksheet with a specific name already existing (Object.Exist is not the right thing; at least for Origin C).
If you have a way, pleas, please, pretty please tell me. You would be my hero.

quote:
Originally posted by Castiel

It seems to be sorted so that the active WorksheetPage (from project saved latest) is returened from Project.WorksheetPages(x) with the x as large as possible.

The following code should give you the WorksheetPage's in a stable order:
foreach(WorksheetPage wp in Project.WorksheetPages){ /* your code */}



Why would I use the “Active Worksheet” if this changes depending on which Worksheet I am working on?
Castiel Posted - 08/10/2020 : 8:54:06 PM
quote:
Originally posted by hschausb

quote:


It seems to be sorted so that the active WorksheetPage (from project saved latest) is returened from Project.WorksheetPages(x) with the x as large as possible.

The following code should give you the WorksheetPage's in a stable order:
foreach(WorksheetPage wp in Project.WorksheetPages){ /* your code */}





Would you mind explaining why I should use a "foreach" if the code only runs through the first Worlpage?
Also I do not understand how this sets up a static worksheet count? Which comand is it that does that?
And the last question. I am working with self made functions and everything. What is supposed to go into the "your code" part? The main programm with all sub functions? Only the main programm? Should this be in the main programm included during the inclusion of the WorksheetPages and Worksheets?



That code returns WorksheetPage s in stable order.Your code can be any code, for example, caching the orders.

Maybe you should follow cpyang's post, using the names of WorksheetPage s makes sense.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
cpyang Posted - 08/10/2020 : 12:42:59 PM
Maybe you can explain a bit more on what you are trying to do? Why do you need to write code based on some count? Why not use name which is more reliable and self-explanatory?

CP
hschausb Posted - 08/10/2020 : 11:44:12 AM
quote:


It seems to be sorted so that the active WorksheetPage (from project saved latest) is returened from Project.WorksheetPages(x) with the x as large as possible.

The following code should give you the WorksheetPage's in a stable order:
foreach(WorksheetPage wp in Project.WorksheetPages){ /* your code */}





Would you mind explaining why I should use a "foreach" if the code only runs through the first Worlpage?
Also I do not understand how this sets up a static worksheet count? Which comand is it that does that?
And the last question. I am working with self made functions and everything. What is supposed to go into the "your code" part? The main programm with all sub functions? Only the main programm? Should this be in the main programm included during the inclusion of the WorksheetPages and Worksheets?
Castiel Posted - 08/10/2020 : 07:01:26 AM
quote:
Originally posted by hschausb

I am trying to find out how OriginLab sorts the used WorksheetPages.

I am programming Origin C and need a steady WksPages which do not change their count/sort number on every reboot of OriginLab.

I am initializing my WksPages like this “WorksheetPage book1 = Project.WorksheetPages(x);”. x is the WksPage count in the project. And these counts change around every second reboot of OriginLab which means I have to check if the WksPage objects are included to the right name every time.

Can anybody tell me “HOW” this count is done by OriginLab. I tried playing with the name of the WksPages (alphabetically, creation date) but I cannot find the pattern of the count/sort in the project.





It seems to be sorted so that the active WorksheetPage (from project saved latest) is returened from Project.WorksheetPages(x) with the x as large as possible.

The following code should give you the WorksheetPage's in a stable order:
foreach(WorksheetPage wp in Project.WorksheetPages){ /* your code */}



------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------

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