Hi all,
I have Exported data to excel and sorted the data in excel from nav itself. The data was sorted ascending, But i want the data in descending order. Any idea? Please need help.
Created a function in Excel Buffer table for sorting
Function SortColumn(StartColumn:code;StartRow:Integer;EndColumn:Code;EndRow:Integer;SortColumn:Code);
BEGIN
XlWrkSht.Range(StartColumn+FORMAT(StartRow-1)).Select;
XlApp.ActiveWindow.FreezePanes := TRUE;
XlWrkSht.Range(StartColumn+FORMAT(StartRow) + ':'+EndColumn+FORMAT(EndRow-1)).Sort(XlWrkSht.Range(SortColumn+FORMAT(StartRow)));
END;
And in report, after calling the CreateSheet and before the GiveUserControl you should execute something like:
SortColumn('A',2,'Z',65000,'B');
to freeze panes and sort the column B from row 2 and on...
Refference:
viewtopic.php?f=23&t=18606&start=0
Comments
As you are loading the buffer from a recordset sorted in Nav, load the buffer from last to first records, use SETCURRENTKEY, FIND('+'), REPEAT UNTIL NEXT(-1) = 0;
HTH
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com