If you store data in another format, such as HTML, you need to process OnSaveCustomFormat and OnLoadCustomFormat events.
Example 1: using TrvHtmlImporter
Code: Select all
procedure TForm1.DBRichViewEdit1SaveCustomFormat(Sender: TCustomRichView;
Stream: TStream; var DoDefault: Boolean);
begin
Sender.SaveHTMLToStreamEx(Stream, ExtractFilePath(Application.ExeName),
'title', 'img', '', '', '', []);
{
or
Sender.SaveHTMLToStream(Stream, ExtractFilePath(Application.ExeName),
'title', 'img', []);
}
DoDefault := False;
end;
procedure TForm1.DBRichViewEdit1LoadCustomFormat(Sender: TCustomRichView;
Stream: TStream; var DoDefault: Boolean);
var s: String;
begin
SetLength(s, Stream.Size);
Stream.ReadBuffer(PChar(s)^, Length(s));
RvHtmlImporter1.LoadHtml(s);
DoDefault := False;
end;
Example 2: using TRvHtmlViewImporter:
All the same, except for
Code: Select all
procedure TForm1.DBRichViewEdit1LoadCustomFormat(Sender: TCustomRichView;
Stream: TStream; var DoDefault: Boolean);
var s: String;
begin
HTMLViewer1.LoadFromStream(Stream);
RVHTMLViewImporter1.ImportHtmlViewer(HTMLViewer1, Sender as TCustomRichViewEdit);
DoDefault := False;
end;