【发布时间】:2016-11-21 13:24:25
【问题描述】:
使用 Jasper Reports Library 5.6.0 我设计了一个带有浮动文本字段和换行的报表。此类文本字段的一个示例如下:
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-25" positionType="Float"
stretchType="RelativeToBandHeight" mode="Opaque" x="172" y="0"
width="122" height="12" uuid="f5617e21-e2db-4ea7-9311-82c83805827f">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isPdfEmbedded="true"/>
</textElement>
这对于短文本非常有效,当不需要换行时,对于长文本,当换行将一些文本放在下一行或几行时。
如果文本完全适合文本字段的长度,并且如果我在 linux 系统上使用报告库,则即使没有必要,也会换行。在这种情况下,看起来文本与顶部对齐,而不是应有的居中对齐。
当然我检查了文本后面真的没有空格,它不是。
我无法在 Windows 上重现该问题,仅当软件部署到 linux 服务器时。不幸的是,在生产环境中我们有 linux,不幸的是,有些用户不得不经常面对这个问题。
在这种情况下,有什么办法可以避免换行吗?
【问题讨论】:
-
你输出为 PDF 吗?
-
是的,输出为 PDF。
标签: jasper-reports