5

jrxml 内にレポートを作成しました。<printWhenExpression>次のような値のタグを使用してフィールドの 1 つに値が設定されている場合にのみ、各値の詳細を出力するように指定しました。

<textField>
            <reportElement x="670" y="4" width="105" height="20" isRemoveLineWhenBlank="true">
                <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
            </reportElement>
            <textElement>
                <font fontName="Arial" size="10"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>

これは、関連するデータのみをフィルタリングする際に機能しますが、レポート内に多くの空白行が残ります。isRemoveLineWhenBlank="true"これらの空白行がレポートに表示されないようにする条件を有効にしました。これにより、レポートが 12 ページから 5 ページになりましたが、レポート内に多数の空の行が残っています。

これは、ireport でのレポート デザインのスクリーンショットです。

ここに画像の説明を入力

そして、これがレポート実行のスクリーンショットです (クラスから会社名を消しました)

ここに画像の説明を入力

完全なレポート JRXML:

    <?xml version="1.0" encoding="UTF-8"?>
<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="RIOBridgeReport" pageWidth="1530" pageHeight="842" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="10" rightMargin="5" topMargin="10" bottomMargin="10">
    <property name="ireport.zoom" value="2.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>
    <parameter name="title" class="java.lang.String"/>
    <parameter name="oneliner" class="java.lang.String"/>
    <field name="name" class="java.lang.String">
        <fieldDescription><![CDATA[id[starts-with(.,'USCS')]]]></fieldDescription>
    </field>
    <field name="class" class="java.lang.String">
        <fieldDescription><![CDATA[class]]></fieldDescription>
    </field>
    <field name="value" class="java.lang.String">
        <fieldDescription><![CDATA[constructor-arg/value]]></fieldDescription>
    </field>
    <field name="value1" class="java.lang.String">
        <fieldDescription><![CDATA[constructor-arg[1]/value]]></fieldDescription>
    </field>
    <field name="value2" class="java.lang.String">
        <fieldDescription><![CDATA[constructor-arg[2]/value]]></fieldDescription>
    </field>
    <variable name="runDate" class="java.lang.String">
        <initialValueExpression><![CDATA[new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z").format(new java.util.Date())]]></initialValueExpression>
    </variable>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="53" splitType="Stretch">
            <textField isBlankWhenNull="true">
                <reportElement x="12" y="12" width="496" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial" size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{title} + " - " + $V{runDate}]]></textFieldExpression>
            </textField>
            <image>
                <reportElement x="616" y="0" width="84" height="53"/>
                <imageExpression><![CDATA["citi_corp_logo.gif"]]></imageExpression>
            </image>
            <textField isBlankWhenNull="true">
                <reportElement x="12" y="32" width="496" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial" size="10" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{oneliner}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <columnHeader>
        <band height="23" splitType="Stretch">
            <staticText>
                <reportElement x="12" y="2" width="85" height="20"/>
                <textElement>
                    <font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Bean Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="228" y="2" width="85" height="20"/>
                <textElement>
                    <font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Class]]></text>
            </staticText>
            <staticText>
                <reportElement x="428" y="2" width="105" height="20"/>
                <textElement>
                    <font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Value]]></text>
            </staticText>
            <staticText>
                <reportElement x="543" y="2" width="105" height="20"/>
                <textElement>
                    <font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Value1]]></text>
            </staticText>
            <staticText>
                <reportElement x="670" y="2" width="105" height="20"/>
                <textElement>
                    <font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Value2]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="24">
            <textField isBlankWhenNull="true">
                <reportElement x="12" y="2" width="216" height="20" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="228" y="2" width="185" height="20">
                    <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{class}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="428" y="2" width="105" height="20">
                    <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="543" y="4" width="105" height="20">
                    <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{value1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="670" y="4" width="105" height="20">
                    <printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <noData>
        <band height="20">
            <staticText>
                <reportElement x="146" y="0" width="200" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial" size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[No data found]]></text>
            </staticText>
        </band>
    </noData>
</jasperReport>

ご覧のとおり、レポート内にはまだ大量の空白が残っています。それらを完全に削除するか、空白行をレポートの最後にプッシュする方法はありますか?

4

2 に答える 2