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
 LabTalk Forum
 copy long name

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
kdsaransh Posted - 12/23/2014 : 02:22:12 AM
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
8   L A T E S T    R E P L I E S    (Newest First)
kdsaransh Posted - 12/24/2014 : 09:57:56 AM
Thank you so much for the help. It really solved my problem a lot.
lkb0221 Posted - 12/23/2014 : 2:05:23 PM
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
kdsaransh Posted - 12/23/2014 : 12:17:54 PM
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. ...
lkb0221 Posted - 12/23/2014 : 12:07:00 PM
// 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
kdsaransh Posted - 12/23/2014 : 11:41:26 AM
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 .
lkb0221 Posted - 12/23/2014 : 11:33:14 AM
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
kdsaransh Posted - 12/23/2014 : 11:21:26 AM
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,


lkb0221 Posted - 12/23/2014 : 09:40:35 AM
Hi,

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

Zheng
OriginLab

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