Page Header, Page counter and Page Footer layout not working - jasper-reports

I have a main report and a subreport i.e main.jrxml and sub.jrxml with the following problems:
On second page the current page number is not incremented
On second page and onwards the Title and Page Header are not fully removed
On last page the Disclaimer and page number is missing
.jasper file is not always re-generated for subreport in Jasper Studio, how can I make sure this is per default always re-generated
I run the reports with the Sample DB. How can I fix this?
CLARIFICATION:
For the page numbering on the TextField I use:
msg("Page {0} of {1}", $V{V_CURRENT_PAGE_NUMBER}, $V{PAGE_NUMBER})
V_CURRENT_PAGE_NUMBER is defined as follows:
Expression 1
Initial Value Exppression $V{PAGE_NUMBER}
Increment type Page
Reset type Report
In the end I used Composite Elements for both current and total page info.
UPDATE:
Point 2: Moved Page Header content into Title.
Point 3: I solved by repeating Disclaimer and page number also in Last Page Footer. I have it now in both Page Footer and Last Page Footer.

Use the Page X of Y element from the Composite Elements of the Palette view.
Only the Page Header repeats on subsequent pages. You can show it only on first page with a Print When Expression like: $V{PAGE_NUMBER} == 1
Duplicate the Footer elements in the Last Page Footer.
From the top menu select Project > Build Automatically

Related

Document band Occupying white space when not printed

I need to print a set of information on the bottom of my document's first page (right after detail band). Since the information printed on detail is too large, the document creates a pagination to display the rest of the information, but independent of what I use (Group,ColumnFooter,PageFooter,etc) to print the information tha should be printed on the first page only, this band keeps occupying a white space on consequent pages.
You can create a dummy group that would break with every record, but only while we are on the first page.
Such group would not have a group header or footer, but would use minHeightToStartNewPage with a value that would match the taller page footer required on the first page.
The group expression would look like the following:
$V{PAGE_NUMBER} == 1 ? $V{REPORT_COUNT} : null
This dummy group would cause a page break to occur upper on the first page, leaving more space for a larger page footer.
Now, the second trick is to place content in the page footer section, but at a position having a negative Y coordinate. By doing so, you can keep the height of the page footer section small, while being able to render content above it.
This content having negative Y inside the page footer would be printed conditionally, only on the first page, using the printWhenExpression.

Detail band with page break

I have a report that contains a page break in the detail section .
in the first part of the detail section (before the page break) i have put a subreport containing an image.
When running the report i have two pages (as expected ) but the image is displayed in both pages.Is there a tip to display my image in the first page only?
To test i moved it after the page break and it worked correctly (displayed the image in the second page only). Why the first method is not working on the first page only?
I resolved this issue by putting the subreport in the Column Footer band, and in the "Print when expression" of the subreport I used this expression to display it in the first pages only:
new Boolean($V{PAGE_NUMBER}.intValue() % 2 != 0)

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??
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).
In the initial tag:
<jasperReport
put:
isTitleNewPage="true"
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.
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.
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
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.
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.

Blank space at end of page

Background
A subreport with a column title and a detail section both set to 20px high.
When the subreport record displays on the main report, the subreport prints as expected until when it reaches at the bottom of the page.
Then the subreport prints just the column header and left blank space, then again starts on new page with column header and its detail.
Question
So, would you make it either print the whole subreport on same page, or start whole report from new page?
Master Report JRXML
http://pastebin.com/V2HRPWVL
Image of the problem faces
Thank You
Mihir Parekh
Another way to delete the last blank page that appears in the report, is eliminating the pagination of the report
Try set the Split Type of related band to Prevent. (Might be detail band)

Problem in Report Design Layout

I have a jasper report with 4 subreports in the detail band of the master report.
If data is available for first subreport, it starts displaying from page 1 with the header of the subreport. When second subreport starts printing data, it prints only header in page 1 and the page breaks and in the page 2, it prints header again n data for that.
I dont want the header of the second subreport to be printed in page1. It should start print in the page 2.
How to solve this..? How could i page break...?
its urgent.Please help.
Thanks in advance,
Prasanna
First start by separating each subreport in its own band. ie. Make a new group for each new subreport.
In the Add/modify group dialog, there is an option called Print Header on each page, try to check that