change fgcolor programatically

I have changed over a solution from using onrender to using css, and one unexpected problem is that it seems that many lines were added with white foregrounds, so with css, the text is white text on white background. There are too many to change manually (although weirdly, not all lines are white - I guess it is a default colour on some clients’ machines, and not others…)

Anyway, I am now trying to loop through the lines and change them all to black, however simply setting a fgcolor of black does not work as they are rtf fields. Do I need to parse the rtf and replace all the colours with black?

Any easier way to do this?

Thanks

Bevil

Hi Bevil,

in css you can also set the foreground color, ie:

odd {
	background-color: #F7F7FF;
	color: #000000;
}

even {
	background-color: #FFFFFF;
	color: #000000;
}

selected {
	background-color: #CEDFFF;
	color: #000000;
}

But I don’t think that rtf fields will really care about the color property in css.
It seems strange that the onRender would behave differently from the css, applying the foreground color.
I would expect these rtf fields to be displayed the same…

If you really want to get rid of the foregrounds you could do a search on the workspace *.frm files and look for this property in order to delete it.

Hi Marc.

Thank you for the reply.

Yes, that is how my CSS looks already (I used the example.)

I don’t want to remove the fg, I just want to programatically set it to black with a loop through all lines. However since it is in rtf markup, I think it might be a little tricky…

There is a rtf > html > rtf method from Bob, which Robert updated, which I might try (switch it to html and do my loop through that)

If it used to work with onRender, you might as well consider to just set an onRender on the few(?) rtf field you use.
Within the onRender you just set the foreground to black.