设置 iReport 文本字段中文本样式的格式

发布于 2024-12-23 04:24:49 字数 965 浏览 2 评论 0原文

我想将文本字段中的一些文本设为粗体。我访问了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

纸短情长 2024-12-30 04:24:49

这很好用:

"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"

适用于来自数据源的输入数据,或

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>

仅适用于某些静态文本。

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

This work good:

"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"

for input data from datasource, or

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>

only for some static text.

For Text-field set properties Markup = styled.

尹雨沫 2024-12-30 04:24:49

在您看来,报表设计器。

单击该字段并在属性面板中。:markup = styled selected

右键单击​​该字段。编辑表达式:

($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})

或xml

<textFieldExpression><![CDATA[($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})]]></textFieldExpression>

in your view ireport designer.

click on the field and in the properties panel.: markup = styled selected

Right click on the fied. edit expression:

($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})

or xml

<textFieldExpression><![CDATA[($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})]]></textFieldExpression>
任性一次 2024-12-30 04:24:49

标签不再适用于文本字段。确保为文本字段启用“样式文本”并将其放入字段表达式中。

<style isBold="true" pdfFontName="Helvetica-Bold">Text to be bold...</style>

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.

<style isBold="true" pdfFontName="Helvetica-Bold">Text to be bold...</style>

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.

彡翼 2024-12-30 04:24:49

我通过在输入字符串中添加粗体和下划线来解决

"<b><u> your text</u></b>"

I solved by putting for bold and underline in input string

"<b><u> your text</u></b>"
泪意 2024-12-30 04:24:49

我解决了这个问题,将“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

无法言说的痛 2024-12-30 04:24:49
"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"

上面简单地做了什么

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>

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

参见下面的屏幕截图
希望这有帮助!

输入图片此处描述

"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"

what is done above simply

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>

For Text-field set properties Markup = styled.

see the screenshot below
hope this helps !!!

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文