When I exclude some bands of a jasper report, the space occupied by the band remains in the report.

Excluding the column header band in "pdf" format:

<property name="net.sf.jasperreports.export.pdf.exclude.origin.band.1" value="columnHeader"/>

design preview of report

enter image description here

The band dissapears when I execute the report in "pdf" format, but the space occupied by the band remains. What property can I use to dissapear this space?

report in pdf format

enter image description here

I tried to search here: http://jasperreports.sourceforge.net/config.reference.html

but I didn't find nothing.

Thanks in advance !

Running JasperStudio 6.1.0

Shared the code:

<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" name="prueba" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b485b6e8-ac97-4fa7-925e-bc8eadd2ede2">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="TEST - BACK"/>
<property name="net.sf.jasperreports.export.pdf.exclude.origin.band.1" value="columnHeader"/>
<property name="net.sf.jasperreports.export.pdf.exclude.origin.band.2" value="pageHeader"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
        <pen lineWidth="0.5" lineColor="#000000"/>
        <topPen lineWidth="0.5" lineColor="#000000"/>
        <leftPen lineWidth="0.5" lineColor="#000000"/>
        <bottomPen lineWidth="0.5" lineColor="#000000"/>
        <rightPen lineWidth="0.5" lineColor="#000000"/>
    </box>
</style>
<subDataset name="prueba1" uuid="f785d797-82b8-4b13-9f91-ebf5ed79028a">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TEST - BACK"/>
    <queryString>
        <![CDATA[SELECT * FROM ACTEUR where devcode = 'USD']]>
    </queryString>
    <field name="ACTID" class="java.math.BigDecimal"/>
    <field name="UGECODE" class="java.lang.String"/>
    <field name="CJUCODE" class="java.lang.String"/>
    <field name="LANCODE" class="java.lang.String"/>
    <field name="UTICODECREAT" class="java.lang.String"/>
    <field name="PAYCODE" class="java.lang.String"/>
    <field name="ACTCODE" class="java.lang.String"/>
    <field name="ACTLIBCOURT" class="java.lang.String"/>
    <field name="ACTNOM" class="java.lang.String"/>
    <field name="UTICODEMAJ" class="java.lang.String"/>
    <field name="NAFCODE" class="java.lang.String"/>
    <field name="DEVCODE" class="java.lang.String"/>
    <field name="ACTNOM2" class="java.lang.String"/>
    <field name="ACTSIRET" class="java.lang.String"/>
    <field name="ACTFLAGTAXPROF" class="java.math.BigDecimal"/>
    <field name="ACTDTCREAT" class="java.sql.Timestamp"/>
    <field name="ACTDTMAJ" class="java.sql.Timestamp"/>
    <field name="ACTTVACE" class="java.lang.String"/>
    <field name="ACTCODERCM" class="java.lang.String"/>
    <field name="ACTFINMOISFISC" class="java.math.BigDecimal"/>
    <field name="ACTNUMRCM" class="java.lang.String"/>
    <field name="ACTMEMO" class="java.lang.String"/>
    <field name="ACTCAPITAL" class="java.math.BigDecimal"/>
    <field name="ACTLIBCHEQUE" class="java.lang.String"/>
    <field name="ACTREGIMETVA" class="java.lang.String"/>
    <field name="ACTFLAGAGREMENT" class="java.math.BigDecimal"/>
    <field name="ACTRATTACHEMENT" class="java.lang.String"/>
    <field name="ACTDTIMMATRICULATION" class="java.sql.Timestamp"/>
    <field name="ACTEFFECTIF" class="java.math.BigDecimal"/>
    <field name="NACCODE" class="java.lang.String"/>
    <field name="ACTFLAGNONDECLASSABLE" class="java.math.BigDecimal"/>
    <field name="DOMCODE" class="java.lang.String"/>
    <field name="ACTFLAGGROUPE" class="java.math.BigDecimal"/>
    <field name="ACTDTDEBNAF" class="java.sql.Timestamp"/>
    <field name="PAYCODENAF" class="java.lang.String"/>
    <field name="PAYCODECATJURIDIQUE" class="java.lang.String"/>
    <field name="ACTTYPE" class="java.lang.String"/>
    <field name="ACTCHANNEL" class="java.lang.String"/>
    <field name="ACTCHANNELCODE" class="java.lang.String"/>
    <field name="ACTEXTDEPARTMENT" class="java.lang.String"/>
    <field name="ACTDTEXTHIRING" class="java.sql.Timestamp"/>
    <field name="ACTRESIDENTCODE" class="java.lang.String"/>
    <field name="ACTREPRESENTATIVE" class="java.lang.String"/>
    <field name="ACTREPRESENTNAME" class="java.lang.String"/>
    <field name="ACTCORPORATE" class="java.lang.String"/>
    <field name="ACTFLAGGUARANTOR" class="java.math.BigDecimal"/>
    <field name="ACTQUALIFCLASS" class="java.lang.String"/>
    <field name="ACTETAT" class="java.lang.String"/>
    <field name="ACTEIN" class="java.lang.String"/>
    <field name="ACTBRANDTYPE" class="java.lang.String"/>
    <field name="ACTCARDTRANSACTION" class="java.lang.String"/>
    <field name="ACTCARDMANAGEMENT" class="java.lang.String"/>
    <field name="ACTIDENTIFICATIONKEY" class="java.lang.String"/>
    <field name="ACTFLAGPROSPECT" class="java.math.BigDecimal"/>
    <field name="ACTIDSERVICING" class="java.math.BigDecimal"/>
    <field name="ACTACQUISCODE" class="java.lang.String"/>
    <field name="ACTTAXSYSTEM" class="java.lang.String"/>
    <field name="ACTTAXIDENTIFIER" class="java.math.BigDecimal"/>
    <field name="ACTCLASSIFICATION" class="java.lang.String"/>
    <field name="ACTFINANCIALCATEGORY" class="java.lang.String"/>
    <field name="ACTREGISTRATIONTYPE" class="java.lang.String"/>
    <field name="ACTREGISTRATIONREFERENCE" class="java.lang.String"/>
</subDataset>
<queryString>
    <![CDATA[select * from acteur]]>
</queryString>
<field name="ACTID" class="java.math.BigDecimal"/>
<field name="UGECODE" class="java.lang.String"/>
<field name="CJUCODE" class="java.lang.String"/>
<field name="LANCODE" class="java.lang.String"/>
<pageHeader>
    <band height="65" splitType="Stretch">
        <staticText>
            <reportElement x="290" y="20" width="100" height="30" uuid="188f128c-f984-4262-bb94-e8cb69f28526"/>
            <text><![CDATA[test]]></text>
        </staticText>
    </band>
</pageHeader>
<columnHeader>
    <band height="97" splitType="Stretch">
        <staticText>
            <reportElement x="220" y="50" width="100" height="30" uuid="b3121397-612d-411f-854a-bca18ad14721"/>
            <text><![CDATA[test]]></text>
        </staticText>
    </band>
</columnHeader>
<detail>
    <band height="105" splitType="Stretch">
        <printWhenExpression><![CDATA[$V{REPORT_COUNT}==1]]></printWhenExpression>
        <componentElement>
            <reportElement x="90" y="20" width="600" height="60" uuid="01196f11-97f3-48da-a079-510b9679fa15"/>
            <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                <datasetRun subDataset="prueba1" uuid="86d1d4f4-3d29-42fa-a59a-0919e21ad764">
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                </datasetRun>
                <jr:column width="150" uuid="fae72743-477b-4176-bbd1-23bd9ec1fd71">
                    <jr:columnHeader style="Table_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="150" height="30" uuid="ebe336c0-2de8-4a2e-b14b-73c85f930556"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[ACTID]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="150" height="30" uuid="7a6d92da-219f-4e80-8e46-151335baff8b"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{ACTID}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="150" uuid="2f3999bb-9a48-47fd-a39f-7b1e6e880e45">
                    <jr:columnHeader style="Table_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="150" height="30" uuid="80082491-b695-49eb-956a-cfa83f6e1289"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[UGECODE]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="150" height="30" uuid="20c8dc1a-0689-42c3-9337-2fc3fcea3948"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{UGECODE}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="150" uuid="098e350f-b6a6-4d60-87c3-5d7d06c8ba29">
                    <jr:columnHeader style="Table_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="150" height="30" uuid="f7cf6e8a-8d30-431a-9e73-316b0d29940f"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[CJUCODE]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="150" height="30" uuid="578599c0-7cb8-4e5f-b59b-d63f14da5eba"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{CJUCODE}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="150" uuid="293f430b-703c-47a6-9315-936e3602f810">
                    <jr:columnHeader style="Table_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="150" height="30" uuid="00af8106-9536-404f-ae91-4c556c679119"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[LANCODE]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="150" height="30" uuid="9db92757-8c19-4645-900a-3bb6c176e1a5"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{LANCODE}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
            </jr:table>
        </componentElement>
    </band>
    <band height="153">
        <printWhenExpression><![CDATA[$V{REPORT_COUNT}==1]]></printWhenExpression>
        <componentElement>
            <reportElement x="110" y="20" width="482" height="60" uuid="195b4833-9459-4616-a72f-1b90c791bf83"/>
            <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                <datasetRun subDataset="prueba1" uuid="0f2c2905-3751-403b-b8de-16956e175185">
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                </datasetRun>
                <jr:column width="160" uuid="5a1c704b-4bb9-4aea-8b11-3323b13c655f">
                    <jr:columnHeader style="Table 1_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="160" height="30" uuid="f848c7e8-f49e-4b46-a639-6ca657a21094"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[ACTCODE]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table 1_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="160" height="30" uuid="4c92fb08-1fa8-461f-b9a5-df772088d7d3"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{ACTCODE}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="154" uuid="9d92ab0e-981f-4e30-9f4a-b223b2210c86">
                    <jr:columnHeader style="Table 1_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="154" height="30" uuid="26ff8113-1597-40e3-8ffc-616b7556dfd4"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[ACTLIBCOURT]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table 1_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="154" height="30" uuid="96100270-bd35-431d-865c-b9ddd4878b76"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{ACTLIBCOURT}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="168" uuid="4e9416c3-fb52-4d10-8350-f3e9fee2b61a">
                    <jr:columnHeader style="Table 1_CH" height="30">
                        <staticText>
                            <reportElement x="0" y="0" width="168" height="30" uuid="85a46542-ef39-445e-a174-be0ce13d1123"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <text><![CDATA[ACTNOM]]></text>
                        </staticText>
                    </jr:columnHeader>
                    <jr:detailCell style="Table 1_TD" height="30">
                        <textField>
                            <reportElement x="0" y="0" width="168" height="30" uuid="f8a0b8ea-84fe-44af-ace2-217e82e4756f"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle"/>
                            <textFieldExpression><![CDATA[$F{ACTNOM}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
            </jr:table>
        </componentElement>
    </band>
</detail>

1 Answers

0
Rathnayake On

another way for disappears the band in a jasper report, set band "Height" property to 0

<columnHeader>
    <band splitType="Stretch"/>
</columnHeader>

put the elements (Static Text, Text Field etc..) in the band and relevant data not coming with data set, appears the empty space in a jasper report. we can remove this empty space by set the "Remove Line When Blank property" to true of the relevant element.

<staticText>
    <reportElement x="290" y="20" width="100" height="30" isRemoveLineWhenBlank="true" uuid="188f128c-f984-4262-bb94-e8cb69f28526"/>
    <text><![CDATA[test]]></text>
</staticText>