Avatar

Level 10

Hi,

Just a slight alternative you can also build up the rich text using the Span objects, http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.1168.html

So something like;

 

var spans = [];

spans.push({text:"Roberto Sobrino"});

spans.push({text:"Some information about Roberto", textColor:color.red, fontWeight:700});

this.value.exData.loadXML(util.spansToXML(spans), false, true);

     

There is a lot of functionality that is not supported with this approach so sometimes specifying the XML directly is the only way but colors and bold are.  Also I don't think you can specify color names in the XML approach so you would need either the 6 digit hex string (like below) or the decimal numbers;

<exData contentType="text/html" xmlns="http://www.xfa.org/schema/xfa-template/3.6/">

   <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p style="font-family:'Myriad Pro';color:#ff0000;font-weight:bold">Roberto Sobrino<span style="xfa-spacerun:yes"> </span><span style="color:#000000;font-weight:normal;text-decoration:none">Some information about Roberto</span></p></body>

</exData>

Regards

Bruce