Export to excel with Descending Sorting Order

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

Why not set order in Report itself in DataItemTableView .Select Key and select the order as Descending

Hi amol[:D],

I want a report just like top 10 customer but this report should show all the customer sales(LCY).

I have used the data item Customer. From customer i am getting cust ledger entry from this i am getting the value entry.

I am doing this because the user want the transaction monthly. They want the cost amount also. so i am using the value entry. My problem is i cannot sort the report by sales (LCY) because its a flow field in customer.

So what i am trying to do is to export the data to excel with sorting like i want which cannot be done in preview. Customer is concerned about the Excel only.

I hope you will understand my situation. [:’(]