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
 Delete Every Second Row

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
masterd Posted - 09/03/2008 : 02:49:49 AM
Origin Version: 7.5 SR6
Operating System: XP

What is the easiest way of deleting every second row (2nd, 4th, 6th, etc.) in the active worksheet? A script would be preferred so I can include it into my 'File Size Reduction Script'.

Cheers,

Darko
2   L A T E S T    R E P L I E S    (Newest First)
masterd Posted - 09/08/2008 : 01:28:13 AM
Hi MisterSpock,

Your code acatually deletes columns instead of the rows. It was a slight tweak of your code that enables me to delete rows now.

Thanks again.


void delrow()
{
Worksheet wks = Project.ActiveLayer();
if(NULL==wks)
return; // no active window, or not a worksheet
waitCursor wCur; // Bring up wait cursor to indicate computation in progress
int rowNumber, rowCount, firstRow;
rowNumber = wks.GetNumRows(); //number of rows in aktive worksheet
rowCount = 2; // for every third "rowCount = 3" and so on
firstRow = 1; // the first row to delete
int jj = 0;
for( int ii = 1; ii <= ((rowNumber - firstRow + rowCount) / rowCount); ii++ )
{
wks.DeleteRow(firstRow + jj);
jj=jj+rowCount - 1;
}
}
MisterSpock Posted - 09/05/2008 : 05:28:27 AM
Hi Darko,
you can try this code:


void deleteRow()
{
	Worksheet wks = Project.ActiveLayer();
	if(NULL==wks)
		return;				// no active window, or not a worksheet
	int rowNumber, rowCount, firstCol;
	rowNumber = wks.GetNumCols();	//number of rows in aktive worksheet
	rowCount = 3;			// for every third "rowCount = 3" and so on
	firstCol = 0;			// the first row to delete
	int jj = 0;
	for( int ii = 1; ii <= ((rowNumber - firstCol + rowCount) / rowCount); ii++ )
	{
		wks.DeleteCol(firstCol + jj);
		jj=jj+rowCount - 1;
	}
}

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