Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jasper report blank bands still takes up space

My problem is that even though the line is blank it still takes up the space of the height of the band and thus there is a larger gap than usual before the next band.

The band in my jasper file looks like this:

<band height="30" splitType="Stretch">
    <staticText>
        <reportElement uuid="274e9a4d-939e-46f6-8508-52ebc9051180" x="0" y="10" width="515" height="20" isRemoveLineWhenBlank="true" forecolor="#111B3F">
            <printWhenExpression><![CDATA[$F{projects_count} != "0"]]></printWhenExpression>
        </reportElement>
        <textElement verticalAlignment="Top">
            <font fontName="Arial Black" size="14" pdfFontName="jasper/fonts/ARIBLK.TTF"/>
        </textElement>
        <text><![CDATA[Project experience]]></text>
    </staticText>
</band>

Here I have text staticText that should only display when <![CDATA[$F{projects_count} != "0"]]>. This works. On the reportElement I also set isRemoveLineWhenBlank="true"

Since the height is set to 30 it still takes up space in my report and I can't seem to figure out how to not only not display the text but also remove the band in a way if it does not meet some condition.

like image 203
Hendri Potgieter Avatar asked Oct 21 '25 05:10

Hendri Potgieter


1 Answers

Hendri -- am I understanding that you have set the Print When expression on the text field within the band? Set the Print When expression for the whole detail band instead.

 <band height="30">
     <printWhenExpression><![CDATA[$F{projects_count} != "0"]]></printWhenExpression>
            <textField> {... etc}
like image 143
Lisa Avatar answered Oct 25 '25 13:10

Lisa