iReport - How to prevent texfield go to next page - jasper-reports

I need help!
When Textfield Text is too big and does not fit all the content on the page, it is automatically moved to the next page, can anyone help?
The result is the following:
The structure of the report is as follows:
structure of the report
The expected result would be to completely fill the first page, and then break to next.

You can manage your detail band selecting it and change the property Split type as the following image:
The meanings of three options:
STRETCH:
The band is allowed to split, but never within its declared height. This means the band splits only when its content stretches.
PREVENT:
Prevents the band from splitting on first break attempt. On subsequent pages/columns, the band is allowed to split, to avoid infinite loops.
IMMEDIATE:
The band is allowed to split anywhere, as early as needed, but not before at least one element being printed on the current page/column.
You can see here

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.

Footer printed when page number is pair. Leaves blank space on other pages

I'm having some issues with JasperReports. I have a page footer that only prints when $V{PAGE_NUMBER}.intValue() % 2 == 0 .
This works correctly, but the main issue is that the page footer always occupies its fixed height, wether it is printed or not.
This behaviour makes me really sad, because my boss wants "these to be done well and for yesterday", but that extra space on unpair pages is making my reports not really very good looking: my page footer is really tall (height of 200px, more or less) and the blank space it leaves on odd pages is too big.
I tried almost everything I could read regarding this issue, but couldn't find a solution. I tried to move the contents of the page footer to a detail band and try to print that band at the bottom of the page when the page number is odd, but this solution didn't really work.
I would appreciate any kind of help. Please reply or my boss kills me.
The pageFooter and columnFooter are bands that do not allow overflow, the report engine calculates there size not on content but on band height which means that they will always be present with the band height you set...
Quoting Teodord jasper report staff
"I'm afraid there is no solution for what you want to achive"
This is in fact why jasper report introduced lastPageFooter, to enable the possibility to have a footer only on last page. Furthermore there was a feature request for firstPageFooter.
But it has been closed, no changes required, use negative coordinates, background band...
Conclusion:
You need to re-think you report structure, is there any logical grouping on which you can add a groupFooter you can stack it to the bottom footerPosition="StackAtBottom", or leave it as it is and go home ; )
Don't try to foul jasper report by grouping on $V{PAGE_NUMBER}.intValue() % 2 == 0, unfortunately it will not work..., you need to find
a logical grouping within your fields (data) or
on the number of records present in page $V{PAGE_COUNT}>20 or
something like $V{PAGE_COUNT}>15 || ($V{PAGE_NUMBER}%2==0 && $V{PAGE_COUNT}>10) that actually works breaking differently every odd page, leaving you the space after 15,10 records.. (note space is not really controlled if you isStretchWithOverflow="true" on the textField in detail band)
so go home....

ActiveReports 3 - Underlay Next property gets section partially printed

I have a report that has two headers. On the top one I have a subreport on the right side, that shows the report's main data. On the header below, I have two subreports. The one on the left has tabular information while the one on the right has more form-type info. This last subreport is set to match the upper header report width and position on the page.
Now, the top header is set as UnderlayNext = true, so it gets printed side by side with the tabular report. All is well except when the footer section of the subreport on the left does not fit on the page it is supposed to be printed and is moved to the next page. When that happens, the upper header section only gets partially printed, with the same height as the footer section of the other report.
EDIT: Rethinking (but not retesting) I think that what's going on is that the section set to underlay next does not go beyond the next section, thus when the section is not large enough, it gets cropped. In my case, the second section is larger than the UnderlayNext (top) one, but as I have a new page and the top section is set to repeat on every page, it gets cropped too. Funny thing is that if I select the data on the generated PDF, the information IS there, just not visible.
It would be suggested to set the KeepTogether property to "True" and the GroupKeepTogether property to "All" of the GroupHeader.
Regards,
Mohita
What I finally did was to add an empty group footer section with size zero at the bottom of the report and set PrintAtBottom to true.

iReport: how to hard fix a detail band's height, independent of it's content

I use iReport and I try to fix a detail band's height independently of its content. My problem is that if one of my text fields has more than one line, the band "grows" and because of this I get a second page.
So is there any possibility to hard fix the height of a detail band?
Try setting the stretch type for the text field to "No Stretch" and the split type (see the properties menu) for the detail band to "Prevent".
Since we could not find any direct options, We are doing this in an indirect method, having PLSQL Procedure for data fetching, different sub-datasets are used for filling fixed height detail areas, so each fixed datasets are filled with max.rows which it can accomodate (within sub procedures). Hope it helps someone.

Border in Detail band

I have a question about how border should display in detail band, and I would like to get some help.
Say, a column in detail band that might have LOTS data, by lots, I meant sometimes a single record might actually took 2~3 page to display.
Now customer ask that we should make report always display bottom line of the border as long as it meets end of page (even this record its not end yet)
What I tried:
Make a column footer with 1px height line.
Set "Floating column footer" to TRUE.
Result : It works great, but this line will make extra empty space at end of the table if there is a Summary band after the column footer. I think I am close, but I just can't get rid of the strange empty space
Make a Frame with border, set "Print when detail overflow" to TRUE then put everything in detail band into this frame.
Result : Not work as I expected :(
Since this report contains not just a table in detail band, and the height of the table are random. Tricks like a border in Background or Page Footer are not suitable here
What else can I do ?
There is a PrintWhenExpression trick that can help with the page footer:
How to hide Page X / Y when report is 1 page ? - JasperForge Forum
The trick is to put a flag in the Report Parameter Map, then use the flag to decide whether text (or fields, lines, etc.) should be printed.
To use a line in Page Footer there will always be some pages with extra line. In this case, the report is always starting from page 1, and the table in the report always end before printing the Summary band. That means, the line is no longer necessary as long as Summary band has been reached. Thus:
Add a line in Page Footer with PrintWhenExpression :
new Boolean(!(Boolean.TRUE).equals($P{REPORT_PARAMETERS_MAP}.get("stopFlag")))
Then make a dummy textField in Summary band with PrintWhenExpression like this :
$P{REPORT_PARAMETERS_MAP}.put("stopFlag",Boolean.TRUE)
This trick works, but might need some tweaking for different layouts.
The option given by Dave is right.
If you care about the space still being used, then set the band and textfield heights to zero.
In my case using Dave's option worked (and I needed no extra space to be used).
I put this as PrintWhenExpression in the fields I just wanted to show in the last page:
$P{REPORT_PARAMETERS_MAP}.get("lastPage")!=null
And this as PrintWhenExpression in a 0-height textfield in the 0-heigth summary band:
$P{REPORT_PARAMETERS_MAP}.put("lastPage",":)")
When it comes to page termination the options are limited. Its made even hard because if you have items that do not display when null it still assumes that space is used.
I would stick with messing around with the column footer or page footer as your best options.