使用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系统上使用报表库,那么即使没有必要,该行也会被包装 . 在这种情况下,看起来文本与顶部对齐,而不是按照应该对齐到中心 .
当然,我检查过文本确实没有空白,但事实并非如此 .
只有当软件部署到Linux服务器时,才能在Windows上重现问题 . 不幸的是,在 生产环境 环境中我们有linux,不幸的是会有一些用户不得不经常安静地面对这个问题 .
在这样的情况下,有没有解决方案来避免换行?
1 回答
我有同样的问题 . 框架导致问题 . 对我来说就是这样 . 我删除了框架,一切都是正确的 .
实际上,框架具有最小高度 . 因此,当元素换行时,框架会重新调整其高度以达到其最小高度 .
希望这会有所帮助!