格式化文本字段 iReport 中的文本样式

Ani*_*nil 2 jasper-reports ireport

我想在文本字段中加粗一些文本。我访问了http://jasperreports.sourceforge.net/sample.reference/markup/index.html但没有得到想要的结果。我现在正在使用文本字段,但是当我尝试使用 styled/html 时,编译失败。那么你能帮我解决这个 jrxml 代码片段吗:

<textField>
    <reportElement x="200" y="10" width="590" height="42"/>
    <textElement markup="styled"/>
    <textFieldExpression><![CDATA["The static text without any format.\nThe field's data with bold format<style isBold='true'>:" + $F{TASKS_SUBTASK} + "</style>\n<style isBold='true' isItalic='true' isUnderline='true'>The static underlined text with bold and italic format</style>"]]></textFieldExpression>
</textField>
Run Code Online (Sandbox Code Playgroud)

在此示例中:在 Jasper中设置文本字段的样式,文本字段表达式错误,编译失败。

您的帮助将不胜感激。

小智 5

这个工作很好:

"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"
Run Code Online (Sandbox Code Playgroud)

对于来自数据源的输入数据,或者

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>
Run Code Online (Sandbox Code Playgroud)

仅适用于某些静态文本。

对于文本字段设置属性 Markup = styled。