Styles lost when streaming RVF between TRichViews

General TRichView support forum. Please post your questions here
Post Reply
hoby.smith
Posts: 6
Joined: Wed Apr 29, 2009 5:55 pm
Location: Nixa, MO, USA
Contact:

Styles lost when streaming RVF between TRichViews

Post by hoby.smith »

Hello, Sergey...

Sorry to bother you, but I think I am missing something really obvious. I am trying to copy the contents of a TRichView on one form to a TRichView that is on another form. For some reason, no matter what I do, the styles seem to be lost when I do so (underline, bold, bullets/numbering, etc).

Here is the code I am using to do so:

Code: Select all

var
  aMemStream : TMemoryStream;
begin
  aMemStream := TMemoryStream.Create;
  try
    aSourceRV.SaveRVFToStream(aMemStream, False);
    aMemStream.Position := 0;
    aTargetRV.LoadRVFFromStream(aMemStream);
    aTargetRV.Format;
  finally
    aMemStream.Free;
  end;
end;
Both TRichViews have a TRVStyle with default settings. I have tried calling DeleteUnusedStyles and other things before calling the above code. But, nothing seems to help.

I must be missing something really obvious, because I don't have a problem loading an RVF stream from a file or memory, just when doing this.

Any ideas or directions on what I am missing here?

Thanks...
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Make sure that rvfoSaveTextStyles, rvfoSaveParaStyles are in aSourceRV.RVFOptions.
hoby.smith
Posts: 6
Joined: Wed Apr 29, 2009 5:55 pm
Location: Nixa, MO, USA
Contact:

Post by hoby.smith »

Doh! That did it. :) I was thinking those were on by default, but maybe creating a TRichView at runtime doesn't set them by default? Oh well. That takes care of it. Thanks!
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, components created at runtime have different initial values of some properties. It is because of the backward compatibility.
While it is possible to change default values for new TRichViews placed on a form at design time (see http://trichview.com/help/idh_trichview ... itor_.html ), changing initial values of TRichViews created at runtime would affect existing projects.
Post Reply