I'm using Jasper iReports 5.2.0 and I want to print a list on odd pages of the report and a static text on the even pages.
To achieve this I created a report with my query of a list with 100 sequential rows and put it in the Detail 1 and my static text in Detail 2.
Then I added:
Print When Expression = $V{PAGE_NUMBER}%2 != 0 to Column Header and Detail 1
and Print When Expression = $V{PAGE_NUMBER}%2 != 0 to Detail 2
and also maximized Detail 2 Band Height (without this I will loose more rows)
Everything show in the right pages but report aren't showing all rows.
I mean, if my query return 100 rows, 1-100
1st page show 1-20
2nd page show static text
3rd page show 22-40
4th page show static text
5th page show 42-60
...
What should I do so that row be printed in the right page?
You should do the following:
Create 2 Detail Bands:
a) Detail1 - For static even pages (!make sure this detail band is first). Maximize it's size - to use whole page, put your static text on it. Set PrintWhenExpression = $V{PAGE_NUMBER}%2 == 0 on band
b) Detail2 - For your data, do not use any PrintWhenExpressions on it
How it works: wholepage DetailBand1 is shown only on even pages, because it takes whole page, your data detail band (Detail2) is moved to even page, so everything works as expected, and no records are missed.
Related
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
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.
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)
I m using crystal report in vs2010.
I m generating Tax invoice report..in that, details section size is dynamic.
i.e. depend on number of records, it changes. so if i've 10 records the report view is full page that is k ..but if i have 2 records in details sections, then whole page footer section getting stick to details page..so whole alignment is getting change
Try changing the print at bottom of page property in the select expert. That should do the trick.
1)First of all fix height of detail section by right click on detail section ->section expert->New Page Before checked->beside button of (x+2) write formula(Suppose you want 7 records in per page and further on another page -> IF Remainder (RecordNumber, 8) = 0 THEN TRUE ELSE FALSE
2)under detail section (suppose section3) is your detail section then leave report section blank with needed space and else for footer put it in page footer .. i think this will solve your problem.. mine is solved..
In my case in the New Page Before checked add:
IF Remainder (RecordNumber, 18) = 0 THEN TRUE ELSE FALSE
My Title to this question is probably a little confusing, but let me try explain what happens.
Our company report template requires a header and a footer. The footer is displayed on every page, but the header should only be displayed on page 1.
To achieve this, we removed the header content from the report header and placed it at the top of the report above the Tablix. This produced the desired results, but we now have the issue where we get semi-blank pages.
Some background:
- The header of page 1 takes up about 5cm of the page.
- There are no overlapping controls on the page.
- InteractiveSize property: 21cm, 29.7cm
- Margins property: 1cm, 1cm, 0cm, 0.5cm
- PageSize property: 21cm, 29.7cm
Now lets say on page 1, there is X amount of space for the tablix data (Because of the header), but from page 2 to the end there is Y amount of space for tablix data.
The problem we get is when the total amount of data that should be rendered is between X and Y. The report then renders the 1st page with the header, but apart from that and the footer, the page is blank. Then on page 2, the Tablix will display the data.
If the amount of data is less than X or more than Y, then we have no problems; the report renders as expected.
Can anyone maybe point me in the right direction please?
Thanks
It sounds like the tablix's KeepTogether property is set to True so that when there isn't enough room on the first page but there is on the second page for the entire tablix, it then renders on the second page.
Set it False