- 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.
|Gets a command to capitalize each word in the selected sentence.
|Gets a command to change the background color of characters in a selected range.
|Gets a command to change the bold formatting of characters in a selected range.
|Gets a command to change the font color of characters in a selected range.
|Gets a command to change the font formatting of characters in a selected range.
|Gets a command to change the italic formatting of characters in a selected range.
|Gets a command to change the font name of characters in a selected range.
|Gets a command to change the font size (in points) of characters in a selected range.
|Gets a command to change the strikeout formatting of characters in a selected range.
|Gets a command to change the subscript formatting of characters in a selected range.
|Gets a command to change the superscript formatting of characters in a selected range.
|Gets a command to change the underline formatting of characters in a selected range.
|Gets a command to reset textual and paragraph formatting in the selected range to default values.
|Gets a command to decrease the selected range’s font size to the closest smaller predefined value (in points).
|Gets a command to increase the font size of characters in a selected range to the closest larger predefined value (in points).
|Gets a command to convert selected text to lower case.
|Gets a command changing all selected text to the sentence case capitalization.
|Gets a command to convert selected text to upper case.
|Gets a command to invoke the Font dialog window.
|Gets a command to switch the text capitalization in the selection.
|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.
|Returns information about character styles in the document.
To apply a character style to the text, use the following changeStyle client command in the notation given below.
|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.