Converting RTF into RVF using invisible RVE

General TRichView support forum. Please post your questions here
Post Reply
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Converting RTF into RVF using invisible RVE

Post by vit »

Hi!

This question is related to the question I've asked before http://www.trichview.com/forums/viewtop ... f307f83c2a.

So I chose the second option with invisible form and converting RTF into RVF. The problem is initial styles in RTF differ from styles I get in RVF while converting and therefore from styles that I get in TRichView where I insert the text to.

Here is the source RTF I want to insert into TRichView https://drive.google.com/open?id=0ByzSd ... TRvZkRONmM.

And here is the way I insert that RTF into the hidden TRichViewEdit:

Code: Select all

  
  function RTFToRVE(RTF: TStream): TStream;
  begin
    FRve.Clear;
    FRve.DeleteUnusedStyles(True, True, True);
    if not FRve.LoadRTFFromStream(RTF) then
      raise ERTFException.Create('Error RTF load!');
    FRve.Format;

// And just now save the text in two formats
    FRve.SaveRTF('C:\***\Value.rtf', False);
    FRve.SaveRVF('C:\***\Value.rve', False);
  end
Now here are that files Value.rtf (https://drive.google.com/open?id=0ByzSd ... jZWY1RKV28) and Value.rve (https://drive.google.com/open?id=0ByzSd ... G54NFNYdFE). You can see that font differs. Font in Values.rtf is correct, in Values.rvf is not.

I've set TextStyleMode and ParaStyleMode to the invisible RVE but it doesn't help

Code: Select all

  FRve.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
  FRve.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
Do I need to set any other settings?
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Converting RTF into RVF using invisible RVE

Post by Sergey Tkachenko »

You save RVF file without information about font and paragraph attributes.
Include rvfoSaveTextStyles and rvfoSaveParaStyles in Frve.RVFOptions.
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Re: Converting RTF into RVF using invisible RVE

Post by vit »

Thanks!
Post Reply