Hi there,
Is it possible to transfer part of an RTF formated text of a RichViewEdit to a RichViewEdit, if yes how?
thanks
ChristopheA
TRichviewEdit to TRichView
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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:
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:
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;
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;