Issue with Column footer and Summary bands

2019-03-28 12:34发布

问题:

I am creating invoices with JasperReports.

I have a Detail section that has the list of all items followed by a column footer which has Totals, Tax etc., and then the return policy in the Summary section.

I want to always ensure that the Detail is followed by Column footer followed by Summary bands. How can we ensure this? I found that sometimes the Summary comes before the Column footer.

Can someone throw some light on this?

回答1:

There really is not much of a solution to this at the moment as it seems to be by-design and not a bug (personally I think they should have an option for this). Your options at the moment though are:

  • Create a Report Group (this is essentially a dummy report group, doesn't really matter). Move your Column Footer contents into the Group Footer band, and leave your Summary in the Summary band. This seemed to work in my limited tests, and I would try it first.
  • Set Float Column Footer and Summary on new Page to true under the main report properties. This has the unfortunate side effect that the summary will always be printed on a second page regardless if everything could fit on one.
  • Set Float Column Footer to true and move your Summary section to the Last Page Footer band. This means it will only be printed once, but the content will be oriented towards the bottom of the last page.

Edit: For the shed some light on this part of the question. It is by design. The Column Footer is seen/treated as essentially a specialized Page footer. So body content (detail band, summary band, etc.) are placed on the page above it always. The only time it does not seem to happen is when the summary is printed on a new page, after the last Column Footer has been printed. So it is by design.



回答2:

I've been looking for answers to this silly formatting question for hours, and I think I might have found a useable solution:

  • move your Column Footer content to the Page Footer and,
  • create a Last Page Footer but set its width to 1 pixel with no content inside

This allowed me to have some borders/subtotals at the bottom of every column, whilst ignoring the footer-before-summary/total-before-subtotal problem on the last page because the Last Page Footer overwrites the Page Footer (summary) content.