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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 copy long name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kdsaransh

India
89 Posts

Posted - 12/23/2014 :  02:22:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I am using origin 9.1. I want to copy the long name and comment of a worksheet to the column of another workbook using script, but i am unable to do so. Please help me out.

Regards,
Rajesh Agarwal

Edited by - kdsaransh on 12/23/2014 02:27:25 AM

lkb0221

China
497 Posts

Posted - 12/23/2014 :  09:40:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please try XF wcopy, with argument copydata be 0.
http://www.originlab.com/doc/X-Function/ref/wcopy

Zheng
OriginLab
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 12/23/2014 :  11:21:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Zheng,

Sorry for the confusion. But i don't want to copy the entire worksheet. So the problem is as follows:

I have a workbook (book1) having a sheet (sheet1). This sheet1 contains some data in some columns and each column has a long name, units and comments. Now i want to copy the long name/unit/comment of a specified column in sheet1 to the specified column of another sheet1 of another workbook (book2).

Thanks for your reply...

Regards,


Go to Top of Page

lkb0221

China
497 Posts

Posted - 12/23/2014 :  11:33:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, kdsaransh

Then use the following sample:
// Start
range r1 = [book1]Sheet1!col(A); // Point to the source column
range r2 = [Book2]Sheet2!col(B); // Point to the target column
r2[L]$ = r1[L]$; // Copy the LongName
r2[U]$ = r1[U]$; // Copy the Unit
r2[C]$ = r1[C]$; // Copy the Comment
// End


Or, use colcopy XF:
// Start
range r1 = [book1]Sheet1!col(A); // Point to the source column
range r2 = [Book2]Sheet2!col(B); // Point to the target column
colcopy irng:=r1 orng:=r2 data:=0 format:=0; // Copy column with out data, no recalculation
// End


Zheng
OriginLab
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 12/23/2014 :  11:41:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the reply, but this is not i want.

I want to copy the long name of a sheet to a row of a column . For ex: the long name of the data in sheet1 and in column (A) is " voltage". Now i want to copy this long name to another sheet of a different workbook in column (B), but in row 1.

Thanks .
Go to Top of Page

lkb0221

China
497 Posts

Posted - 12/23/2014 :  12:07:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
// Start
range r1 = [book1]Sheet1!col(A); // Point to the source column
range r2 = [Book2]Sheet2!col(B); // Point to the target column
r2[1]$ = r1[L]$; // Copy the LongName
// End
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 12/23/2014 :  12:17:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot. You really solved my problem. I now know what silly mistake i was doing.

It will more to ask , i know , but since i am very new to lab talk, so if you could also help me out for the following:

I want to put this command in a loop. i mean to say that now i want to copy multiple column long name of a sheet to the row (row 1, row 2, row 3 etc) of another sheet.

please....

thanks once again. ...
Go to Top of Page

lkb0221

China
497 Posts

Posted - 12/23/2014 :  2:05:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
For example, to copy all long names from a worksheet:
// Start
range r1 = [Book1]Sheet1!; // Source Worksheet
range r2 = [Book2]Sheet2!col(A); // Target Column
for (int ColNum = 1; ColNum <= r1.ncols; ColNum++) {
r2[ColNum]$ = r1.col$(ColNum).lname$;
}
// End


In this sample, I used wks.col.lname$ to access column long name. It is a old method but is easier for writing the loop. wks.col can only access long name, short name, unit and comment. For other labels, you will need to use notations like Col(A)[L]$.

Zheng
OriginLab

Edited by - lkb0221 on 12/23/2014 2:05:59 PM
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 12/24/2014 :  09:57:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much for the help. It really solved my problem a lot.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000