how to insert the document from another SRichViewEdit?

General TRichView support forum. Please post your questions here
Post Reply
yh01110
Posts: 9
Joined: Thu Apr 21, 2011 12:43 am

how to insert the document from another SRichViewEdit?

Post by yh01110 »

when i use this code to add the document to the SRichViewEdit1.
then SRichViewEdit1's document will be use another rvstyle which SRichViewEdit4 is use. so some word in the document will not display correctly.

Code: Select all

  SRichViewEdit4.RichViewEdit.SaveRVFToStream(Stream, false);
  stream.Position:=0;
  SRichViewEdit1.RichViewEdit.InsertRVFFromStream(Stream, SRichViewEdit1.RichViewEdit.ItemCount);
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Your code is correct. It must add the content of SRichViewEdit4 to the end of SRichViewEdit1.
You need to call SRichViewEdit1.Format after this code.

Usually, problems with different RVStyles happen when RVF is saved/loaded without styles. But TSRichViewEdit.RichViewEdit is configured to save and load styles in RVF.

If this code does not work, please send me a simple project reproducing this problem (to richviewgmailcom).
yh01110
Posts: 9
Joined: Thu Apr 21, 2011 12:43 am

Post by yh01110 »

SRichViewEdit1.richviewedit.style=rvs ,
SRichViewEdit4.richviewedit.style= rvs.
but the two document has different formt words ,for example SRichViewEdit4.richviewedit.style.textStyles[14] .color is red¡£but SRichViewEdit1.richviewedit.style.textStyles[14].color is black .when i use that code to add the document ¡£the words which textStyles index is 14 in SRichViewEdit1 will become red¡£i dont woant to change the Original doucment in SRichViewEdit1 .

when i set "SRichViewEdit1.richviewedit.style=Trvstyle.create(nil)" , and load the document in the database. then add the document in the SRichViewEdit4 to SRichViewEdit1. The two documents in SRichViewEdit1 whill be display correctly.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There is no need to change SRichViewEdit1.RichViewEdit.Style.
It is assigned by TSRichViewEdit itself.
Post Reply