Find RVStyle.TextStyle by name?

General TRichView support forum. Please post your questions here
Post Reply
reiser
Posts: 25
Joined: Sat Jun 25, 2011 8:40 am

Find RVStyle.TextStyle by name?

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
reiser
Posts: 25
Joined: Sat Jun 25, 2011 8:40 am

Post by reiser »

Thank you.
Post Reply