kurt_cobain Posted May 8, 2008 Share Posted May 8, 2008 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 More sharing options...
ge0ffrey Posted May 8, 2008 Share Posted May 8, 2008 there's a property to mark a textfield's content as markup rtf or html, so you could probably fake a html output? Link to comment Share on other sites More sharing options...
lucianc Posted May 8, 2008 Share Posted May 8, 2008 There's also a JasperReports-specific "styled text" syntax that allows you to apply style attributes to text fragments. Check the "styledtext" sample from the JR distribution. HTH,Lucian Link to comment Share on other sites More sharing options...
lshannon Posted May 8, 2008 Share Posted May 8, 2008 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 More sharing options...
lucianc Posted May 8, 2008 Share Posted May 8, 2008 Styled text has always been available for both static texts and text fields. Regards,Lucian Link to comment Share on other sites More sharing options...
kurt_cobain Posted May 13, 2008 Author Share Posted May 13, 2008 Thanks guys; using the styling worked. I couldn't get it to work with text fields though... I had to conver them to $F entities. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now