Copy content of RichView to other RV

General TRichView support forum. Please post your questions here
Post Reply
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Copy content of RichView to other RV

Post by retwas »

Hello,

I have a application with 2 TRichViewEdit.

I write on the first.
When I click on a button I need to copy the content (with styles, ..) to the second richviewedit.

I try with:
richview2.assign(richview1) but it's don't work

I can save RTF file and load it on richview2 but I don't like that

Does it's exist a fucntion who copy all the content of a richview to an other richview ?

Thanks,
Robin
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post by retwas »

A function like that:

Code: Select all

richview1.copyto(richview2)
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post by retwas »

I try with load/save stream from RVF

Code: Select all

      try
         stream := TMemoryStream.Create;
            
         FrameMessage.rveDocument.SaveRVFToStream(stream, False);
         mailType.yrvMessage.LoadRVFFromStream(stream);
         mailType.yrvMessage.Format;
      finally
         FreeAndNil(stream);
      end;
Then my second richview (yrvMessage) is always egual at '' :(
Sergey Tkachenko
Site Admin
Posts: 17281
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

       stream := TMemoryStream.Create; 
       try 
         FrameMessage.rveDocument.SaveRVFToStream(stream, False); 
         [color=red]stream.Position := 0;[/color]
         mailType.yrvMessage.LoadRVFFromStream(stream); 
         mailType.yrvMessage.Format; 
      finally 
         FreeAndNil(stream); 
      end;
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post by retwas »

I get a "violation acces" message on the "LoadRVFFromStream" :(
Sergey Tkachenko
Site Admin
Posts: 17281
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

May be mailType is not created yet? Or mailType.yrvMessage does not have Style property assigned.
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post by retwas »

Ah yes, I had not RVStyle.. :D

Thanks you
Very fast as always :)
Post Reply