To import hyperlinks from RTF, you need also OnReadHyperlink event.
To export hyperlinks to RTF and HTML, you need also OnWriteHyperlink events.
If you use RichViewActions, copy a code for these events from the ActionTest project.
If not, use this code:
Code: Select all
procedure TForm1.RichViewEdit1ReadHyperlink(Sender: TCustomRichView; const Target,
Extras: String; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer;
var ItemName: TRVRawByteString);
begin
ItemTag := Integer(StrNew(PChar(Target)));
end;
procedure TForm1.RichViewEdit1WriteHyperlink(Sender: TCustomRichView; id: Integer;
RVData: TCustomRVData; ItemNo: Integer; SaveFormat: TRVSaveFormat;
var Target, Extras: string);
begin
Target := PChar(RVData.GetItemTag(ItemNo));
end;
Update 2011-Oct-22:
For TRichView 13.3+, the code must be:
Code: Select all
procedure TForm1.RichViewEdit1ReadHyperlink(Sender: TCustomRichView; const Target,
Extras: String; DocFormat: TRVLoadFormat; var StyleNo: Integer;
var ItemTag: TRVTag;
var ItemName: TRVRawByteString);
begin
ItemTag := Target;
end;
procedure TForm1.RichViewEdit1WriteHyperlink(Sender: TCustomRichView; id: Integer;
RVData: TCustomRVData; ItemNo: Integer; SaveFormat: TRVSaveFormat;
var Target, Extras: string);
begin
Target := RVData.GetItemTag(ItemNo);
end;