【发布时间】:2017-03-31 16:29:40
【问题描述】:
我的图像高度为 360 像素,宽度为 900 像素。根据我的情况,有时图像会是空白的,因此它不会显示在 PDF 或 EXCEL 中。
此时,当图像不是根据其设置的“y”轴定位的其他元素时。因此形成了一个间隙。
那么当图像不是它们时,如何将它们所有其他元素的位置设置为顶部。
<image isUsingCache="true" onErrorType="Icon">
<reportElement x="448" y="0" width="402" height="300" uuid="d8d19734-1711-461d-bdb8-c8c7130a6eb2">
<printWhenExpression><![CDATA[($P{chartImg2}!=null ? true : false)]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{chartImg2}]]></imageExpression>
</image>
<textField>
<reportElement style="REPORT_TITLE" mode="Opaque" x="0" y="320" width="850" height="30" uuid="aabbe2ed-96eb-4246-8bda-16187228c116">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{campaign_name}+"- Links Report"]]></textFieldExpression>
</textField>
所以,现在您可以看到图像的高度比文本字段的高度为 320 像素,因此图像不是它们的,但文本字段将在 320 像素之后显示。它在 PDF 中看起来很糟糕。所以我想如果图像不是他们上面的所有元素移位。
【问题讨论】:
-
不,那是不一样的
-
你需要 positionType="float" 在需要浮动的 textElements 上,查看 AlexK dupe 上的答案。
标签: image jasper-reports height shift