Home Forums WinForms controls Xceed Grid for WinForms Printing Filtered and/or Grouped Grid Rows

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15142 |

    Hello,

    The GenerateReportForm does everything I need except for one thing. By default, it reports all the rows in a Grid and ignores filtering and grouping. There are lots of ways to get part way there (GetSortedDataRows, ugly cell-by-cell copying to a new Grid instance, etc.), but nothing I can see makes this easy or is do-able for large datasets. Any directions you can suggest would be greatly appreciated.

    Thank you.

    Imported from legacy forums. Posted by John (had 2225 views)

    User (Old forums)
    Member
    Post count: 23064

    First, groups should not be ignored when using the Reporting classes. Printed rows should be grouped, just as they appear in the gird.

    As for filtering, if you filter by setting DataRow.Visible = false, you will also need to set DataRow.ReportStyle.Visible = false, so Reporting prints the same rows the grid does.

    The ReportStyle property of any grid element permits you to set up how the grid will be printed using Reporting.

    Imported from legacy forums. Posted by André (had 198 views)

    User (Old forums)
    Member
    Post count: 23064

    I solved my problem. I’ve posted for your knowledgebase.

    To Group:

    For Each group As Xceed.Grid.Group In MyXceedGrid.Groups
    group.ReportStyle.KeepTogether = True
    Next group

    For reporting only checked “Select” checkboxes that are unbound to the underlying grid:

    For Each dataRow As Xceed.Grid.DataRow In MyXceedGrid.DataRows
    If True.Equals(dataRow.Cells(“Select”).Value) Then
    dataRow.ReportStyle.Visible = True
    Else
    dataRow.ReportStyle.Visible = False
    End If
    Next dataRow

    For reporting filtered records, this is unnecessary because the user will use the checkboxes to select the records he/she wants. Filtering just gives him/her a faster way to view a subset of data, especially when the database is large.

    Imported from legacy forums. Posted by John (had 3435 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.