How RichEdit to RichView

General TRichView support forum. Please post your questions here
Post Reply
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

How RichEdit to RichView

Post by miwan »

Hi
I hope your help to copy text from a RichEdit (Delphi IDE) in a RichView (component TRichView).
If possible what is the procedure.
I did like that
RichView1.text := RichEdit1.text ; ---- Error :oops:
RichView1.ADDNL := RichEdit1.text ; ----Error :oops:

I thank all the help
SpoQSI
Posts: 16
Joined: Wed Sep 02, 2015 11:48 am

Post by SpoQSI »

I haven´t tested it yet, but you might try:

Code: Select all

procedure CopyFromRichEditToRichView();
    var strStream: TStringStream;
begin
    RichEdit1.Lines.SaveToStream(strStream);
    RichView1.LoadRTFFRomStream(strStream);
end;
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

More exactly

Code: Select all

procedure CopyRichEditToRV(RichEdit: TRichEdit; RichView: TCustomRichView);
var Stream: TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    RichEdit.Lines.SaveToStream(Stream);
    Stream.Position := 0;
    RichView.Clear;
    RichView.LoadRTFFromStream(Stream);
    RichView.Format;
  finally
    Stream.Free;
  end;
end;
Make sure that RichEdit.PlainText = False;
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

thank you for this quick response that's perfect .
but another solution that stream?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not understand this question, please ask in other words.
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

dear ali
This is good it is concluded
thank you a lot
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

Correction: ali = all (Sergey, SpoQSI) .
Post Reply