How to wrap a group of parts in Jasper reports

I have a detailed group with a potentially large number of text fields. It may be too wide to fit on the page. As a result, it simply runs away from the edge of the page, and you cannot see all this. I would like a group of parts to turn to another line. Is there any way to do this?

My data group is dynamically created in the code, and the number of fields can vary. I tried to manually place the overflow fields in the strip below, setting their y values, but if the text in the fields overflows in two lines, my height calculations are disabled and the results will really get messed up.

So, is there a way to limit the range to fit on the page?

+4
source share
2 answers

Unfortunately, strech types in yasser only work between groups, not within a group.

You cannot (even manually) create jrxml, which will cause the lower element in the strip to be correctly assigned when the upper element overflows.

You will need to create more than one group of parts. In iReport you use "Add another group of parts" (in the context menu of the detailed range). Dynamically, it would look like this:

JRDesignSection detailSection = (JRDesignSection)design.getDetailSection(); JRDesignBand detail2 = new JRDesignBand(); detailSection.addBand(detail2); 
+3
source

Perhaps on your reportElement element for each field in the group you need to set the stretchType="RelativeToTallestObject" attribute.

 <reportElement stretchType="RelativeToTallestObject" ...> 

I am sure what works for me.

+2
source

All Articles