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 to add column to newly created sheet

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
ahlers01 Posted - 05/26/2010 : 12:33:28 AM
Origin Ver. 8.0 Service Release 5
Operating System: Win XP

Hi,

I'm a beginner in Origin and I'm stuck with what seems to be a simple operation:

I create, in an existing Book, an additional Sheet, and then I try to add a column to that new sheet:

WorksheetPage wpData = wksData.GetPage();
wpData.AddLayer("Sheet2");
wksData.AddCol();

Before I run the code the book contains only Sheet1, after I run it it contains Sheet1 and Sheet2, but the new column is added to Sheet1 (which is the topmost).

Obviously I have somehow to make Sheet2 topmost or active before calling AddCol(), but I have no idea how to do that. (And Origin's help files didn't give me any clue)

Thanks for your help!
2   L A T E S T    R E P L I E S    (Newest First)
ahlers01 Posted - 05/26/2010 : 2:00:00 PM
Hi Penn.

thanks for your extremely quick reply! I love timezones!
Penn Posted - 05/26/2010 : 01:33:44 AM
Hi,

I guess that the variable wksData in your code is for Sheet1. And then you try to add a new column to Sheet2 by using this line wksData.AddCol();. Of course it will not add the new created column to Sheet2, because the AddCol() method is called by variable wksData, which is for Sheet1.

To add a new column to Sheet2, you should use the variable which is for Sheet2. Please try the following code.

WorksheetPage wpData = wksData.GetPage();  // get Sheet1's page
wpData.AddLayer("Sheet2");  // add one more sheet to page, named Sheet2
Worksheet wksData2 = wpData.Layers("Sheet2");  // get Sheet2
wksData2.AddCol();  // add a new column to Sheet2


Penn

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