Page 1 of 1

Converting RTF into RVF using invisible RVE

Posted: Thu Sep 07, 2017 4:14 pm
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?

Re: Converting RTF into RVF using invisible RVE

Posted: Fri Sep 08, 2017 7:57 am
by Sergey Tkachenko
You save RVF file without information about font and paragraph attributes.
Include rvfoSaveTextStyles and rvfoSaveParaStyles in Frve.RVFOptions.

Re: Converting RTF into RVF using invisible RVE

Posted: Fri Sep 08, 2017 9:03 am
by vit
Thanks!