Page 1 of 1
TRichviewEdit to TRichView
Posted: Tue Jan 23, 2007 11:28 am
by ChristopheA
Hi there,
Is it possible to transfer part of an RTF formated text of a RichViewEdit to a RichViewEdit, if yes how?
thanks
ChristopheA
Posted: Wed Jan 24, 2007 6:30 pm
by Sergey Tkachenko
Yes, it's possible.
You can save this part in stream as RVF, then load it in another RichViewEdit.
For example, this code loads the selected fragment of RichViewEdit1 to RichViewEdit2:
Code: Select all
var Stream: TMemoryStream;
Stream := TMemoryStream.Create;
RichViewEdit1.SaveRVFToStream(Stream, True);
Stream.Position := 0;
RichViewEdit2.LoadRVFFromStream(Stream);
Stream.Free;
RichViewEdit2.Format;
To copy the whole document, change the last parameter of SaveRVFToStream to False.
This code inserts the selected fragment of RichViewEdit1 in RichViewEdit2, in the caret position:
Code: Select all
var Stream: TMemoryStream;
Stream := TMemoryStream.Create;
RichViewEdit1.SaveRVFToStream(Stream, True);
Stream.Position := 0;
RichViewEdit2.InsertRVFFromStreamEd(Stream);
Stream.Free;