Jump to content
Changes to the Jaspersoft community edition download ×

Apply bold to only part of a string within a text field that contains two fields.


Go to solution Solved by danielo.developer,

Recommended Posts

I have two fields I want to combine into one field.  One field is a label, and the other is a free form field.  For example:

PO:  123&ABC

With "PO:" being the label and "123&ABC" being the free form section.  I would like for the label to be bold and the free form to not be bold and I want these both with a single text field.  For example, $F{LABEL1}+" "+$F{FREE_FORM1}.

I have tried using the markup of html; however, when an end user types in an & or % in the free form field it causes the markup to be ignored and instead of seeing:

PO:  123&ABC  you see <b>PO</b> 123&ABC

Is there a way to accomplish what I'm asking with Jasper Studio w/out having to split up the two fields into two different text fields?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
<textField>
				<reportElement x="-11" y="3" width="586" height="597" uuid="6142344b-e776-4f12-832d-c9d8da9de0d0"/>
				<textElement markup="html">
					<font size="10" isBold="false"/>
				</textElement>
				<textFieldExpression><![CDATA["<font color='blue'><b>" + $F{LABEL1} + "</b></font>" + $F{LABEL2}]]>			  </textFieldExpression>
  
</textField>


voila PO en gras et en bleu si tu veux meme utiliser les couleurs.


NB: n'oublie pas html markup:

 

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...