When I try to load an RTF file using RichEdit1.Lines.LoadFromFile(FilePath)
method and RichEdit1.ReadOnly = True
then the RichEdit removes all images from the RTF file and shows an empty area in their place:
procedure TForm1.Button1Click(Sender: TObject);
var
BasePath: String;
FilePath: String;
begin
GetDir(0, BasePath);
FilePath := BasePath + '\TestRtfFileMS.Rtf';
RichEdit1.Lines.LoadFromFile(FilePath);
RichEdit2.ReadOnly := True;
RichEdit2.Lines.LoadFromFile(FilePath);
end;
How do I fix this?
I solved it as follows.
First, write the *.rtf file containing the image in the "Word". (It should Not be written in the "Wordpad".)
At runtime, the rtf file is imported into TRichEdit and set to ReadOnly = True. (Not desigetime)
.