【发布时间】:2017-03-29 16:10:17
【问题描述】:
我正在开发一个 Jasper 报告,该报告必须从我的网络应用程序中导出为 PDF。 jasperreport.version 为 5.5.1,Web 应用程序在 Tomcat6 实例上运行。
我在 .jrxml 中定义了以下元素:
<rectangle>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="415" y="21" width="140" height="28" uuid="52ceec4a-26bb-4efa-a4d2-af32c107d1d3"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true">
<reportElement style="label" positionType="Float" x="415" y="20" width="140" height="14" uuid="f1394c5b-4921-4ccd-84ed-b1d3e44dc499"/>
<textElement markup="none">
<font size="9" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{nivel.gestao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="campo" positionType="Float" stretchType="RelativeToTallestObject" x="415" y="34" width="140" height="15" uuid="3e1d2402-8b21-4f8e-9ee8-d57f1a870077"/>
<box bottomPadding="2"/>
<textElement verticalAlignment="Middle" markup="none">
<font size="9" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{nivelGestao}]]></textFieldExpression>
</textField>
问题在于 Jasper 根据我使用的字体系列来呈现带有换行符的文本。
使用 Helvetica:
使用 Courier(我需要的字体):
如何使用 Courier 字体系列并避免意外换行?
【问题讨论】:
标签: jasper-reports line-breaks