Author |
Topic |
|
alhelwi
Germany
Posts |
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)]
|
|
greg
USA
1378 Posts |
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); }
|
|
|
alhelwi
Germany
Posts |
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!!
|
|
|
Iris_Bai
China
Posts |
Posted - 11/15/2010 : 9:01:35 PM
|
Hi,
Worksheet::CopyTo is a new method added from Origin8 SR5. Please upgrade your Origin.
Iris |
|
|
|
Topic |
|
|
|