Jasper Reports - how to get column footer to appea

2019-01-17 10:54发布

问题:

I'm trying to get a column footer band to appear directly below a details band.

The details band contains normally just 2 or 3 rows and thus should not be very deep. The footer always appears further down the page and not directly below the end of the content in the details band - therefore the details band is higher than the content it contains. How do I get the details band to collapse to the end of the content so I can get the footer to appear immediately afterwards.

I'm sure this is simply a case of applying some settings - but I can't determine what these are.

Thanks.

回答1:

In iReport set Ignore pagination to true in your main report's properties.

This should cause your footer to be render at the bottom of the content in your details band.



回答2:

You can try to set Column Footer Placement property. It is solved for me.

The quote from the JasperReports Ultimate Guide:

Column Footer Placement - The isFloatColumnFooter Boolean property lets users customize 
the behavior of the column footer section. By default, this section is rendered at 
the bottom of the page, just above the page footer. In certain cases, it is useful 
to render it higher on the page, just below the last detail or group footer on 
that  particular column. To do this, set the isFloatColumnFooter property to true.


回答3:

Set "Float column footer" property of report is better than "ignore pagination" in case that you want to keep format of page. There is shrink of view (for example PDF in not in A4 format) in case of ignore pagination. "float column footer" keeps format of page.



回答4:

For those, who don't use reporting tool (JasperSoft or older iReport) and directly work with XML, add isFloatColumnFooter to the <jasperReport> element.

<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN"
   "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport xmlns = "http://jasperreports.sourceforge.net/jasperreports"
              xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation = "http://jasperreports.sourceforge.net/jasperreports
   http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
              isFloatColumnFooter="true"
              name="report2" pageWidth="595" pageHeight="230" 
              columnWidth="555" leftMargin="20" rightMargin="20"
              topMargin="20" bottomMargin="20">

...
</jasperReport>


回答5:

Float column footer is the right setting here. If you still have space lost between the output of the detail band and te footer take care about other bands wasting space, like the summary does. If you don't need that bands remove them or set theit height to 0.