首页 > 解决方案 > 当左元素为空时将右元素向左移动

问题描述

我将第二个元素USER 2属性设置Print When Expression为, 1 == 2因为我想隐藏第二个元素并将第三个元素USER 3向左移动,占用第二个元素的空白空间。

现在我得到的结果是第二个元素消失了,但第三个元素会留在原处。当第二个元素为空白时,如何将第三个元素向左移动?

在此处输入图像描述

编码:

<?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="KEW.PA-21" pageWidth="1190" pageHeight="842" orientation="Landscape" columnWidth="1150" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="a674c8a2-3ac2-47e4-81f5-7a3a99aae035">
    <pageHeader>
        <band height="123">
            <elementGroup>
                <elementGroup>
                    <frame>
                        <reportElement x="174" y="67" width="174" height="56" uuid="5c273ef2-fc7e-4b93-b696-257f60b2708a">
                            <printWhenExpression><![CDATA[1 == 2]]></printWhenExpression>
                        </reportElement>
                        <box>
                            <pen lineWidth="0.5"/>
                        </box>
                    </frame>
                    <staticText>
                        <reportElement x="174" y="67" width="100" height="20" uuid="1f14627b-e41e-41a0-a611-434b982224f4">
                            <printWhenExpression><![CDATA[1 == 2]]></printWhenExpression>
                        </reportElement>
                        <text><![CDATA[USER 2]]></text>
                    </staticText>
                </elementGroup>
            </elementGroup>
            <elementGroup>
                <elementGroup>
                    <frame>
                        <reportElement x="0" y="67" width="174" height="56" uuid="4d01df9b-fd94-4093-bcf7-8f1356626842"/>
                        <box>
                            <pen lineWidth="0.5"/>
                        </box>
                    </frame>
                    <staticText>
                        <reportElement x="0" y="67" width="100" height="20" uuid="0d50a57a-d2cf-4e95-80d7-133758e127a1"/>
                        <text><![CDATA[USER 1]]></text>
                    </staticText>
                </elementGroup>
            </elementGroup>
            <staticText>
                <reportElement x="348" y="67" width="100" height="20" uuid="004d3b77-7652-45f0-ae2e-e3b0f06c1a94"/>
                <text><![CDATA[USER 3]]></text>
            </staticText>
            <frame>
                <reportElement x="348" y="67" width="174" height="56" uuid="56942784-51b6-4326-a0db-b6901bb5b565"/>
                <box>
                    <pen lineWidth="0.5"/>
                </box>
            </frame>
        </band>
    </pageHeader>
</jasperReport>

标签: jasper-reports

解决方案


推荐阅读