TRVStyleTemplateCollection.InsertFromRVST

<< Click to display table of contents >>

TRVStyleTemplateCollection.InsertFromRVST

Applies styles from the file to the collection.

function InsertFromRVST(const FileName: TRVUnicodeString;

  Units: TRVStyleUnits): Boolean;

Files of "RichView Styles" format contain style templates. Normally they have "rvst" extension. They can be created by SaveToRVST method.

This method loads style templates from the file. If style templates of the same names already exist, properties of existing style templates are overridden from the file. Otherwise, new style templates are added to the collection. Units of loaded style templates are converted to Units.

Example: applying styles from a file to RichViewEdit1

var
  StyleTemplates: TRVStyleTemplateCollection;
begin
  if not OpenDialog1.Execute then
    exit;
  StyleTemplates := TRVStyleTemplateCollection.Create(nil);
  try
    StyleTemplates.AssignStyleTemplates(rvs.StyleTemplates, True);
    if not StyleTemplates.InsertFromRVST(OpenDialog1.FileName,

      RichViewEdit1.Style.Unitsthen
      exit;
    RichViewEdit1.ChangeStyleTemplates(StyleTemplates);
  finally
    StyleTemplates.Free;
  end;
end;