TMSFNCRichEditor - Pictures disappear when switching FMX/VCL

I wanted to use the TMSFNCRichEditor component in both an FNC and FMX application. However, the output result does not seem to be the same. Specifically, the text works, but the images are only not displayed in the other application.

To reproduce this, the following procedure:

  • Place the TMSFNCRichEditor + TMSFNCRichEditorEditToolBar component on the form.
  • Start the application
  • Enter a text and a picture in the document
  • Use the Save button to save the result in a document (RTF or RTFE)
  • Open the document with the other application
  • The images are missing here

When I load a document saved by the VCL version in the FMX version, it often gives an error message too:
Access violation at address 6567616D

Am I doing something wrong or is it a bug in the component (which I strongly suspect)?

We see there is indeed a conflict, due to FMX picture types being different than VCL picture types.
We will investigate if we can handle this.
As an alternative for now, you can use the .RTF format via TTMSFNCRichEditorRTFIO

Exporting to a file works with TTMSFNCRichEditorRTFIO, but not when I save it to a MySQL database.

In this case only the text is displayed when I open it with the other version (VCL/FMX).Is my method wrong in this case or is it the same cause?

My save function (simplified):

procedure SaveText;
var
  BlobStream : TMemoryStream;

begin
  BlobStream := TMemoryStream.Create;
  try
    BlobStream.Clear;
    BlobStream.Position := 0;
    RTFIO1.RichEditor.SaveToStream(BlobStream);
    BlobStream.Position := 0;

    quSave.SQL.Text := 'UPDATE FAQ_THEMEN SET ' +.
                       'QUESTION = :question ' +
                       'WHERE ID = 2';
    quSave.ParamByName('QUESTION').LoadFromStream(BlobStream, ftBlob);
    quSave.ExecSQL;
  finally
    BlobStream.Free;
  end;
end;

My load function (simplified):

procedure LoadText;
var
  BlobStream : TMemoryStream;

begin
  BlobStream := TMemoryStream.Create;
  try
    try
      TBlobField(quFAQ.FieldByName('QUESTION')).SaveToStream(BlobStream);
      BlobStream.Position := 0;
      RTFIO1.RichEditor.LoadFromStream(BlobStream);
    except
      on E:Exception do
      begin
        MessageDlg('Error preparing the data...' +
                    slinebreak +
                    slinebreak +
                    e.classname+':'+e.message,mtWarning, [mbOK], 0);
       result := false;
      end;
    end;
  finally
    BlobStream.Free;
  end;
end;

My problem now is, should I use the component for my project or not - > data consistency?
Can I assume that the VCL component will work properly?

I hope they can fix the incompatibility.

By the way, why is the file format (extension) called *.rtfe (FMX) in one case and *.rte (VCL) in the other?

Best thanks and Merry Christmas.

  1. if you persist in RTF in the DB, VCL and FMX should be able to read it.
    If what you write in the DB field is exactly the same as what is written to file, it should work.
  2. The proprietary binary file format is .RTE. It is based on component streaming of Delphi. This is the reason of the issue as the VCL framework streams the TPicture different than the FMX framework. We'll need to look to change this to custom streaming to make it compatible.
    There is nothing known as .RTFE. Other than .RTE, there is the standard .RTF file format.