在jasper报告中为单个文本字段使用多种字体 [英] Use multiple fonts for a single text field in jasper reports

查看:429
本文介绍了在jasper报告中为单个文本字段使用多种字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字段显示收件人:姓名To是静态的,NAME是变量。
所以我使用了单个文本字段attr和To:+ $ F {name} 作为表达式。
现在,问题是,我必须为To和Name使用两个单独的字体。
我尝试过使用风格但我必须遗漏一些东西。
你能帮帮我吗?

I have a field which displays "To : NAME". Here "To" is static and "NAME" is a variable. So I have used a single Text Field attr and "To: " + $F{name} as an expression. Now, the problem is, I have to use two separate fonts for "To" and "Name". I've tried using style but I must be missing something. Could you please help me out?

注意:我不能将To的静态文本和name字段的文本字段用作这些的水平对齐方式必须是中心在一起。

N.B : I cannot use static text for "To" and text field for "name" field as horizontal alignment for these has to be center being together.

推荐答案

好的,我能够通过以下方式实现这个修改jasper xml - - >

ok, I'm able to achieve this modifying the jasper xml in the following way -->

            <textField>
                <reportElement x="36" y="192" width="329" height="16"/>
                <textElement textAlignment="Center" verticalAlignment="Middle" markup="styled">
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["<style fontName='ChronicleTextG1_Italic'>To: </style><style fontName='ChronicleTextG1_Roman'>" + $F{TO_NAME} + "</style>"]]></textFieldExpression>
            </textField>

希望它有助于其他人。

这篇关于在jasper报告中为单个文本字段使用多种字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆