Grouping of selected rows

Posted by: shuvendu-das on 8 September 2017, 1:34 pm EST

  • Posted 8 September 2017, 1:34 pm EST

    Hi,


    Is there any way we can group the selected rows based upon a common cell value in a windows application.i am using the version 4 of farpoint.


    Thanx and Regards


    Shuvendu Das


     


     

  • Replied 8 September 2017, 1:34 pm EST

    Shuvendu,


    There is not a way to group part of the Spread rows. You can do 1 of two things. You can either create a seperate Spread control with only the data from the selected rows and then group in that Spread control. Or you can use range grouping by using the AddRangeGroup method to add your own grouping of a set number of rows/columns.

  • Replied 8 September 2017, 1:34 pm EST

    Hi Scott,


    Thanx for ur reply.Can i get examples for those two ways that u have mentioned in ur reply.


    Regards


    Shuvendu


     

  • Replied 8 September 2017, 1:34 pm EST

    Shuvendu,


    1) First you need to move the data from the selected cells to the second Spread control.


       Dim cr as FarPoint.Win.Spread.Model.CellRange = FpSpread1.Sheets(0).GetSelection(0)
       For i as Integer = cr.Row to cr.Row+cr.RowCount -1 
          For j as Integer = cr.Column to cr.Column+cr.ColumnCount -1
             FpSpread2.Sheets(0).SetValue(i-cr.Row, j-cr.Column, FpSpread1.Sheets(0).GetValue(i,j))
          Next j
       Next i


    'Then you need to set up the grouping on the column you want


       Dim gm As New FarPoint.Win.Spread.Model.GroupDataModel(FpSpread2.Sheets(0).Models.Data)
       Dim si() As FarPoint.Win.Spread.SortInfo = New FarPoint.Win.Spread.SortInfo() {New FarPoint.Win.Spread.SortInfo(1, True)}
       gm.Group(si)
       FpSpread2.Sheets(0).Models.Data = gm


    2) You can create a range group by using code like the following.


       Dim cr as FarPoint.Win.Spread.Model.CellRange = FpSpread1.Sheets(0).GetSelection(0)
       FpSpread1.Sheets(0).AddRangeGroup(cr.Row, cr.RowCount, True)


     

Need extra support?

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

Learn More

Forum Channels