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
 How can I access worksheet in subfolder

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
ydjang Posted - 06/19/2013 : 9:57:48 PM
Origin Ver. and Service Release (Select Help-->About Origin):8.1
Operating System:Windows 7

I would like to manipulate the worksheet data with origin C code.
I want that my OriginC code affects to all worksheets only in the specific subfolder.
How do I do it?

For example, there are two subforlders named "folder1" and "folder2".
I would like to control all the worksheets in the "folder1" not "folder2"

Please help me out.
2   L A T E S T    R E P L I E S    (Newest First)
ydjang Posted - 06/23/2013 : 10:08:33 PM
Thanks alot, mate.
Penn Posted - 06/20/2013 : 05:36:33 AM
Hi,

You can use the Pages collection to get all the pages in the specified folder, and then figure out those pages that are workbooks by GetType method, and then get the worksheets in the workbook by Layers collection. See the following example.

void worksheets_folder()
{
	Folder fld("/folder1/");  // folder1 under the root folder
	if(!fld)
		return;
	
	foreach(PageBase page in fld.Pages)  // all pages in folder1
	{
		if(page.GetType() == EXIST_WKS)  // if the page is workbook
		{
			WorksheetPage wp(page);  // worksheet page (workbook)
			int nWks = wp.Layers.Count();  // number of worksheets in workbook
			for(int ii = 0; ii < nWks; ii++)
			{
				Worksheet wks = wp.Layers(ii);  // worksheet
				out_str("Worksheet: " + wks.GetName() + " in " + wp.GetName() + " Workbook");  // output worksheet name
			}
		}
	}
}


Penn

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