trichview.com

trichview.support




Re: Bug in RichView - merging styles of newly inserted rvf documents.


Return to index


Author

Message

John Wertz

Posted: 04/29/2003 3:03:55


Sergey:


I must not have explained the problem well enough so let me clairify.


1) I am using only Table.Cells[x, y].InsertRVFFromStream and

richview.InsertRVFFromStream, not the LoadRVF methods.


2) In the solution I provided I am freeing only the PRVIntegerList variables

(PTextStylesMapping^, PParaStylesMapping^, and PListStylesMapping^) and not

the actual style mappings. These variables, and others assigned the same

value, are used only in the scope of the InsertRVFFromStream method and

nowhere else in any of the RichView units. Freeing them after the

InsertRVFFromStream finishes, solves the problem I described.



Problem Clairification:


My application uses one RichView component, lets call it richview1. At

runtime, richview1 displays a document comprised of several smaller rvf

documents stored in streams and all of them have styles stored with them.

Each rvf stream stores a unique text style that must be merged when the

stream is inserted into richview1. Here is a piece of code to help

illustrate the problem:


****

//Some code

table1.Cells[0, 0].InsertRVFFromStream(stream1, Table1.Cells[0, 0].ItemCount

, dummy1, dummy2, dummy3, FALSE);

//more code

table1.Cells[0, 1].InsertRVFFromStream(stream2, Table1.Cells[0, 1].ItemCount

, dummy1, dummy2, dummy3, FALSE);

//more code

richview1.InsertRVFFromStream(stream3, richview1.ItemCount);

//more code

richview1.InsertRVFFromStream(stream4, richview1.ItemCount);

//more code

****


The first insert (table1.Cells[0, 0].InsertRVFFromStream) works fine. The

styles are merged and the text is displayed correctly. However, when

TCustomRVData.DoneStyleMapping is called, the PRVIntegerList variables are

not freed and that causes a problem with the next insertion.


The Second insert (table1.Cells[0, 1].InsertRVFFromStream) does not display

correctly, if at all. When the MergeStyles method is called, the

PRVIntegerList variables are still assigned and MergeStyles exits without

taking any action. when TCustomRVData.DoneStyleMapping is called, the

PRVIntegerList variables are not freed and that causes a problem again with

the next insertion.


The Third insert (richview1.InsertRVFFromStream) does not display correctly

for the same reason as above. However, when TRichViewRVData.DoneStyleMapping

is called, the PRVIntegerList variables ARE freed and the next insertion is

completed correctly.


The fourth insertion is completed and displays correctly with styles merged.



Solution:


Freeing the PRVIntegerList variables in TCustomRVData.DoneStyleMapping still

seems to be the correct solution to this problem. After searching all the

RichView units, I can find no other location (outside of

InsertRVFFromStream's scope) where the PRVIntegerList's pointed to by

PTextStylesMapping^, PParaStylesMapping^, and PListStylesMapping^ are

referenced. If this is not correct, please clarify where else these values

are used and how else I can correct this problem. I have reviewed the

MailMerge2 project and it doesn't address the issue I've described.


Thanks again,


John





Powered by ABC Amber Outlook Express Converter