TRVStyleTemplate.ApplyToParaStyle

<< Click to display table of contents >>

TRVStyleTemplate.ApplyToParaStyle

Changes properties of AParaStyle according to the properties of this style template.

procedure ApplyToParaStyle(AParaStyle: TCustomRVParaInfo);

The method changes only properties of AParaStyle not listed in AParaStyle.ModifiedProperties. If you want to change all properties, assign AParaStyle.ModifiedProperties=[] before calling this method. If you want to change only properties controlled by style templates, call UpdateModifiedParaStyleProperties before calling this method.

Applying a style template means applying properties of its ParaStyle listed in ValidParaProperties, and properties inherited from Parent.

Kind of this style template must be either rvstkPara or rvstkParaText.

The sequence of operations:

1.The method applies this style template (and its parents) to AParaStyle. The method assigns AParaStyle.StyleTemplateId = Id. This method may be called for nil-objects; in this case, it just assigns AParaStyle.StyleTemplateId = -1.

2.Then it resets remaining properties of AParaStyle to default values.

 

Example: resetting TextStyles and ParaStyles for using in new documents, using 'Normal' style template.

var StyleTemplate: TRVStyleTemplate;

begin

  RVStyle.ListStyles.Clear;

  RVStyle.TextStyles.Clear;

  RVStyle.TextStyles.Add;

  RVStyle.ParaStyles.Clear;

  RVStyle.ParaStyles.Add;

  StyleTemplate := RVStyle.StyleTemplates.NormalStyleTemplate;

  if StyleTemplate<>nil then begin

    RVStyle.ParaStyles[0].ModifiedProperties := [];

    StyleTemplate.ApplyToParaStyle(RVStyle.ParaStyles[0]);

    RVStyle.TextStyles[0].ModifiedProperties := [];

    TRVStyleTemplate(nil).ApplyToTextStyle(

      RVStyle.TextStyles[0], StyleTemplate);

    RVStyle.TextStyles[0].ParaStyleTemplateId := StyleTemplate.Id;

  end;

end;

See also:

ApplyToTextStyle