Find RVStyle.TextStyle by name?
Find RVStyle.TextStyle by name?
Is it possible to find RVStyle.TextStyle by it's name? There are various FindStyleWith*() functions, but none accepts style name as parameter.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Yes, there is no such method.
You can implement it yourself:
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.
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;
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.