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
 worksheet creation

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
Niko1 Posted - 07/25/2005 : 06:56:56 AM
Origin Version (Select Help-->About Origin):
Operating System:

Hello!
I'd like to know if it's possible to create a worksheet thanks to the code builder(precizing the number of columns and their width). In my case, I can't use a template cause the number of columns is not previously defined: I descover it "dynamically" when I run my program...
1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/25/2005 : 09:38:39 AM
Hi,

Here is a code example. Look at the Worksheet and Column class documentation in the Programming->Origin C Language Reference help file for more information.

Easwar
OriginLab


void make_custom_wks()
{
// First create a worksheet page using Origin.OTW template
// Note: you can replace "Origin" with your custom template name
// if you want to start from some custom configuration
WorksheetPage wpg;
wpg.Create("Origin");

// Point to the first layer in the page, which would be
// the worksheet
Worksheet wks = wpg.Layers(0);

// Delete all existing columns in this worksheet
while( wks.DeleteCol(0) );

// Now let us for example add 4 new cols
// with X Y X Y designation and set their widths
int nIndex;
// Col1
nIndex = wks.AddCol("MyCol1");
wks.Columns(nIndex).SetType(OKDATAOBJ_DESIGNATION_X);
wks.Columns(nIndex).SetWidth(10);
// Col2
nIndex = wks.AddCol("MyCol2");
// Default col type is Y so no need to set this one
wks.Columns(nIndex).SetWidth(8);
// Col3
nIndex = wks.AddCol("MyCol3");
wks.Columns(nIndex).SetType(OKDATAOBJ_DESIGNATION_X);
wks.Columns(nIndex).SetWidth(10);
// Col4
nIndex = wks.AddCol("MyCol4");
// Default col type is Y so no need to set this one
wks.Columns(nIndex).SetWidth(20);
// Add label to this last col for example
string strLabel = "This is column 4 \r\nSecond line of Label";
wks.Columns(nIndex).SetLabel(strLabel);
// Turn on label display for the worksheet
wks.ShowLabels();
}




Edited by - easwar on 07/25/2005 09:40:32 AM

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