Jump to content

Is there a way to mix textual effects?


kurt_cobain

Recommended Posts

I have a text field like this:

 

"Your payment of $F{pmt} was received, thanks"

 

I'd like to bold only the payment part, and have the rest not be bold. I can do that with other reporting tools but haven't found a way to do it with Jasper; is it possible? Thanks

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Very interesting. I was just playing with this. I created a TextField with this expression:

 

"Lets make the date bold and red <style forecolor='red'>" + new Date() + "</style>"

 

In the font properties I set the "isStyledText" to true.

 

The date was red in PDF, HTML and and the JRPreviewer. This is sort of weird because I seem to remember you could only do this in a Static Text Field. Prior to 2.0.5 I don't even remember TextFields having a "isStyledText" option.

 

HTH

 

 

Code:

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="0"
width="535"
height="77"
key="textField-1"/>
<box></box>
<textElement isStyledText="true">
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Lets make the date bold and red <style forecolor='red'>" + new Date() + "</style>"]]></textFieldExpression>
</textField>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...