Sharing styles between RichViewEdit, RVHEader and RVFooter

General TRichView support forum. Please post your questions here
Post Reply
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Sharing styles between RichViewEdit, RVHEader and RVFooter

Post by vit »

Hi!

I use the same TRVStyle for RichViewEdit, RVHEader and RVFooter of TSRichViewEdit (ExternalRVStyle, ExternalRVStyleHeader and ExternalRVStyleFooter).

If style A is only used by RVHEader and style B by RVFooter, TSRichViewEdit.RichViewEdit.DeleteUnusedStyles will delete all them. Is there way to change this behaviour? I need to every editor of TSRichViewEdit take into account which styles uses other editors.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In the current version, RichViewEdit, RVHeader and RVFooter must be linked to different RVStyles. Otherwise they work incorrectly.
JonRobertson
Posts: 164
Joined: Tue Nov 08, 2011 5:11 pm

Post by JonRobertson »

What are some problems this could cause? Is it just management functions like DeleteUnusedStyles that are problematic? Or perhaps document editing via the visual component versus method calls?

If I have the styles set before document generation, never alter the styles during document generation, generate all document content via code, then save the RVF to stream, will there be problems?

I'm curious because I've always used the same style component generating RVF documents with headers and footers. I'll have to triple the number of style components I'm using across the entire project, and each of the new ones will simply be a duplicate of the existing ones. :(
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Well, I think DeleteUnusedStyles is the main problem.
Additionally, when reading RVF, when reading header/footer, styles are replaced. But since styles saved for header/footer will be the same as the main document, it should not be a problem.
Also, if StyleTemplates are used, styles are cleared before reading header/footer. This is a critical problem, because they cannot be restored. But it happens only if UseStyleTemplates=True.

Well, all these problems could be solved on the component level, I just do not think that this problem is too important.
JonRobertson
Posts: 164
Joined: Tue Nov 08, 2011 5:11 pm

Post by JonRobertson »

In general should a TRVStyle component only be used by a single source of RVF content?
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes.
A single RVStyle for multiple RichView may be useful if you use a fixed set of styles (for example, displaying messages in UI)
Post Reply