设置 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>
在这个例子中: 样式中的文本字段Jasper,文本字段表达式错误,导致编译失败。
我们将不胜感激您的帮助。
I want to make some text in a text field bold. I visited http://jasperreports.sourceforge.net/sample.reference/markup/index.html but could not get the desired result. I am using text field right now but when I tried using styled/html, the compilation failed. So can you help me with this jrxml code snippet:
<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>
In this example: Style a text field in Jasper, the text field expression is wrong for which compilation fails.
Your help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这很好用:
适用于来自数据源的输入数据,或
仅适用于某些静态文本。
对于文本字段设置属性 Markup = styled。
This work good:
for input data from datasource, or
only for some static text.
For Text-field set properties Markup = styled.
在您看来,报表设计器。
单击该字段并在属性面板中。:markup = styled selected
右键单击该字段。编辑表达式:
或xml
in your view ireport designer.
click on the field and in the properties panel.: markup = styled selected
Right click on the fied. edit expression:
or xml
标签不再适用于文本字段。确保为文本字段启用“样式文本”并将其放入字段表达式中。
pdfFontName 可以是您喜欢的任何名称。
如果要将字符串中已有的文本设置为粗体,请务必使用反斜杠转义上述引号。
The
<b> </b>
tags no longer work on text fields. Make sure that 'Styled text' is enabled for the text field and put this in the field expression.The pdfFontName can be whatever you like.
If you are making text bold that is already in a string be sure to escape the above quotes with a backslash.
我解决了这个问题,将“makup”文本字段属性更改为“html”。然后在文本字段表达式中使用 html 标签,例如 < b> < /b>. =D
I solved this problem changing 'makup' text-field atribute to 'html'. Then in text-field expression use html tags like < b> < /b>. =D
上面简单地做了什么
参见下面的屏幕截图
希望这有帮助!
what is done above simply
see the screenshot below
hope this helps !!!