<< Click to display table of contents >>


Applies the specified style template to the selected text items, tabs, label items (and to items of all types inherited from label items).

procedure ApplyTextStyleTemplate(TemplateNo: Integer; 

  ResetAdditionalFormatting: Boolean; Recursive: Boolean=True);

(introduced in version 14)

This procedure assigns the specified style template to text styles of the selected items.


TemplateNo index in the collection Style.StyleTemplates, or the value -1. The value -1 means a format clearing (see below). The style template must have Kind = rvstkParaText or rvstkText. The only exception is "Normal" style template: applying it clears text format as well, but ResetAdditionalFormatting is respected.

If ResetAdditionalFormatting=True, all properties of the specified style template will be applied. If ResetAdditionalFormatting=False, only "unmodified" properties (see below) will be changed. This parameter is ignored if TemplateNo=-1.

If Recursive = False, this method does not change styles in cells of selected tables (except for the case of multicell selection in a single table).


This method does nothing if UseStyleTemplates=False and TemplateNo>=0.

If items are formatted with text styles having rvprStyleProtect in their Protection, this method skips them.

Format clearing

A format clearing means resetting all text attributes to default values. If a paragraph style template (ParaStyleTemplateId) is assigned, it defines these default values. A special processing is performed for hyperlinks (i.e. text styles with Jump=True): if "Hyperlink" style template exists, it is applied (in other words, the method works like applying this style template with ResetAdditionalFormatting=True).

If UseStyleTemplates=False and TemplateNo<0, the results are identical to calling ApplyTextStyle(0).

Modified properties

Properties of a text style are considered modified, if they have values different from values of the corresponding properties of the current style templates (referred in StyleTemplateId and ParaStyleTemplateId properties). If none of these style templates are assigned, the properties are considered modified of they have non-default values. The method ignores ModifiedProperties property (it calculates this property itself).


Method type: editstyle editing-style.

See also: