Ihor M.
Ihor M.

Reputation: 3148

Jasper Reports subreport on a new page

I have a jasper report that consists of 6 subreports. Each of these subreports has its own title section. Now I need each report to start on the new page. I tried adding page breaks but it did not work for me.

While researching the problem I cam across a trick to set isTitleNewPage to true at http://www.dzone.com/snippets/jasperreports-subreport-new. So I added the attribute isTitleNewPage="true" to all the subreports, but now the subreport's Title remains on the previous page and Details and Summary of that subreport are being displayed on a new page.

How can i solve this problem??

Upvotes: 5

Views: 27730

Answers (7)

Sachin Sonawane
Sachin Sonawane

Reputation: 9

I solved it by add page break at the start of the sub report in the top side, no use "Print when expression" or anything else

Report formation: Master Report -> 1st page -> 2nd page -> Sub report -> (add page break on top) title+ 2 sub report -> master report end page

Upvotes: 1

Marking.SC
Marking.SC

Reputation: 3

I solved it by putting a page break at the beggining of each subreport, just before the title label and set 'new Boolean (true)' on the 'Print When Expression' property for each page break.

Upvotes: -1

Madhawa Madhuranga
Madhawa Madhuranga

Reputation: 47

Add a detail band for each sub report and go to the sub report properties and put a tick on Title on a new page.

Upvotes: -1

sromcevic
sromcevic

Reputation: 91

Simplest solution is to set runToBottom flag to true in subreport tags.

<subreport runToBottom="true">

This forces the subreport to fill the whole page, so the next subreport will start on a new page.

Flag isTitleNewPage won't do the trick because like you noticed, it will split the subreport's title band with the rest of the subreport content (unless you're using a blank title band).

Upvotes: 7

davidddp
davidddp

Reputation: 591

In the initial tag:

<jasperReport

put:

isTitleNewPage="true"

isTitleNewPage

Upvotes: 1

V G
V G

Reputation: 19002

My solution to this problem is to add every Subreport in a separate "Detail band" and then set the Band height to the biggest possible value (right click on the "Detail X Band" => "Maximize Band Height"). Between bands could be printed some blank pages, but that is not a big problem in my case.

Upvotes: 1

user3165251
user3165251

Reputation:

I had the same problem that the title remains on the previous page.

But I have a solution:

  • put the stuff from the title in the "page header" band
  • set isTitleNewPage="true"
  • add a Integer variable to the subreport with the initial value 0
  • inkrement type "page"
  • expression $V{vari} + 1
  • print when expression of the page header is $V{vari} == 0

Now u have your title stuff on a new page, but only one time.

Upvotes: 0

Related Questions