Combining Two Different RVF Documents Into A Third

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Combining Two Different RVF Documents Into A Third

Post by DickBryant »

Hi Sergey,

I'm trying to load two RVF documents each containing a table. Each document has a different set of fonts. I want to load each document into a different RVE and then take rows from each of the tables and add them to an identically-structured table in a third RVE. I want the fonts in the original RVE's to appear in the new, third, RVE.

I am so far attempting this by having all three RVE's reference the same RVSTyle and use a fourth, hidden RVE to copy from rows in the first two documents and then append into rows in the third document.

It SEEMS like this should work from what I have working in other places in the application and what I've read here. The problem is that when I open the second document, it seems to clear the contents of the common RVStyle, even though the first document is still active in the first RVE. This, of course, changes the effective fonts in the first document.

How to have the opening of the second document simply 'add' its fonts to the common RVStyle so that the save/restore to/from the hidden rvedit can correctly transfer fonts between cells in either the first or second rve's table to cells in the third rve's table??

Thanks in advance :-)
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Assuming that documents are stored in Stream1 and Stream2:

Code: Select all

rv.Clear;
rv.DeleteUnusedStyles(True, True, True);
rv.InsertRVFFromStream(Stream1, rv.ItemCount);
rv.InsertRVFFromStream(Stream2, rv.ItemCount);
rv.Format;
Unlike RVF loading methods, RVF inserttion methods do not replace the collections of styles but merge them (in "Allow adding styles dynamically" mode).

If documents are in files, use TFileStream.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Thank you, Sergey - that solved the problem!
Post Reply