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
 Q:Access of Worksheetpages in project 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
hajo_old Posted - 02/13/2003 : 07:42:36 AM
Hello, the following I'm doing for counting some special worksheetpages within the project.


foreach (pg in proj.WorksheetPages)
{
if (pg.GetType()==EXIST_WKS)
{
Worksheet wks = pg.Layers(); // Get Worksheet from Layers
// collection
Column cc = wks.Columns(3);
string str = cc.GetLabel();
if (str.Find("Einspritzrate",0)!=-1)
{
imax++;
}
}
}
printf("number of Worksheets: %i",imax);




Now I've defined some subfolders within the project (e.g. "MySubFolder") and I want
to count only the number of workbooks within this special subfolder.

How can I do this in OriginC (Or is there a way to, with the help of LabTalk?)

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1

Edited by - SVDO_Origin1 on 02/13/2003 07:44:08 AM

Edited by - SVDO_Origin1 on 02/13/2003 07:48:01 AM
7   L A T E S T    R E P L I E S    (Newest First)
hajo_old Posted - 02/17/2003 : 03:36:12 AM
HI, all

ok, thanks. I finally got it!

But why the two class-paths with rootclass layer or pagebase ...

It would be more tracable to have one base like OriginObject or even PageBase, where the other classes like layer as an element of a PageBase is derived from. So you can use the attributes and functions of the underliing classes in the specialized class like layer.

As a newcommer to OriginC (but not to C++) it is verry hard to get an orientation within the OriginC class library and its object ...

-----
As a suggestion:
It would be really a good thing to look into the Trolltech QT Library. In my opinion one of the best structured, documented and functional class libraries I've ever seen.

Thanks

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
cpyang Posted - 02/14/2003 : 09:23:49 AM
quote:

But why do I have to get the WorksheetPage object first?
(line: WorksheetPage wpg(pg);)




PageBase = all window types, including Notes window
Page = Worksheet, Matrix, Graph
So a Layer collection only exists in Page and derived classes. Currently, only one layer exist in worksheet and matrices, but we will gradually add support for multiple sheets (layers).

CP




Edited by - cpyang on 02/14/2003 09:25:14 AM
Mike Buess Posted - 02/14/2003 : 08:09:41 AM
Layers() is not defined for PageBase... it needs Page or WorksheetPage.

Mike Buess
Origin WebRing Member
hajo_old Posted - 02/14/2003 : 03:00:33 AM
Hello, Mike

you are right, it compiles and works!! THANKS!

But why do I have to get the WorksheetPage object first?
(line: WorksheetPage wpg(pg);)

Thanks again
Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
Mike Buess Posted - 02/13/2003 : 7:23:37 PM
This may not be the most elegant code, but it seems to compile and work. It takes the name of a subfolder as an argument...
void test(string strFld)
{
Project.ActivateFolder(strFld);


Folder fld = Project.ActiveFolder();
PageBase pg;
Worksheet wks;
Column cc;
int imax=0;
string str;


foreach(pg in fld.Pages)
{
if( pg.GetType() == EXIST_WKS )
{
WorksheetPage wpg(pg);
wks = (Worksheet)wpg.Layers();
cc = wks.Columns(3);
str = cc.GetLabel();
if (str.Find("Einspritzrate",0)!=-1)
imax++;
}
}
printf("number of Worksheets in %s: %i\n", strFld, imax);

Folder parentFld = fld.GetParent();
Project.ActivateFolder(parentFld.GetPath());
}


Mike Buess
Origin WebRing Member
hajo_old Posted - 02/13/2003 : 10:48:14 AM
Thanks Mike,

but this is the error message:


D:\Origin_User\fn_help\baseline.c(65) :Error, in "foreach" pg must be a COM object variable
D:\Origin_User\fn_help\baseline.c(65) :Error, general compile error
D:\Origin_User\fn_help\baseline.c(47) :Error, error(s) found in compiling function _setBaseLine_Project_Folder
compiling...



Seams that the folder Object is not a COM Object, whatever that means!

Hajo
foreach(pg in fld.Pages)




-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
Mike Buess Posted - 02/13/2003 : 08:34:12 AM
Something like this should work...

PageBase pg;
string str;
Project.ActivateFolder("SubFolder");
Folder fld = Project.ActiveFolder();
foreach(pg in fld.Pages)
{
if( pg.GetType() == EXIST_WKS )
{
Worksheet wks = pg.Layers();
Column cc = wks.Columns(3);
str = cc.GetLabel();
if (str.Find("Einspritzrate",0)!=-1)
{
imax++;
}
printf("number of Worksheets: %i",imax);
}
}


Mike Buess
Origin WebRing Member

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