SetCharColor Method

Sets the color for the specified character block of the shape's text.

Applies to: Shape object

Syntax

object.SetCharColor ( iFrom, iTo, [ irc], [gm], [by], [bk], [bTransparent] )

The SetCharColor method syntax has these parts:

Part Description
object

Required. An expression that returns an object in the Applies to list.

iFrom Required. An expression that returns a Long value. The index of the first character in the character block.
iTo Required. An expression that returns a Long value. The index of the last character in the character block.
irc

Optional. An expression that returns an Integer value.
The possible options for this parameter:
- Index color: the index of the color in the color palette of the document which owns the object shape. The valid range is from 1 to the number of the colors in the color palette of the document.
- RGB color: the red component of the color. The valid range is from 0 to 255.
- CMYK color: the cyan component of the color. The valid range is from 0 to 100.
The default value is -1.

gm Optional. An expression that returns an Integer value.
The possible options for this parameter:
- RGB color: the green component of the color. The valid range is from 0 to 255.
- CMYK color: the magenta component of the color. The valid range is from 0 to 100.
The default value is -1.
by Optional. An expression that returns an Integer value.
The possible options for this parameter:
- RGB color: the blue component of the color. The valid range is from 0 to 255.
- CMYK color: the yellow component of the color. The valid range is from 0 to 100.
The default value is -1.
bk

Optional. An expression that returns an Integer value.
The possible options for this parameter:
- CMYK color: the black component of the color. The valid range is from 0 to 100.
The default value is -1.

bTransparent Optional. An expression that returns a Boolean value. A flag which is True when the character block is transparent, and False if the character block is not transparent. The default value is False.

Remarks

Note, that if the character block doesn't include the character block within the iFrom to iTo range, the SetCharColor method adds a new character block and sets the specified color to it.

The format of the color for the character block is described in the following way. If all four components of a CMYK color are set, that is, the irc, gm, by and bk parameters are equal to or greater than 0 and less than or equal to 100, the color is considered a CMYK color. Otherwise, if only the RGB components are set, that is, the irc, gm, by parameters are equal to or greater than 0 and less than or equal to 255, and bk is less than 0 or greater than 100, the color is considered an RGB color. Otherwise, the color is considered an indexed color with the irc index in the color palette of the document - if the irc parameter is greater than or equal to 1 and less than or equal to the number of the colors in the color palette of the document which owns the object shape. In all other cases the color of the character block is not altered and only the transparency parameter bTransparent is applied.

 

See Also

Character method, CharactersNum method, GetCharacterIndex method, RemoveCharacter method, SetCharFont method, SetCharHyperlink method, SetCharLanguage method, SetCharPos method, SetCharSize method, SetCharSpacing method, SetCharStyle method, Character object