Page 1 of 1

Multiple TrichviewEdit Components with one RVStyle component

Posted: Tue Aug 20, 2013 2:41 pm
by Jim
Hi,
I’m making software to automatically generate documents.
To do this I need to make a Template.
This template has for each chapter a page with settings.
I have 13 in total.
To make it simple, let’s keep it at 3, An Into, Foreword and Endnotes.
Each of those Pages have a TrichviewEdit Component on it.
All three of the use the same TRVStyle.
I want to use only one fixed Global Style for everything.
I have noticed now that a style used in TrichviewEdit1, is not used in TrichviewEdit2
I Select a style ( ex. Heading1) but for some reason I end up with an extra style, which I think is a copy of my original selected style.
What is the proper way of doing this?

Posted: Tue Aug 20, 2013 3:20 pm
by Sergey Tkachenko
I Select a style ( ex. Heading1) but for some reason I end up with an extra style
What do you mean by selecting a style?

Posted: Fri Aug 23, 2013 6:25 am
by Jim
It took me some time to figure out how the styles work.
I still can't say I understand it 100%.

Both RVE-components have '.usestyleTemplates' activated (= true).

When I now add text using the '.AddNL' command, I see that there are new text styles added which are copy's of the original styles. And I just cant understand why.
When '.usestyleTemplates' is not active, it does't add those text styles, and the result seems to be the same.
I need to have this option activated, becouse I need 'ApplyStyleTemplate' to work.

I understand the need of those text syles, but problem is that when I let the user make a profile with my program, and he plays around for 1/2 a day, I end up with 210 Texst styles, and the worst part is, almost all of them are copy's of the original syles...

I looks every RVE adds its own text style, regardless of it is already existing.
With Paragraph syles This problem dos'nt seem to be there...

Posted: Fri Aug 23, 2013 8:47 am
by Sergey Tkachenko
When StyleTemplates are used, for each text item, TextStyle.ParaStyleTemplateId must be the same as ParaStyle.StyleTemplateId. If they do not match, the component fixes the problem automatically. This fix may involve adding a new text style, if the desired text style does not exist.

I recommend using a single text style for multiple RichViews only if they use a fixed set of TextStyles, ParaStyles and ListStyles. If you use editing operations (including operations with StyleTemplates) that can add new styles, this is undesirable.

PS: even if you use different RVStyles, they can share the same collection of StyleTemplates. Choose one TRVStyle component as a main TRVStyle, and use its StyleTemplates collection. For other TRVStyle components, assign MainRVStyle property = the main TRVStyle component.