- 4 minutes to read
A textual content of a sub-document is represented by a set of characters maintained by the sub-document's text buffer. Groups of characters with a uniform format inside a paragraph form text runs.
A run is an internal entity, not available using API; however, it may be useful to understand how text buffer parts are logically organized depending upon the applied text formatting.
All characters inside a run have a common set of formatting properties defined. Characters can be formatted using specific settings for font, font size, character style - bold, italics, underlined, strike-through; and different colors for background and foreground. Information about character formatting is exposed by client API through the properties of the FontFormattingSettings client object. This object is used in the changeFontFormatting client command (RichEditCommands.changeFontFormatting): in its execute method's parameter and in the getState method's return value.
The following client commands are available for applying character formatting directly to the text. Call the commands in the notation given below.
|capitalizeEachWordTextCase||RichEditCommands.capitalizeEachWordTextCase||Gets a command to capitalize each word in the selected sentence.|
|changeFontBackColor||RichEditCommands.changeFontBackColor||Gets a command to change the background color of characters in a selected range.|
|changeFontBold||RichEditCommands.changeFontBold||Gets a command to change the bold formatting of characters in a selected range.|
|changeFontForeColor||RichEditCommands.changeFontForeColor||Gets a command to change the font color of characters in a selected range.|
|changeFontFormatting||RichEditCommands.changeFontFormatting||Gets a command to change the font formatting of characters in a selected range.|
|changeFontItalic||RichEditCommands.changeFontItalic||Gets a command to change the italic formatting of characters in a selected range.|
|changeFontName||RichEditCommands.changeFontName||Gets a command to change the font name of characters in a selected range.|
|changeFontSize||RichEditCommands.changeFontSize||Gets a command to change the font size (in points) of characters in a selected range.|
|changeFontStrikeout||RichEditCommands.changeFontStrikeout||Gets a command to change the strikeout formatting of characters in a selected range.|
|changeFontSubscript||RichEditCommands.changeFontSubscript||Gets a command to change the subscript formatting of characters in a selected range.|
|changeFontSuperscript||RichEditCommands.changeFontSuperscript||Gets a command to change the superscript formatting of characters in a selected range.|
|changeFontUnderline||RichEditCommands.changeFontUnderline||Gets a command to change the underline formatting of characters in a selected range.|
|clearFormatting||RichEditCommands.clearFormatting||Gets a command to reset textual and paragraph formatting in the selected range to default values.|
|decreaseFontSize||RichEditCommands.decreaseFontSize||Gets a command to decrease the selected range's font size to the closest smaller predefined value (in points).|
|increaseFontSize||RichEditCommands.increaseFontSize||Gets a command to increase the font size of characters in a selected range to the closest larger predefined value (in points).|
|makeTextLowerCase||RichEditCommands.makeTextLowerCase||Gets a command to convert selected text to lower case.|
|makeTextSentenceCase||RichEditCommands.makeTextSentenceCase||Gets a command changing all selected text to the sentence case capitalization.|
|makeTextUpperCase||RichEditCommands.makeTextUpperCase||Gets a command to convert selected text to upper case.|
|openFontFormattingDialog||RichEditCommands.openFontFormattingDialog||Gets a command to invoke the Font dialog window.|
|switchTextCase||RichEditCommands.switchTextCase||Gets a command to switch the text capitalization in the selection.|
|toggleTextCase||RichEditCommands.toggleTextCase||Gets a command to toggle case for each character - upper case becomes lower, lower case becomes upper.|
To uniformly format multiple separate text intervals, a character style can be used. A character style is a detached container of specific character formatting settings. It allows you to apply a similar format to all required text intervals at once.
If some text formatting property (for example, bold) is set directly within the text as a character property, style formatting is not applied to this setting (the style property setting does not override the explicitly defined character property setting). To reset character formatting, use the RichEditCommands.clearFormatting client command.
A list of character styles can be accessed using the following characterStylesInfo property in the notation given below.
|characterStylesInfo||RichEditDocument.characterStylesInfo||Provides information about character styles in the current document.|
To apply a character style to the text, use the following changeStyle client command in the notation given below.
|changeStyle||RichEditCommands.changeStyle||Gets a command to apply a character or paragraph style settings to text in a selected range.|
There is a number of ribbon commands to help you with character formatting. For more information, see the Formatting Characters topic.