我的问题与iReport table with additional record repeating for each row非常相似 但是在打印时应该有条件,当且仅当其他细节不为空时。
如果其他详细信息为null,则开始在otherdetails的位置打印下一行。 在下面的照片中 row0 没有任何详细信息,因此不会打印“关于row0的详细信息”,并且会发生下一行“ row1 ”。
*。jrxml它与this
的代码相同<?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="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0cd60d2c-0de5-44c1-8e55-88a8506b1b19">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[select * from tbl_contact_details order by address_id asc]]>
</queryString>
<field name="ADDRESS_ID" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="LINE1" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="LINE2" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="CITY" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="200" height="20" uuid="ca4c166d-4e80-4aee-998f-9bf72fc09d82"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[ID]]></text>
</staticText>
<staticText>
<reportElement x="200" y="0" width="131" height="20" uuid="92c185c2-b983-4328-94f6-75f5cce6e1a4"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[City]]></text>
</staticText>
<staticText>
<reportElement x="331" y="0" width="224" height="20" uuid="dbc15243-3212-4911-ab6d-8e5a5f75a38e"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Locality]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="41" splitType="Stretch">
<frame>
<reportElement x="0" y="0" width="555" height="41" uuid="5cb2a2e0-1e93-4feb-9760-bd1cb7bec02f"/>
<textField>
<reportElement x="331" y="0" width="224" height="20" uuid="23183b68-362d-494e-acf0-93ff7fc31d19"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{LINE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="200" height="20" uuid="75ba684c-c6bc-4129-bb3c-e045317f7084"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{ADDRESS_ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="200" y="0" width="131" height="20" uuid="93f12b46-e069-4435-8073-1bf122b06393"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="20" width="555" height="21" isRemoveLineWhenBlank="true" uuid="7c215a29-76be-4462-bef6-71f1d81e337f"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{LINE2}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="53" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
现在我得到了这个结果 但我想要这样
答案 0 :(得分:1)
试试
$F{detail}!=null && $F{detail}.trim().length()>0
在表达时打印中的