Controls are not saved in RTF or HTML. OnSaveComponentToFile event occurs instead (I believe you use event code from one of demo projects that inserts the class name). In this event you can provide code representing this control (but if cause, you need to know RTF/HTML to process it).
Saving TOleContainer in RTF is discussed here: http://www.trichview.com/forums/viewtopic.php?t=118
Sergey Tkachenko wrote:Controls are not saved in RTF or HTML. OnSaveComponentToFile event occurs instead (I believe you use event code from one of demo projects that inserts the class name). In this event you can provide code representing this control (but if cause, you need to know RTF/HTML to process it).
Saving TOleContainer in RTF is discussed here: http://www.trichview.com/forums/viewtopic.php?t=118
I have looked at the above topic but it is confusing to me. How do I use it? When I place it within an existing PAS file, a bunch of errors about missing declarations pop up. If I am not mistaken, the code refers to saving to a file. I need code to save to a blob and also to retrieve it back for display/edit.
I am using the following OnSaveComponentToFile Event code:-
procedure TfrmInstruct.rchContentSaveComponentToFile(Sender: TCustomRichView;
Path: String; SaveMe: TPersistent; SaveFormat: TRVSaveFormat;
var OutStr: String);
begin
case SaveFormat of
rvsfText:
begin
OutStr := '('+SaveMe.ClassName+')';
end;
rvsfHTML:
begin
if SaveMe is TButton then begin
OutStr := '<INPUT type="button" value="'+TButton(SaveMe).Caption+'" '+
'onClick="alert(''Just a demo'')">';
exit;
end;
if SaveMe is TEdit then begin
OutStr := '<INPUT type="text" value="'+TEdit(SaveMe).Text+'">';
exit;
end;
end;
rvsfRTF:
begin
OutStr := '\plain\b ('+SaveMe.ClassName+')';
end;
end;
end;