0
votes

I have a C#.NET WPF application that renders a SSRS report. The report has a parent grouping which I would like to apply a SSRS conditional page-break on based on its child data. The page-break function works well in that each parent grouping is place on a new page; However that could be page consuming when there is not a lot of child data for each parent.

My problem is to write a conditional page-break that will check if a parent grouping has enough child data to fit on the a page, the same applies to the next parent grouping, and so on, but if the parent grouping contains to much data to fit on a page only then apply the page-break.

1

1 Answers

0
votes

As you wish to display it in a WPF application only, you can define a maximum page size for the report viewer with the InteractiveSize property. The height you define there will determine what you find is "too much data to fit on a page" and break accordingly.
For exporting to a printable format, the PageSize propery will react the same way. But this allows you to have a different size when using the report viewer, because you might want more to be shown on a single page.

InteractiveSize - Page Property

With those settings the report viewer will place as much possible data on the defined space and break to a next page when the boundary is exceeded.

If you do not wish to split groups then you must wrap them inside a Rectangle because there you can set the property KeepTogetherto true, which will add a page-break between groups if there is no space for both groups on the same page.

KeepTogether - Rectangle Property

When working with tables, you can use the following method to wrap the groupings in rectangles correctly:

  1. Place "List" control on the report.
  2. Set its "DataSetName" property to your dataset name.
  3. At the design view, right click on the list and then select "Row group".
  4. At "Group Properties" window, click "Add" button under "Group Expressions:" title and then choose field name that you want to group within a page.
  5. After that you can place "Table" control for your detail data inside the row group.
  6. Once you render the report, report will keep data inside the group together between page break.

Source: https://stackoverflow.com/a/15656441/4579864

I hope this solves your problem. If you have any more questions, just leave a comment.