Hi,

I've been working on a report and it has 2 subreports, one of them can outgrow the region destinated for it (on a preprinted paper), and I want to break the subreport on a new page of the main report (with page header and page footer).

How can I accomplish this? If anybody can give me a hint, or even better can make a rpt sample of my case would be appreciated.

Thanks!

Dani AI

Generated

Short diagnosis and context (adds to / discussion)

The behavior described by (a subreport “jumping” to a new page and leaving a large blank area) is usually caused by Crystal’s layout rules — most often the subreport object or its containing section has a “keep together” option set so Crystal will move the whole subreport if it won’t fit the remaining space. That is why simply setting NewPageBefore in the subreport header often appears ineffective: the object/section-level keep settings are evaluated first. (userapps.support.sap.com)

Practical fixes (in order of least-to-most invasive)

  1. Isolate the subreport in its own section (Insert Section Below). Use the subreport’s Format -> Subreport tab and the main-report Section Expert to enable “Suppress Blank Subreport” / “Suppress Blank Section” when appropriate. This makes paging and suppression decisions predictable. (crystalreportsonlinetraining.com)

  2. On the subreport object: Format Subreport -> Common -> uncheck “Keep Object Together”. In the Section Expert for the section holding the subreport, uncheck “Keep Together”. This usually stops Crystal from forcing the entire subreport to the next page and lets it continue across pages while keeping main page headers/footers. (userapps.support.sap.com)

  3. If the requirement is “always start the subreport on a fresh main-report page” then set New Page Before on the main report section that contains the subreport (not inside the subreport). To avoid a blank first page, make the NewPageBefore conditional (for example: Not OnFirstRecord). Be aware that NewPageBefore/NewPageAfter on suppressed subreport sections can behave oddly — that is documented. (userapps.support.sap.com)

  4. If the action must be conditional only when the subreport will overflow the remaining space, use a two-pass approach: run a tiny/hidden copy of the subreport early to set a shared variable (record or page count), then use that variable in a conditional NewPageBefore for the visible subreport. This works but forces the subreport to run twice (performance cost) and requires correct placement of the retrieval formula beneath the subreport section. (userapps.support.sap.com)

Note about the preprinted background

For a preprinted-page background, put the image in a Page Header section (PageHeader b) and use “Underlay Following Sections” so it sits beneath the data — but test carefully: underlay can change how sections render and may require suppressing or adjusting the Page Footer. (userapps.support.sap.com)

Quick checklist

  • Move subreport to its own subsection and set Suppress Blank Subreport / Suppress Blank Section. (crystalreportsonlinetraining.com)
  • Format subreport object: uncheck Keep Object Together; uncheck section Keep Together. (userapps.support.sap.com)
  • If always-new-page desired: set New Page Before on main-report section (use Not OnFirstRecord to avoid blank first page). (userapps.support.sap.com)
  • If dynamic decision needed: implement hidden first-pass subreport to set shared vars, then conditionally page-break the visible subreport (expect double execution). (userapps.support.sap.com)

These steps reconcile the usual Crystal pagination rules and the underlay/background behavior that commonly cause the symptom described in the thread.

Recommended Answers

All 2 Replies

Set NewPageBefore=true of details section of Main report and set same property report header section of sub-reports.

Thank you very much for your answer adapost, but I have no luck with your solution, maybe if I clariffy some things about my report...

I'm assuming that the subreport is in the details section, and the other fields are in a separated details section.

I have an image in a separated details section as a background (underlay following section setted) because I'm printing on a preprinted paper.

Then i have multiple details sections and one of them is the subreport.

That's how I put it:

report:
----------detail 1-------- <---------- underlay following sections
| BACKGROUND |
|----------detail 2--------|
|some fields (headers)|
|----------detail 3--------| <-------------- NewPageBefore
| subreport |
| (this is my problem) |
|----------detail 4--------|
| another fields and a |
|subrpt(not problem) |
----------------------------

subreport:
--------page header --- <-------------- NewPageBefore
| (suppressed) |
----------detail----------
| |
---------------------------

What is wrong there? and thankyou again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.