jasper-reports - 如何在文本字段中强制中断长文本
问题描述
我想强制在文本字段中中断很长的文本。我不在乎文本中是否有空格。如果文本字段宽度太长,我只想让文本出现在下一行。
我试过这个:
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-2" positionType="Float" stretchType="RelativeToTallestObject" x="409" y="170" width="146" height="28">
<property name="net.sf.jasperreports.text.save.line.breaks" value="true"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Courier New" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{customerReference}]]></textFieldExpression>
</textField>
但它不起作用。我只是在第一个连字符之后切断了文本,其余的文本不显示。
一个示例文本是:
SIN684473 - 403904156/OO0D628902B SIN684473 - 403904156/OO0D628902B
请帮忙。谢谢。
编辑 1:感谢 Alex K,它现在可以在 PDF 中使用。但现在在 Excel 文件中,customerReference 字段为空。但它在 PDF 中不是空的。
请帮忙。谢谢。
解决方案
推荐阅读
- function - 谷歌表格脚本 - 邮件可能触发一列吗?
- php - 如何在 PHP 中显示目录中的图像?
- c++ - 使用 SIMD 优化数值程序
- javascript - 转到页面并打开模态 javascript
- php - 按查询分组适用于 php 5.4,而不是 php 7
- data-mining - 数据集市是位于数据仓库内还是在 Kimball Methodology 中完全独立的数据库?
- drake-r-package - 是否可以从动态分支目标中拆分子目标,以便以后的动态分支目标仅获得一个子子目标?
- xml - BI Publisher RTF 模板中字母数字数据的排序问题
- tensorflow2.0 - tensorflow 服务 REST API 错误:找不到可服务模型的基本路径 /models/model
- csv - Neo4j - 为参照完整性创建关系