Page 1 of 1

Find RVStyle.TextStyle by name?

Posted: Thu Jul 10, 2014 1:19 pm
by reiser
Is it possible to find RVStyle.TextStyle by it's name? There are various FindStyleWith*() functions, but none accepts style name as parameter.

Posted: Fri Jul 11, 2014 12:41 pm
by Sergey Tkachenko
Yes, there is no such method.
You can implement it yourself:

Code: Select all

StyleIndex := -1;
for i := 0 to RVStyle1.TextStyles.Count-1 do
  if RVStyle1.TextStyles[i].StyleName = StyleName then
    StyleIndex := i;
    break;
  end;
Please not that other Find* methods ignore StyleName property (unless you set the global variable RichViewCompareStyleNames=True).
StyleName makes sense only if you have some predefined set of styles, with unique name and meaning.
In the most cases, TextStyles and ParaStyles are simply used as text and paragraph attributes, and naming it makes no sense.
TextStyles and ParaStyles may be linked to "real styles" - StyleTemplates, and names of StyleTemplates are really important.

Posted: Tue Jul 15, 2014 4:08 pm
by reiser
Thank you.