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
 Origin Forum
 Copy from XL to Origin 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
shepman Posted - 07/30/2002 : 1:04:59 PM
I want to copy columns of data from an XL worksheet to an Origin datasheet so that the first row of the copied XL is pasted as the column headers of the Origin datasheet. I know that this can be done with import ASCII, but that takes too long, and I am lazy.

shepman
1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/30/2002 : 2:08:09 PM
Hello,

If you have ver 7, you can use the following Origin C code to do this:

Compile and link this function. Then cut and paste your data into a worksheet. With the worksheet as the active window, go to Script Window and type:
shiftup
or type
shiftup 1
The first command will take the first row content and rename column names to be those strings
The second command will rename the labels instead of the column names.

Easwar
OriginLab.



void ShiftUp(int iOpt = 0)
{
// Get active page and its name
Page pg = Application.Pages();
string strPageName = pg.GetName();
// Declare workseet object and check validity
Worksheet wks(strPageName);
if(!wks.IsValid())
{
printf("Active page is not a worksheet!\n");
return
}
// Loop thru all columns of worksheet
foreach(Column col in wks.Columns)
{
// Get col index
int iColNum = col.GetIndex();
// Read 1st row of col to string
string strName;
wks.GetCell(0,iColNum, strName);
// Set col name or col label with string
if(iOpt == 0)
col.SetName(strName);
else
col.SetLabel(strName);
}
if(iOpt !=0) wks.ShowLabels();

// Delete first row of worksheet
wks.DeleteRow(0);
}


Edited by - easwar on 07/30/2002 2:53:33 PM

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