Sort Columns?

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
Anonymous47
Posts: 7
Joined: Wed Jul 10, 2013 6:42 pm

Sort Columns?

Post by Anonymous47 »

Only a little question:

I have a excel sheet with 3 columns.
How can i sort using column 2 oder 3?

XLS[0].Sort(0,XLS[0].FirstRow,2,XLS[0].LastRow,TRUE,TRUE);

only sorts using column 0.

Thanks for help.
Anonymous47
Posts: 7
Joined: Wed Jul 10, 2013 6:42 pm

Re: Sort Columns?

Post by Anonymous47 »

...
Last edited by Anonymous47 on Wed Feb 25, 2015 6:33 am, edited 1 time in total.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Sort Columns?

Post by larsa »

Hello

The values of FirstRow and LastRow is probably wrong. You must use XLS[0].CalcDimensions before you can use these values.
Lars Arvidsson, Axolot Data
Anonymous47
Posts: 7
Joined: Wed Jul 10, 2013 6:42 pm

Re: Sort Columns?

Post by Anonymous47 »

I think you dont understand me. I will sort full rows, but not only ohne column of a row, and not column 1, but column 2 oder 3.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Sort Columns?

Post by larsa »

Hello

Sort on column 2

Code: Select all

XLS[0].Sort(1,XLS[0].FirstRow,1,XLS[0].LastRow,TRUE,TRUE);
Sort on column 3

Code: Select all

XLS[0].Sort(2,XLS[0].FirstRow,2,XLS[0].LastRow,TRUE,TRUE);
Lars Arvidsson, Axolot Data
Anonymous47
Posts: 7
Joined: Wed Jul 10, 2013 6:42 pm

Re: Sort Columns?

Post by Anonymous47 »

You dont understand me. Small example:

23456 - - a - - 07.01.1900
43 - - f - - 01.01.1900
356675 - - df - - 02.01.1900

XLS[0].Sort(2,XLS[0].FirstRow,2,XLS[0].LastRow,TRUE,TRUE);

Result:

23456 - - a - - 01.01.1900
43 - - f - - 02.01.1900
356675 - - df - - 07.01.1900

but it should be

43 - - f - - 01.01.1900
356675 - - df - - 02.01.1900
23456 - - a - - 07.01.1900
Anonymous47
Posts: 7
Joined: Wed Jul 10, 2013 6:42 pm

Re: Sort Columns?

Post by Anonymous47 »

Push
Post Reply