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
 Copy and past a row in the same worksheet

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
Fry Posted - 10/04/2016 : 06:32:31 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015G (64-bit) Sr2 b9.2.272
Operating System: Windows 7

Hello Origin community,

is there a recommended way to copy one row of the worksheet to another row of the same worksheet?
I tried Worksheet::CopyTo, but as mentioned in the description i works only for the copy to another worksheet.

The code I had tried is:


	int  iRetFkt;
	
	DWORD dwCtrl = CPYT_COPY_COLUMN_FORMAT | CPYT_COPY_COLUMN_DESIGNATIONS;

	Worksheet wksAkt = Project.ActiveLayer();
	

	iRetFkt = wksAkt.CopyTo(wksAkt, 0,  -1,   0,   1,    0, -1, dwCtrl, 5);

	if(iRetFkt != 0){
		out_int("Error = ", iRetFkt);
	}


Thank you for the support!
René
2   L A T E S T    R E P L I E S    (Newest First)
Fry Posted - 10/10/2016 : 11:54:18 AM
Hello Yuki,

thanks a lot! It's my fault, I didn't look at the CPYT_* in oc_const.h! Now it works fine for me.

Regards,
Fry
yuki_wu Posted - 10/09/2016 : 03:40:38 AM
Hi,

Perhaps you can try this example:


void Worksheet_CopyTo_Ex2()
{
	Worksheet wksSource = Project.ActiveLayer();
	if( wksSource )
	{
		int nC1 = 0, nC2 = -1; 
		// The source ending row (nR2) is exclusive
		int nR1 = 2, nR2 = 4;
		//Copy to the worksheet starting at the 12th column
		int nDestR1 = 12;
		
		DWORD dwCtrl = CPYT_APPEND_BY_ROW | CPYT_ALLOW_SAME_LAYER_IF_NOT_INTERSECT;
		int nRet = wksSource.CopyTo(wksSource, nC1, nC2, nR1, nR2, 0, -1, dwCtrl, nDestR1); 
	}
}


Hope this can be some help.

Regards,
Yuki
OriginLab

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