我有一个包含四个参数FieldOne,FieldTwo,FieldThree和hideF的报告。 当hideF为true时,必须隐藏FieldTwo。 在FieldOne和FieldTwo之间也不应有空格。 使用以下代码,FieldTwo被隐藏,但空白空间不会被删除。
此处附有代码。
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<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="try" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4935fa11-e426-4823-906c-992c1ad3b5ec">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="hideF" class="java.lang.String"/>
<parameter name="FieldOne" class="java.lang.String"/>
<parameter name="FieldTwo" class="java.lang.String"/>
<parameter name="FieldThree" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="377" splitType="Stretch">
<rectangle>
<reportElement x="108" y="10" width="370" height="30" uuid="8e7e05b1-c532-41cf-ad39-ca0d2b599f2d"/>
</rectangle>
<rectangle>
<reportElement x="108" y="40" width="370" height="30" isRemoveLineWhenBlank="true" uuid="a6f7fb7c-0af9-4927-974e-b4a4b5611cbf">
<printWhenExpression><![CDATA[$P{hideF}.equalsIgnoreCase( "false" )]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle>
<reportElement x="108" y="70" width="370" height="30" uuid="c3507590-a07d-4fa8-a540-53349a0ca237"/>
</rectangle>
<staticText>
<reportElement x="110" y="10" width="107" height="30" uuid="8b898db1-26ab-48d3-97f8-19b2c0b6342a"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<text><![CDATA[FieldOne]]></text>
</staticText>
<staticText>
<reportElement x="110" y="40" width="107" height="30" isRemoveLineWhenBlank="true" uuid="e9af990b-ca14-491e-9a93-1af847c424c1">
<printWhenExpression><![CDATA[$P{hideF}.equalsIgnoreCase( "false" )]]></printWhenExpression>
</reportElement>
<text><![CDATA[FieldTwo]]></text>
</staticText>
<staticText>
<reportElement x="110" y="70" width="107" height="30" uuid="268af70c-24a8-4c76-918f-abadad5eaa84"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<text><![CDATA[FieldThree]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement x="223" y="11" width="255" height="30" uuid="7dd20c74-71c1-4ad0-b286-d75dea323dc1"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{FieldOne}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="223" y="40" width="255" height="30" isRemoveLineWhenBlank="true" uuid="313bfce6-c2ba-4cf9-90c1-9bcd6f80b6a0">
<printWhenExpression><![CDATA[$P{hideF}.equalsIgnoreCase( "false" )]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{FieldTwo}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="223" y="70" width="255" height="30" uuid="02ca93d6-2a36-4165-8f9e-e0cbf28b6574"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{FieldThree}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
问题似乎是textField。当我仅尝试使用标签时有效。 我需要使用它来处理textFields
附加的输出图像。问题是FieldOne和FieldThree行之间的空间