Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

put in bold a part of a string

Avatar

Level 3

Hello

Is possible to put a part of a string in bold like :

var myText = "blablblla "+"<b>boldText</b>" +" reste of text";

Thanks

3 Replies

Avatar

Level 10

You can use richtext to display a string with bold characters.  Something like;

var richtext = <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p>blablblla <span style="font-weight:bold">boldText</span> reste of text</p></body>;

TextField1.value.exData.loadXML(richtext.toXMLString(),true,false);

This assumes that TextField1 has a Field Format or rich text.

Avatar

Level 3

Thanks it works !

But i need to go at a new line. I tried <br> ou creation a new paragraphe, it dont works ! Only the first paragraphe is show !

exemple :

<p> my text</p>

<p> my text</p>

Avatar

Level 10

Try using;

TextField1.value.exData.loadXML(richtext.toXMLString(),false,false);

That is false in the second argument.  It seems that with this true then there are multiple root node and it only loads the first one.

Bruce