Jump to content
Changes to the Jaspersoft community edition download ×

removing whitespace when detail is full height


windowb18

Recommended Posts

I've tried searching through the forum, and can't find a similar situation to mine.

 

I have 2 subreports within my main report. Each of these subreports will have 1 to many lines.

 

My problem happens because I want to surround my entire detail section with a border. So in ireport, I'm dragging my detail section to as large as I can make it, and I've added lines to the left and right margins of it. My ireport therefore is a true representation of the full page and how it will look when it prints.

 

This results in a lot of whitespace between my second subreport and the bottom of the detail band. And my report is insisting on including this whitespace, so it's forcing it on to multiple pages.

 

If I didn't have the border, I'd pull the detail section up to directly under the second subreport, and let it expand it itself, but because I'm putting in this border, I need the report to be stretched to full capacity. (unless there's a way around this, but I haven't discovered it yet).

 

If I stretch my second subreport to the bottom of the detail section, and my first subreport is 1 line larger, it forces my entire second subreport on the second page.

 

Any help would be greatly appreciated.

 

Thanks!

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Hi!

They way you are creating the border, the white space is expected behaviour ...

 

Can't you just add a horizontal line to the bottom of the page header section, another one to the top of the page footer, and two vertical lines to the right and left of the detail section?

Make the vertical lines just as long as your detail section; they should be stretched automatically when needed.

 

Hope this works, haven't tried it ...

 

Yours,

Sebastian

Link to comment
Share on other sites

Thanks for the tip, but what I'm trying to do is make my detail band a set height. So no matter what size my 2 subreports are, the detail (with the surrounding border) will always be 5 inches tall.

 

So if the subreports fill it out, they would go right to the bottom of the detail band, and if there's only 1 line in each report, then I'd like the whitespace to the bottom of the detail band. But the lines surrounding it should be the same height - regardless of the number of lines within the detail.

Link to comment
Share on other sites

Okay, I think I've figured it out.

 

I've made the detail section as small as possible so it expands the way that it should - based on how many lines print in the 2 subreport.

 

To make the lines around the detail alway be the 5 inches I'm looking for, I put them in the background band. This will always print the same, no matter how many lines print in the detail.

 

The lines in the background start at the same height as my detail band, and end at the bottom of the detail band (if it was stretched out - which is 5 inches tall).

Link to comment
Share on other sites

I had a similar situation a while ago and just last week. :)

I was able to place a border around a textfield that stretches indefinitely by using a rectangle element.

Enclose the Subreport (or stretchable Text Field) within a Rectangle Element.

I made the enclosed element 2 pts smaller than the surrounding rectangle on all sides just to make sure.

Highlight both your subreport and the surrounding rectangle element, right click and group them together...

... Group Selected Element(s)

It may be better to reorder the elements so that the rectangle is behind your subreport element.

Set the Rectangle element values to the following:

In the Common tab:

Position Type = Float

Stretch Type = Relative to Tallest Object (IMPORTANT)

 

In Graphics Element Tab:

Set Pen = thin (or your desired border thickness)

Set Fill = (always on Solid)

If you want to remove the fill, uncheck transparent in the Common tab

 

 

If you want to have rounded corners set the value of

the corner radius in the Rectangle tab to a value > 0

 

This will give you a stretch border for your subreport.

 

One thing, however... you should test this by letting your subreport or text field overflow to the next page (easier to test with text fields). This way you will see how your border and subreport will look like in the event that you overflow the content of your bordered subreport (or text field) to the next page.

What I observed when doing this is that I get an unwanted space above my static text headers when I overflow content to the next page... but that's a different case for me. I'm thinking (hoping) it will work fine for you... hopefully. :)

 

Tell me if this worked, ok?

Link to comment
Share on other sites

If you make it the way I mentioned above, you could shrink your detail band to the correct size... and you don't have to worry about manually adjusting the heights of your elements.

However, if it is at all possible, I would go with what sebastian recommended... use lines instead.

I know that borders are better looking but I also found out that lines are more manageable in iReports for this particular case... well, at least for the time being.

 

Once again... I hope this helps.

 

 

- edwin

Link to comment
Share on other sites

  • 6 years later...

Hi all,

I'm Arun. I'm here since i posted a question on Extra White space at the bottom of each Detail Band and Admin shared this link, so i'm Arun we've been working jasper reports since 6 months, and we are working on 5.0.0 version. every detail band has some white space at the bottom and it is inconsistent, some times white space some times nothing.

     Fortunately We fixed it, and i'm willing to share it here. The problem was solved by simply increasing the RIGHT INDENT to 1 from 0.  Then no more extra space at the bottom of any detail band every band is neatly aligned with out space.  I thought this would help a few, but gives us pleasure of contribution. Please let me know your concerns as well.

Hope to see responses,

Arun

 

Link to comment
Share on other sites

  • 1 month later...

There is property isFloatColumnFooter on the document level. It should be true. In IReport you have to select Document element in the "Document structure" tree. In "Property" section you should check "Floating column footer" item.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...