Jump to content

Recommended Posts

Posted

I have a jasperreport and I am trying to reduce the vertical size of its two frames. As you can see in this screenshot

Bildschirmfoto2015-12-23um17_04_48.png.b16a2296ce25a3c91d31f52a1aabebd1.png

The 3 frames (the surrounding frame and the two internal frames) are larger than the contents.

I have been struggling to reduce their size to the size of the contents but without success. Any ideas what I can do? The par1 = null, par2=2, par3=3, par4=4.

My jasperreport:

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  --><!-- 2015-12-23T17:08:07 --><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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>    <parameter name="par1" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par2" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par3" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par4" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <title>        <band height="80" splitType="Stretch">            <line>                <reportElement x="10" y="6" width="520" height="1" uuid="ebfc40ae-a2ee-40fc-b585-4236e9fa3c63"/>            </line>            <line>                <reportElement x="10" y="72" width="520" height="1" uuid="7657216f-1366-4455-adb0-db58e2333b5c"/>            </line>            <frame>                <reportElement x="329" y="10" width="172" height="59" isRemoveLineWhenBlank="true" uuid="0fbab6b3-f5ea-4716-b954-9371b4640781">                    <property name="ShowOutOfBoundContent" value="false"/>                </reportElement>                <box>                    <topPen lineWidth="0.4"/>                    <leftPen lineWidth="0.4"/>                    <bottomPen lineWidth="0.4"/>                    <rightPen lineWidth="0.4"/>                </box>                <frame>                    <reportElement positionType="Float" x="13" y="3" width="60" height="54" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="8a663ee5-c983-40f9-b85e-11bc852f46cc">                        <property name="ShowOutOfBoundContent" value="false"/>                    </reportElement>                    <box>                        <topPen lineWidth="0.4"/>                        <leftPen lineWidth="0.4"/>                        <bottomPen lineWidth="0.4"/>                        <rightPen lineWidth="0.4"/>                    </box>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="84504631-a04d-4f75-bcb2-9e20741f29ad"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>                    </textField>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="52c7e555-7e36-4992-8e59-b533fea31533"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>                    </textField>                </frame>                <frame>                    <reportElement positionType="Float" x="73" y="3" width="70" height="54" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="3a53c02d-6559-4c64-8ca8-21254b50435e">                        <property name="ShowOutOfBoundContent" value="false"/>                    </reportElement>                    <box>                        <topPen lineWidth="0.4"/>                        <leftPen lineWidth="0.4"/>                        <bottomPen lineWidth="0.4"/>                        <rightPen lineWidth="0.4"/>                    </box>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="b0ca90f0-9364-4c4c-a8cf-1a54c60189a0"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>                    </textField>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="f8b11d9c-fa8c-4e58-805a-4a8305b1bec1"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>                    </textField>                </frame>            </frame>        </band>    </title></jasperReport>[/code]

I tried to reduce the size of the frames and set their removeLineWhenBlank property to true, and now everything disappears if I set the values par1=par2=null, par3=3, par4=4. Why ? I only want to remove the lines that are blank, not all of them:

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  --><!-- 2015-12-23T18:22:07 --><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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">    <parameter name="par1" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par2" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par3" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <parameter name="par4" class="java.lang.String">        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>    </parameter>    <title>        <band height="141" splitType="Stretch">            <line>                <reportElement x="10" y="6" width="520" height="1" uuid="ebfc40ae-a2ee-40fc-b585-4236e9fa3c63"/>            </line>            <line>                <reportElement x="0" y="110" width="520" height="1" uuid="7657216f-1366-4455-adb0-db58e2333b5c"/>            </line>            <frame>                <reportElement x="329" y="10" width="172" height="43" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="0fbab6b3-f5ea-4716-b954-9371b4640781">                    <property name="ShowOutOfBoundContent" value="false"/>                </reportElement>                <box>                    <topPen lineWidth="0.4"/>                    <leftPen lineWidth="0.4"/>                    <bottomPen lineWidth="0.4"/>                    <rightPen lineWidth="0.4"/>                </box>                <frame>                    <reportElement positionType="Float" x="13" y="3" width="60" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="8a663ee5-c983-40f9-b85e-11bc852f46cc">                        <property name="ShowOutOfBoundContent" value="false"/>                    </reportElement>                    <box>                        <topPen lineWidth="0.4"/>                        <leftPen lineWidth="0.4"/>                        <bottomPen lineWidth="0.4"/>                        <rightPen lineWidth="0.4"/>                    </box>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="84504631-a04d-4f75-bcb2-9e20741f29ad"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>                    </textField>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="52c7e555-7e36-4992-8e59-b533fea31533"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>                    </textField>                </frame>                <frame>                    <reportElement positionType="Float" x="73" y="3" width="70" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="3a53c02d-6559-4c64-8ca8-21254b50435e">                        <property name="ShowOutOfBoundContent" value="false"/>                    </reportElement>                    <box>                        <topPen lineWidth="0.4"/>                        <leftPen lineWidth="0.4"/>                        <bottomPen lineWidth="0.4"/>                        <rightPen lineWidth="0.4"/>                    </box>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="b0ca90f0-9364-4c4c-a8cf-1a54c60189a0"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>                    </textField>                    <textField isBlankWhenNull="true">                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="f8b11d9c-fa8c-4e58-805a-4a8305b1bec1"/>                        <box>                            <topPen lineWidth="1.0"/>                            <leftPen lineWidth="1.0"/>                            <bottomPen lineWidth="1.0"/>                            <rightPen lineWidth="1.0"/>                        </box>                        <textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>                    </textField>                </frame>            </frame>        </band>    </title></jasperReport>[/code]

What am I doing wrong?

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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...