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 a data from one workbook to another

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
alhelwi Posted - 11/09/2010 : 10:08:14 AM
Origin version 8

i need to copy a data set from Book1 to Book2:
Case 1: same col and rows
Case 2: different row

-------
Case 1:
-------
copy: [Book1][(col=1 to col=30),(row=1 to row=1000)]
To: [Book2][(col=1 to col=30),(row=1 to row=1000)]


-------
Case 2:
-------
copy: [Book1][(col=1 to col=3),(row=1050 to row=2050)]
To: [Book2][(col=32 to col=35),(row=1 to row=1000)]

3   L A T E S T    R E P L I E S    (Newest First)
Iris_Bai Posted - 11/15/2010 : 9:01:35 PM
Hi,

Worksheet::CopyTo is a new method added from Origin8 SR5. Please upgrade your Origin.

Iris
alhelwi Posted - 11/15/2010 : 09:22:46 AM
Hello Greg,

thanks for your reply, but it doesn't work!
It gaves me this failure message:
"Member function Worksheet::CopyTo not defined or does not have matching prototype."

If i go to Origin C help, it seems that CopyTo is not a function of the class Worksheet, that's why:
Worksheet wks1("[Book1]Sheet1"); ----> wks1.CopyTo(....);
doesn't work.
As i understood one has to define a Matrix
matrix mat1; ----> mat1.CopyTo(...);

But i still don't understand how the matrix works in order to copy the data.

Thanks in advance for any help!!
greg Posted - 11/10/2010 : 3:25:19 PM
You would think that the second case is the tricky one, but a single Worksheet method handles both cases:

// copy block of data
void copyblock()
{
Worksheet wks1("[Book1]Sheet1");
Worksheet wks2("[Book2]Sheet1");
// Case 1 : Copy
// col1 to col30, row1 to row1000 to col1
wks1.CopyTo(wks2,0,29,0,1000,0,-1,0);
// Case 2 : Copy with shift
// col1 to col3, row1050 to row2050 to col32
wks1.CopyTo(wks2,0,2,1049,2050,31,-1,0);
}

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