gbaldeck Posted August 18, 2011 Share Posted August 18, 2011 Hi, I have a text field that contains some text. I don't want to bold all of it, only part of it.Here is the xml of the text field:<textFieldExpression class="java.lang.String"><![CDATA[$R{statementMessage.report.label}+": "+$P{StatementMessage}]]></textFieldExpression>Here is how I tried to do it:<textFieldExpression class="java.lang.String"><![CDATA[<style isBold="true" pdfFontName="Helvetica-Bold">$R{statementMessage.report.label}+": "</style>+$P{StatementMessage}]]></textFieldExpression>Notice the style tags I used. That didn't work. I've tried several other ways but none of them worked. How should I go about doing this? Link to comment Share on other sites More sharing options...
cbarlow3 Posted August 18, 2011 Share Posted August 18, 2011 You are moments away from a solution! In iReport, instead of setting your expression to:$R{statementMessage.report.label } + ": " + $P{StatementMessage}scroll all the way down the properties screen for that field and change the "Markup" property from "None" to "Styled" and then change the expression for this field to read:"<style isBold=\"true\">" + $R{statementMessage.report.label} + ": </style>" + $P{StatementMessage}Remember, that's the actual expression you enter in iReport designer mode...you don't have to edit the jrxml.But that's just the beginning of what you can do with styled markup. See the attached jrxml file and execute it (the static text sections look impressive in Design view, but the text fields only work at runtime) to get an idea of the possibilities. This example is slightly modified from the one I got from Matt Dahlmann, who I now consider the undisputed king of styled text knowledge (and he's also extremely helpful on this forum in other areas).Carl Link to comment Share on other sites More sharing options...
gbaldeck Posted August 18, 2011 Author Share Posted August 18, 2011 That worked! The file you attached looks like a huge help too. Thank you. Link to comment Share on other sites More sharing options...
simon_tsa Posted October 1, 2013 Share Posted October 1, 2013 Is that attachment still available somewhere? I used your isBold suggestion and it worked perfectly! (Only change was escaping the "true" quotes with one forwardslash not two).If you have the attachment still, that would be awesome.Thanks Link to comment Share on other sites More sharing options...
martin.torre.castro Posted September 14, 2016 Share Posted September 14, 2016 I would also love to have that attachment. I can't see it. Link to comment Share on other sites More sharing options...
danielro094 Posted November 5, 2019 Share Posted November 5, 2019 are you know if this fix is available to ireport version 3.0.0? 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