sorting rows on more than one column

Posted by: parez81-fp on 8 September 2017, 1:12 pm EST

  • Posted 8 September 2017, 1:12 pm EST

    Hi

    Is it possible sort rows on more than one column??
    Programmticallyl and using the grid?

    I currently use

     ui_userList.ActiveSheet.SortRows(2, true, false);

  • Replied 8 September 2017, 1:12 pm EST

    You can create a sortinfo:

    fpSpread1.ActiveSheet.SetValue(0, 0, "S"); 
    fpSpread1.ActiveSheet.SetValue(0, 1, "E"); 
    fpSpread1.ActiveSheet.SetValue(0, 2, "A"); 
    fpSpread1.ActiveSheet.SetValue(0, 3, "K"); 
    fpSpread1.ActiveSheet.SetValue(1, 0, "W"); 
    fpSpread1.ActiveSheet.SetValue(1, 1, "G"); 
    fpSpread1.ActiveSheet.SetValue(1, 2, "P"); 
    fpSpread1.ActiveSheet.SetValue(1, 3, "V"); 
    fpSpread1.ActiveSheet.SetValue(2, 0, "O"); 
    fpSpread1.ActiveSheet.SetValue(2, 1, "L"); 
    fpSpread1.ActiveSheet.SetValue(2, 2, "Q"); 
    fpSpread1.ActiveSheet.SetValue(2, 3, "H"); 
    FarPoint.Win.Spread.SortInfo[] sort = new FarPoint.Win.Spread.SortInfo[1]; 
    sort[0] = new FarPoint.Win.Spread.SortInfo(0, true, System.Collections.Comparer.Default); 
    fpSpread1.ActiveSheet.SortRows(0, 1, sort);

    or

    FarPoint.Win.Spread.SortInfo[] sort = new FarPoint.Win.Spread.SortInfo[1]; 
    sort[0] = new FarPoint.Win.Spread.SortInfo(0, false, System.Collections.Comparer.Default); 
    fpSpread1.ActiveSheet.SetValue(0, 0, "S"); 
    fpSpread1.ActiveSheet.SetValue(0, 1, "E"); 
    fpSpread1.ActiveSheet.SetValue(0, 2, "A"); 
    fpSpread1.ActiveSheet.SetValue(0, 3, "K"); 
    fpSpread1.ActiveSheet.SetValue(1, 0, "W"); 
    fpSpread1.ActiveSheet.SetValue(1, 1, "G"); 
    fpSpread1.ActiveSheet.SetValue(1, 2, "P"); 
    fpSpread1.ActiveSheet.SetValue(1, 3, "V"); 
    fpSpread1.ActiveSheet.SetValue(2, 0, "O"); 
    fpSpread1.ActiveSheet.SetValue(2, 1, "L"); 
    fpSpread1.ActiveSheet.SetValue(2, 2, "Q"); 
    fpSpread1.ActiveSheet.SetValue(2, 3, "H"); 
    fpSpread1.ActiveSheet.SortColumns(0, 2, sort);

Need extra support?

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

Learn More

Forum Channels