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
 Clear 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
peter.cook Posted - 11/03/2003 : 11:52:28 AM
Hi,

Is there a simple reliable (ie permament) way to clear an entire worksheet with LabTakl or origin C - Clearworksheet macro does not clear ie data can be brought back by eg 'set %H -e 10'?

I have used :

works -s 0 0 0 0;
menu -e 57632;

With 6.0 & 6.1 I don't get prompted 'Are you sure etc..' but I do with 7.5 - is this a setting somewhere?

Cheers,

Pete



Edited by - peter.cook on 11/03/2003 11:54:06 AM
4   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 11/05/2003 : 10:20:34 AM
HI CP,

Fair enough!

Addition for SR1 sounds good.

Cheers,

Pete

cpyang Posted - 11/04/2003 : 08:29:03 AM
ClearWorksheet macro was defined a long time ago, before set -em was implemented. We are not sure if there would be script out there that didn't want to fill with missing values after ClearWorksheet.

We are going to add a method(5471) into OC Worksheet class for SR1 that will do this cleanly in OC. This new method is going to be like this,


/**
Parameters:
nNumRows = number of rows in worksheet, use -1 to keep current settings
nNumCols = number of columns, use -1 to keep current settings
bClearData = decide if existing data in worksheet should be cleared. If True, then all data in worksheet is reset to missing values and each column is reset to upper index = 0, if FALSE, then no action is taken on both the data and the upper index on each column, and newly added columns will be in default state
Remarks:
If nNumCols is larger then the current number of columns in the worksheet, then new columns will be added using enumerated column names which is faster then calling AddCol
*/
BOOL SetSize(int nNumRows, int nNumCols, BOOL bClearData = FALSE);



so to do clear worksheet, can call SetSize(-1, -1). The current AddCol function is rather slow, so this new method will solve that problem as well.


CP


peter.cook Posted - 11/04/2003 : 04:16:29 AM
Hi CP.

Thanks - this works fine.

Should the clearworksheet macro be modified accordingly or is it's behaviour (by compariosn) intentional?

Cheers,

Pete

cpyang Posted - 11/03/2003 : 12:35:34 PM
The following LT code in OC should work

 
void clear_worksheet(string strWksName = "data1")
{
Worksheet wks(strWksName);
if(wks)
wks.LT_execute("set %H -er 30;set %H -em 0;set %H -update");
else
out_str("no such worksheet");
}




CP



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