Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Background fill floating fields?

Avatar

Former Community Member
Is there a way to background specific text within a text object? I'm trying to shade my floating fields. It looks like the background fill
only applies like borders, so it only applies to the entire text object.



I know you can change the color of words within a text object. Seems like the ability to background fill particular words should be a basic feature.



Thanks
1 Reply

Avatar

Level 6
I figured this out. When you create the static text object at design time, make sure that it has a word with a different colour or font or something. That will ensure that its value property contains an exData object with contentType="text/html". Now you can change the contents at run time with (I've replaced the angle brackets with {}):



var theXML = "{body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" xfa:APIVersion=\"2.5.6290.0\"}{p style=\"text-decoration:none\"}The{span style=\"xfa-spacerun:yes\"} {/span}{span style=\"color:#ff0000\"}quick{/span} brown fox.{/p}{/body}";



StaticText1.value.exData.loadXML(theXML,true);



Jared Langdon

www.jlangdon.ca