A vertical overflow on a band with horizontal print order - jasper-reports

I have a report with this design:
There are columns called Składniki odżywcze (means: nutrients) in this report. Those columns are made using a data source and horizontal print order.
A content of each column is made using a subreport with this design:
This subreport grows vertically and when I have a lot of nutrients and they don't fit into a page I get net.sf.jasperreports.engine.JRRuntimeException: Subreport overflowed on a band that does not support overflow.. I read it's caused because I have horizontal print order and my content grows vertically too much.
What can I do now? I'd like the page was breaked and the rest of nutrients were displayed on the next page.

Related

Doesn't print borders column in a new page Jasper report

When column bigger than page this column stretch to a next page but other cells borders doesn't so I have full page of one column it looks horrible.
Do you know how to fix it?

How to setup a jasper report with any length of height?

Say that a jasper report should be generated to a thermal printer. The detail band may be 1 row or 200+ rows.
How to generate jasper report with its height fitting to the row count instead of printing white-spaces in the end?
Set the pageHeight to just one row and then use
isIgnorePagination="true"
When isIgnorePagination is true the report will be generated in a
single page.
Hence, if just one row, it will have the height of one row, if more rows it will not create new pages but generate a continues layout.
For example see: http://jasperreports.sourceforge.net/sample.reference/nopagebreak/

Jaspser Reports Detail Dyanmic Column Width

I have a JasperReport file with the basic header/detail/footer bands. In my Details, I have a Column Header row in a Grid Layout and a Detail Row, also in a GridLayout. I'm having a few issues with this Detail section. I have 3 columns that I'm hiding with an expression using printWhenExpression=$P{Exp1}. This works to hide the field, but the rest of the columns in the detail section don't adjust to this. So I'm left with a giant blank column in the middle of my detail section.
I'm coming from Crystal Reports where I could just suppress fields and the CR would adjust widths as necessary. I can't seem to find anything to do the same with JasperReports, which doesn't make much sense since I would expect a GridLayout to try and fill up the space as needed. So is there any way to have a table/grid like layout that will adjust column widths to fill the available space when a field is hidden.

Detail band resize dynamically vertically when textfield is NULL

I have a JasperReports report build with iReport. I have the normal Detail band but below i have a textField named observations there is sometimes the Observations textField is empty or NULL. I have put both inner components namely textfields, lines into frames something like.
I also set using Print When Expression the below frame the one who holds the Observations textField to appear only when there is data on it this is working very good but the space holds by the frame is still on the Detail and we are losing some space and it's kind annoyng to see this blank space.
Is it possible for the report to "delete" the idle space hold it by the hidden frame?
My report's design:
The generated result (PDF file):
I don't think it's possible to alter the height of a band depending on its content but you can actually have multiple detail bands. So add a new one, move your observation text field into it and set the print when expression of the second band.

How to wrap a detail band in Jasper Reports

I have a detail band with potentially a lot of text fields in it. It can get too wide to fit on a page. The result is that it just runs off the edge of the page and you can't see it all. I'd like the detail band to wrap around to another line. Is there any way to do this?
My detail band is built dynamically in the code and the number of fields can vary. I tried manually placing the overflowing fields lower in the band by setting their y values, but then if the text in the fields overflows into two lines, my height calculations are off and the results get really messed up.
So is there any way to constrain the band to fit on the page?
Unfortunatelly, the strech types in jasper only works between bands, not within the band.
You can't (even manualy) create a jrxml which will cause a lower element in a band be correctly possitioned when an upper element overflows.
You will need to create more than one detail band. In iReport, you use 'Add another detail band' (on the detail band context-menu). Dynamically, it would look something like:
JRDesignSection detailSection = (JRDesignSection)design.getDetailSection();
JRDesignBand detail2 = new JRDesignBand();
detailSection.addBand(detail2);
Perhaps on your reportElement for each field in the band you need to set the attribute stretchType="RelativeToTallestObject".
<reportElement stretchType="RelativeToTallestObject" ...>
I'm pretty sure that's what works for me.