【问题标题】:Jasper breaking lines even with sufficient space to render just one line即使有足够的空间来渲染一条线,Jasper 也会断线
【发布时间】: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


    【解决方案1】:

    带有 Courier 字体的文本更宽。我想如果你用 Helvetica 写一些长文本,你会看到同样的东西。检查填充和边距。

    并删除&lt;box bottomPadding="2"/&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-01
      • 2013-07-03
      • 1970-01-01
      • 1970-01-01
      • 2022-09-28
      • 2021-04-11
      相关资源
      最近更新 更多