Set Color of Text Attribute Text via DXL

PROBLEM: I am not able to use DXL to create colored text in a Text attribute.

BACKGROUND: I'm using "Object Text" as the test example.  The code below demonstrates my confusion/problem in that the code produces colored text in a dialog box, but does not result in colored text in a Text attribute (see assignment of "xSample" to current object's "Object Text").  I added a print statement to ensure that the richText was making it into the attribute and the rich text constructs do appear to be in the attribute.  What am I doing wrong?

string xColorTable = "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green255\\blue0;}"
string xSample = xColorTable "{\\cf1 This is red text.
\\cf0\\highlight2 This is yellow highlight \\highlight0 }"
DB xDB = centered("Colors in a richText DBE")
DBE xRichText = richText(xDB,"richText DBE:","empty",360,250,false)
realize(xDB)
useRTFColour(xRichText,true)
set(xRichText,xSample)
(current Object)."Object Text" = richText(xSample)

print richText((current Object)."Object Text")
show(xDB)


BobSherman - Sat Sep 12 10:24:02 EDT 2015

Re: Set Color of Text Attribute Text via DXL
llandale - Sat Sep 12 16:25:49 EDT 2015

Yup, don't know how to set color in attribute values.  I hate that.  But you can set the color as you have done, then write a layout DXL that:

  • displayRichWithColour(obj.dxl_MyRedlinedAttribute "")

Thus, the color codling is still in the attribute but it is not shown.

On a similar issue, you can indeed color the all the text in a column; and I'm thinking that capability is what is denying the color specified in the rich text.

-Louie

Re: Set Color of Text Attribute Text via DXL
BobSherman - Mon Sep 14 07:41:11 EDT 2015

Thanks Louie for the confirmation and also the insight on possible cause for this missing functionality.

Re: Set Color of Text Attribute Text via DXL
Mathias Mamsch - Tue Sep 15 09:50:57 EDT 2015

BobSherman - Mon Sep 14 07:41:11 EDT 2015

Thanks Louie for the confirmation and also the insight on possible cause for this missing functionality.

One more hint - it seems like you can still have background colors on table cells ...

Not nice, but at least something.

string s = "{\\rtf1\\ansi\\deff0{\\colortbl;\\red0\\green255\\blue255;}\\trowd\\clcbpat1\\cellx2000\\intbl cell 1\\cell\\row}"; 

(current Object)."Object Text" = richText s

Regards, Mathias

Re: Set Color of Text Attribute Text via DXL
BobSherman - Tue Sep 15 18:54:27 EDT 2015

Mathias Mamsch - Tue Sep 15 09:50:57 EDT 2015

One more hint - it seems like you can still have background colors on table cells ...

Not nice, but at least something.

string s = "{\\rtf1\\ansi\\deff0{\\colortbl;\\red0\\green255\\blue255;}\\trowd\\clcbpat1\\cellx2000\\intbl cell 1\\cell\\row}"; 

(current Object)."Object Text" = richText s

Regards, Mathias

I did not know that tables were possible in richText.  Will definitely put that in the mental tool-belt. Thanks very much.

Re: Set Color of Text Attribute Text via DXL
llandale - Tue Sep 15 19:09:06 EDT 2015

BobSherman - Tue Sep 15 18:54:27 EDT 2015

I did not know that tables were possible in richText.  Will definitely put that in the mental tool-belt. Thanks very much.

That sort of supports my guess, since table cells are not in a "column" they are not so restreicted to color.