Nevron Open Vision Documentation
Rich Text Editor / Document Model / Styles / Overview
In This Topic
    In This Topic

    Nevron Text Editor provides support for three types of styles - inline styles, paragraph styles, and tables styles that can be applied to inline, paragraph, and table elements respectively. Each style type defines a set of properties related to the element type the style is meant to style. The styles are stored in the Styles collection of the document block, which by default contains a list of predefined styles. If needed you can also add you own styles, either by adding them manually to the Styles collection or by creating them and calling their Apply method to apply them to a text element.

    Styles are usually referenced by their style id or name, exposed by the StyleId and StyleName properties respectively. If not set, the StyleId property is automatically generated when a style is added to the Styles collection of a document block, which also happens when it is applied to a text element. The StyleName property is user definable and is most commonly used in the commanding UI (ribbon galleries and style split buttons) for style name. You can use the document block's Style collection to find a style by type and style id or name using one of the following methods:

    The code snippet below demonstrates how to get a table style by name and apply it to a table element.

    Getting a style by type and name
    Copy Code
    NRichTextStyle style = documentBlock.Styles.FindStyleByTypeAndId(ENRichTextStyleType.Table, "GridTable2Blue");
    Note that the Styles collection does not accept styles with duplicating style IDs, i.e. if you try to add a style and a style with the same StyleId already exists in the collection, the new style will be rejected.
    See Also