Page 1 of 1

Combining Two Different RVF Documents Into A Third

Posted: Mon Nov 06, 2006 1:51 am
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 :-)

Posted: Mon Nov 06, 2006 7:47 am
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.

Posted: Tue Nov 07, 2006 9:53 pm
by DickBryant
Thank you, Sergey - that solved the problem!