How to force columns to wrap inside a band


I have spent a day at least trying to get this to work, with no success.  I have a master report with multiple subreports.  One of the
subreports gets data from a list, which has its own SQL query.  Everything works as far as the connection, passing parameters, etc.
The subreport is set up to use 5 columns.  Each column is a small image and a text field.  Again, this data comes through fine.  If
I run the subreport standalone, it looks pretty good, i.e., the data is correct and I also get the columns.

When I run the master report, however, the subreport in question will start to print at the bottom of one page, and the columns
kick in, but since it usually spills over to a new page, on the new page the first column goes all the way down the page.

What I really want I am starting to fear I cannot do, namely, force the entire subreport data to be in a "box" that will cause
there to be 5 columns.

I tried putting everything in a frame, hoping that would "force" what I wanted, but it will not.

It seems almost like that using columns to get the particular look I want (I am trying to duplicate another Access report)
may not be possible.  While the data does not change much, I still think using a dynamic list is the right way to go.  I just
want to force it inside a box where it will always wrap to 5 columns.

I have tried every combination of stretch type and band parameters, based on many Google searches, but 
cannot make this work.

Am I simply on the wrong track?  Any advice would be greatly appreciated.  I attached a screen shot from
what the subreport looks like stand-alone, which is good, but it will not print this way from the master report.



mitch_2's picture
Joined: May 3 2013 - 4:48am
Last seen: 5 years 11 months ago

1 Answer:



Actually in your scenario , I think split type "PREVENT" will help do that for the required bands and the split of a column when data overflows won't happen . Have you also checked Stretch with Overflow,if not then do that .

Hope that this helps.



Ankur Gupta

Ankur Gupta's picture
Joined: Jan 21 2013 - 10:36pm
Last seen: 1 month 6 days ago

Ankur, thanks for your reply, but I tried setting the split type for the subreport detail band to "prevent" (this is where the list lives), but it did not change the behavior at all. And I don't see any option called "Stretch with overflow" in iReports 5.0.4. Do you mean "stretch type"? If so, I tried setting it to "Relative to Band Height", as that sort of makes sense, but it did not change the behavior... IOW, on a new page, all of the list data flowed down the first column, even though the band height that contains the list is only 50.

I tried another idea that I thought might work, but it is behaving strangely as well. I tried to add a column break to the list, thinking I could use a "PrintWhen" expression to force a column break every 6 items, which would give me the look I want. The problem is that with the column break there, I get a null pointer exception consistently (but not without it!).

I have not been able to find much in the way of documentation about exactly how column break should be used, at least not in the main iReport docs and via Google.

One final item... I had wrapped the list inside a frame, thinking that the frame might be the way to "force" a bounded size, but obviously that did not work. I don't think it changes the behavior, but I wanted to mention id.

mitch_2 - 6 years 1 month ago