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
 add columns(>=3) to worksheet and fill data

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
jeson fon Posted - 08/04/2012 : 8:40:15 PM
Origin Ver. and Service Release (Select Help-->About Origin):OriginPro 8 SR0 v8.0725(B725)
Operating System:Win7

Hi,
Every super programmer,there a problem about worksheet column.

void fillColumns()
{
Dataset s1;
//specify wks, col num:
if (s1.Attach("data1", 0))
{
s1.SetSize(100);
for (int ii = 0; ii < 100; ii++)
s1[ii] = ii;
}
//specify data set name:
if (s1.Attach("data1_b"))
{
s1.SetSize(100);
for (int ii = 0; ii < 100; ii++)
s1[ii] = ii^2;
}
}

Now,I want to add third column or more column and fill value,would you tell me how can I do.
Thanks.

Jeson Fon
5   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 08/07/2012 : 12:37:56 AM
I have Origin-Pro8.0 SR6 installed on a Win-XP machine ...
Try Help - Check for updates to update your Origin-Pro to the most up to date Service release for 8.0
jeson fon Posted - 08/07/2012 : 12:28:13 AM
Oh£¬could the version problem?
Origin Ver. and Service Release (Select Help-->About Origin):OriginPro 8 SR0 v8.0725(B725)
Operating System:Win7

It dosn't work in my computer,
rlewis Posted - 08/07/2012 : 12:19:28 AM
I compiled and ran the code you posted and it worked just fine ...
jeson fon Posted - 08/06/2012 : 11:18:33 PM
Hi,
rlewis,thanks you for your help,but failed.eg:

void DoSomeStuff()
{
	Worksheet Wks=Project.ActiveLayer();
	if (Wks.IsValid()==true)
	{
		Dataset s1;
		if (s1.Attach(Wks, 0))
		{
			s1.SetSize(100);
			for (int ii = 0; ii < 100; ii++)
			s1[ii] = ii;
		}

		if (s1.Attach(Wks,1))
		{
			s1.SetSize(100);
			for (int ii = 0; ii < 100; ii++)
			s1[ii] = ii^2;
		}
		
		int jCol=Wks.AddCol();
		if(jCol>=0)
		{
			if(s1.Attach(Wks,jCol))
			{
			 s1.SetSize(100);
			 for (int ii = 0; ii < 100; ii++)
			 s1[ii] = sqrt(ii);            // Add code for filling column attached to dataset s1
			}
		}
	}
	
}

Is the red code wrong?

Jeson fon
rlewis Posted - 08/04/2012 : 10:08:47 PM
Try Something like ...

void DoSomeStuff()
{
	Worksheet Wks=Project.ActiveLayer();
	if (Wks.IsValid()==true)
	{
		Dataset s1;
		if (s1.Attach(Wks, 0))
		{
			s1.SetSize(100);
			for (int ii = 0; ii < 100; ii++)
			s1[ii] = ii;
		}

		if (s1.Attach(Wks,1))
		{
			s1.SetSize(100);
			for (int ii = 0; ii < 100; ii++)
			s1[ii] = ii^2;
		}
		
		int jCol=Wks.AddCol();
		if(jCol>=0)
		{
			if(s1.Attach(Wks,jCol))
			{
				// Add code for filling column attached to dataset s1
			}
		}
	}
	
}

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