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
 Forum for Origin C
 Inversion of columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Germie82

1 Posts

Posted - 10/18/2011 :  05:20:36 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone, I have a column with aleatory values and I want to invert the order of the column, I mean, I want last row value in first row and so on...
Does anyone how to do it?
Thanks,
Germie

Penn

China
644 Posts

Posted - 10/18/2011 :  10:10:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Germie,

You can use the Reorder method to do this. For example:

void reorderColumn()
{
	Worksheet wks = Project.ActiveLayer();  // the active worksheet
	if(!wks)
		return;
	
	Column col = wks.Columns(0);  // the first column in the worksheet
	vector& vecCol = col.GetDataObject();  // get the data of first column
	vector<uint> vecReverseIndice(vecCol.GetSize());  // for the reverse indice
	vecReverseIndice.Data(vecReverseIndice.GetSize() - 1, 0, -1);
	
	vecCol.Reorder(vecReverseIndice);  // reverse the column
	wks.GetPage().Refresh();  // refresh the workbook
}


Penn
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