2
votes

I have a crystal reports with grouping, there are about 3 to 4 groups per page.

But at the end of the page a group is split between two pages, and sometimes there is only the group name, but the group details are on the other page.

I was wondering if there is a way to force ONLY the group that spans 2 pages to start at the next page.

I'm using the C# with visual studio 2008.

Regards,

2

2 Answers

1
votes

The simple answer is to start a new page on each change of group.

There isn't an easy way to determine whether the combination of group header, group details and group footer would be split over two pages (so that you can then start a new page for the group header). The normal way to deal with this is to check the "keep together" option in each of the group sections (as described by Kangkan), and to repeat header items where necessary in page headings.

There is a complicated way to do this - by determining how much has already been printed on the current page, then calculating how large the next combined group will be and entering a conditional formula in the Group Header section against the New Page Before option. However, it is quite tricky to write and hard to maintain, as the conditional paging formula will need to be re-written if there is any change to the length of any of the sections in question.

EDIT - repeating group header items in page headers -

Say you wanted to repeat the grouping item under the column headings, where a group was split over two pages:

  • Split the existing page heading section into two subsections, with the column headings in the first subsection;
  • Add the grouping item to the second page heading subsection;
  • In the section expert, set the conditional formula for the Suppress (No Drill-Down) option for the second page heading subsection to be RecordNumber = 1 or Previous ({fieldname}) <> {fieldname}
1
votes

There is an option to set it and it is called "Keep together". See the property page (in the section expert) for the group and check the "Keep together" option. This will solve your issue.

Also, there are options for "New page before" and "New page after" for every section. You can insert a page break accordingly.

alt text

As Mark said, it is very complicated to find out whether a group (along with its content and footer) will be accommodated in the remaining part of the page. So, the natural way is to start a group from a new page and to repeat the group in the page header if required.