SortRows Not working for Range of data

Posted by: sangeetha.chellamuthu on 29 September 2023, 4:50 am EST

    • Post Options:
    • Link

    Posted 29 September 2023, 4:50 am EST

    Sorts a range of rows in the sheet according to the specified parameters.

    SortRows(startingrowIndex, No of Rows, sortInfo)

    sortInfo Contains the Index of Column to be sorted and sorting order Info.

    and spread Range given like

    Row = 0

    Col = Column to be sorted.

    Row2 = no of Rows

    Col2 = Column to be sorted or Number of Columns

    I am trying to sort 3 rows 4 column out of 4 rows and 4 columns Data, but sorting is not working.

    If any examples with SortRows will be helpful for my issue

  • Posted 3 October 2023, 4:14 am EST

    Hi Sangeetha,

    FpSpread’s SortRows method is used to sort a range of rows based on the column index passed to it. The API link for this method is as follows: https://www.grapecity.com/spreadnet/docs/latest/online-win/FarPoint.Win.Spread~FarPoint.Win.Spread.SheetView~SortRows(Int32,Int32,SortInfo[]).html

    We have created a sample application for your reference. See SortRows.zip

    The implementation is as follows:

    fpSpread1.ActiveSheet.SortRows(0, 3, new SortInfo[]{ new SortInfo(0, true), new SortInfo(2, true) });

    Here, the sorting starts from index ‘0’ [first parameter: row] and this will sort consecutive 3 [second parameter: rowCount] rows from starting index. Therefore, the row range for sorting in this case will be 0 to 2 ( 0 + (3-1)). The SortInfo parameter is an array of objects with the column indexes and sort order. In the above line of code, sorting is first done based on column index 0 in ascending order and then sorting is done based on column index 2. This is basically a multi-column sorting.

    The following API link shows you how to sort rows based on single column index: https://www.grapecity.com/spreadnet/docs/latest/online-win/FarPoint.Win.Spread~FarPoint.Win.Spread.SheetView~SortRows(Int32,Boolean,Boolean).html

    Hope this helps you!

    Thanks & Regards,

    Aastha

  • Posted 5 November 2023, 2:43 pm EST

    Thank You so much .its worked

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels