RichText.GetSelectionFormat

table RichText.GetSelectionFormat (

string ObjectName,

boolean OnlyConsistentAttributes = true )

Description

Returns a table describing the character format of the current selection in a richtext object.

Parameters

ObjectName

(string) The name of the richtext object.

OnlyConsistentAttributes

(boolean) Whether the table should only contain attributes that are consistent throughout the selection. (If true, any mixed attributes will be nil. If false, the table will describe all attributes of the first parts of the selection.)

VALUE

DESCRIPTION

true

Only contain attributes consistent throughout selection (mixed attributes will be nil). (Default)

false

Describe all attributes of the first parts of the selection.

Returns

(table) A table describing the character format of the current selection in a richtext object, indexed by the following values. If there is no selection or an error occurs, nil is returned. You can use Application.GetLastError to determine whether this action failed, and why.

Note: Some of the following table items are included only for compatibility with Microsoft Text Object Model (TOM) interfaces; the rich edit control stores the value but does not use it to display text. The functionality of some of the items may also depend on the version of the rich edit control available on the system.

KEY

TYPE

DESCRIPTION

AllCaps

boolean

True if the selected characters are all capital letters and false if they are not. This value applies only to versions earlier than Rich Edit 3.0.

AutoBackColor

boolean

True if the background color is the object's background color for selected text (BackColor is ignored), false if BackColor is used.

AutoColor

boolean

True if the text color is the objects text color for selected text (TextColor is ignored), false if TextColor is used.

Bold

boolean

True if the selected text is bolded, false if it is not.

Disabled

boolean

True if characters are displayed as disabled, false if they are not.

Emboss

boolean

True if the characters are embossed, false if they are not. (This item has no effect on displayed text in the object.)

Hidden

boolean

True if the characters are displayed, false if they are not. This item is only supported for Rich Edit 3.0 and later.

Imprint

boolean

True if characters are displayed as imprinted characters, false if they are not. (This item has no effect on displayed text in the object.)

Italic

boolean

True if characters are italic, false if they are not.

Link

boolean

True if the selection contains links, false if it does not.

Outline

boolean

True if characters are displayed as outlined characters, false if they are not. (This value has no effect on displayed text in the object.)

Protected

boolean

True if the characters are protected, false if they are not.

Revised

boolean

True if characters are marked as revised, false if they are not.

Shadow

boolean

True if the characters are displayed as shadowed characters, false if they are not. (This value has no effect on displayed text in the object.)

SmallCaps

boolean

True if characters are in small capital letters, false if they are not. (This value has no effect on displayed text in the object.)

StrikeOut

boolean

True if characters are struck out, false if they are not.

SubScript

boolean

True if the characters are subscript, false if they are not.

SuperScript

boolean

True if the characters are superscript, false if they are not.

Underline

boolean

True if the characters are underlined, false if they are not.

Height

number

The height of the characters in twips.

YOffset

number

The character offset from the baseline, in twips. If this value is positive, the character is a superscript; if the value is negative, the character is a subscript.

TextColor

number

The text color. This item is ignored if AutoColor is set to true.

CharacterSet

number

The character set of the text:

CONSTANT

VALUE

DESCRIPTION

ANSI_CHARSET

0

ANSI character set.

BALTIC_CHARSET

186

Baltic character set.

CHINESEBIG5_CHARSET

136

Chinese character set.

DEFAULT_CHARSET

1

Default character set.

EASTEUROPE_CHARSET

238

Eastern European character set.

GB2312_CHARSET

134

GB2312 character set.

GREEK_CHARSET

161

Greek character set.

HANGUL_CHARSET

129

Hangul character set.

MAC_CHARSET

77

MAC character set.

OEM_CHARSET

255

OEM character set.

RUSSIAN_CHARSET

204

Russian character set.

SHIFTJIS_CHARSET

128

Shiftjis character set.

SYMBOL_CHARSET

2

Symbol character set.

TURKISH_CHARSET

162

Turkish character set.

PitchAndFamily

number

The font family and pitch. See MSDN: CHARFORMAT2 Structure for more information.

FaceName

string

The name of the font used in the selected text.

Weight

number

The weight of the font (how 'dark' the text is):

CONSTANT

VALUE

DESCRIPTION

FW_DONTCARE

0

Font weight not specified.

FW_THIN

100

Font weight 'thin'.

FW_EXTRALIGHT

200

Font weight 'extra-light'.

FW_LIGHT

300

Font weight 'light'.

FW_NORMAL

400

Font weight 'normal'.

FW_MEDIUM

500

Font weight 'medium'.

FW_SEMIBOLD

600

Font weight 'semi-bold'.

FW_BOLD

700

Font weight 'bold'.

FW_EXTRABOLD

800

Font weight 'extra bold'.

FW_HEAVY

900

Font weight 'heavy'.

Spacing

number

The horizontal space between letters, in twips. (This value has no effect on displayed text in the object. It is included for compatibility with Microsoft WindowsText Object Model (TOM) interfaces.)

BackColor

number

The background color. This value is ignored if AutoBackColor is set to true.

LCID

number

The locale identifier of the selected text. (This value has no effect on displayed text in the object.) See MSDN: CHARFORMAT2 Structure for more information.

Kerning

number

The value of the font size, above which to kern the character (Height). (This value has no effect on displayed text in the object. It is included for compatibility with Microsoft WindowsText Object Model (TOM) interfaces.)

Style

number

The character style handle. (This value has no effect on displayed text in the object. It is included for compatibility with Microsoft WindowsText Object Model (TOM) interfaces.)

UnderlineType

number

The underline type specified by one of the following values:
CFU_CF1UNDERLINE (255) - Contains a CHARFORMAT type of underline.
CFU_UNDERLINENONE (0) - No underline. This is the default.
CFU_UNDERLINE (1) - Solid underlined text.
CFU_UNDERLINEWORD (2) - Underline words only. The object displays the text with a solid underline.

CFU_UNDERLINEDOUBLE (3) - Double-underlined text. The object displays the text with a solid underline.
CFU_UNDERLINEDOTTED (4) - Dotted underlined text. For versions earlier than Rich Edit 3.0, text is displayed with a solid underline.

Animation

number

The text animation type. (This value has no effect on displayed text in the object. It is included for compatibility with TOM interfaces.)

RevAuthor

number

An index that identifies the author making a revision. The rich edit control uses different text colors for each different author index.

ResultVariable

When adding an action with the script editor, you can use this field to specify a variable that the return value will be stored in.

See also: Related Actions