I'm using an TrichViewEdit and trying to export RTF with embedded images,
but after exporting, the resulting RTF seems to contain non-standard-conform images.
Opened in WordPad or MS-Word all looks fine, but with Openoffice or importet to a TRichView all images are broken or missing.
Thats very unfortunate, because i can't exchange data between a RichViewEdit and a RichView without losing all images.
Is there any solution? Do I miss any options?
Here is some example code, a full project can be provided if necessary.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
procedure InsertBitmap(re: TRichViewEdit; aBmp : TBitmap);
var
bmp : TBitmap;
begin
bmp := TBitmap.Create;
try
bmp.Width := aBmp.Width;
bmp.Height := aBmp.Height;
bmp.Canvas.Draw(0, 0, aBmp);
re.AddPictureEx('', bmp, -1, rvvaBaseline);
finally
//Freed by RichView
end;
end;
begin
//Build up data
RichViewEdit1.Clear;
RichEdit1.Clear;
RichViewEdit1.AddNL('Here is the Image:', 0, 0);
InsertBitmap(RichViewEdit1, Image1.Picture.Bitmap);
RichViewEdit1.Format;
//Copy to RichEdit
CopyToRichEdit();
//Now all images are missing in RichEdit1
end;
procedure TForm1.CopyToRichEdit();
var
strm : TMemoryStream;
begin
strm := TMemoryStream.Create;
try
RichViewEdit1.SaveRTFToStream(strm, false);
strm.Position := 0;
RichEdit1.Lines.LoadFromStream(strm);
finally
strm.Free;
end;
end;