Re: setting text color in Rich Edit

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's what I found at

It's basically an excerpt from the RTF specification.  It's probably easier
to save everything in text format, and color code on the fly.  Set up your
color table at the beginning, and insert the color formatting as you go.  To
color text on the fly, you could select the word in question, and replace it
with the rich text formatting.

Color Table
The \colortbl control word introduces the color table group, which defines
screen colors, character colors, and other color information. This group has
the following syntax:

<colortbl> '{' \colortbl <colordef>+ '}'
<colordef> \red ? & \green ? & \blue ? ';'


The following are valid control words for this group:

Control
Word Meaning
\redN Red index
\greenN Green index
\blueN Blue index


Each definition must be delimited by a semicolon, even if the definition is
omitted. If a color definition is omitted, the RTF reader uses its default
color. The example below defines the default color table used by Word. The
first color is omitted, as shown by the semicolon following the \colortbl
control word. The missing definition indicates that color 0 is the ''auto''
color.

\red0\green255\blue0;

The foreground and background colors use indexes into the color table to
define a color. For more information on color setup, see your Windows
documentation.

The following example defines a block of text in color (where supported).
Note that the cf/cb index is the index of an entry in the color table, which
represents a red/green/blue color combination.

{\f1\cb1\cf2 This is colored text. The background is color
1 and the foreground is color 2.}

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu