When I insert a hyperlink in my document, it works if I ctrl-click it. After exporting to HTML, the link is transformed into a blue underline text, not a link.
Also the compiler says that the ReadHyperLink method referenced by OnReadHyperLink has an incompatible params list and asks if I want to delete the reference. Here is what I have:
Declaration:
procedure RichViewEdit1ReadHyperlink(
Sender: TCustomRichView; const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer; var ItemName: String);
Procedure:
procedure T_FrmRicardoCSS.RichViewEdit1ReadHyperlink(
Sender: TCustomRichView; const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer; var ItemName: String);
var URL: String;
begin
if DocFormat=rvlfURL then StyleNo := rvActionInsertHyperlink1.GetHyperlinkStyleNo(RichViewEdit1);
URL := rvActionInsertHyperlink1.EncodeTarget(Target);
ItemTag := Integer(StrNew(PChar(URL)));
end;
And here is the export procedure:
procedure T_FrmRicardoCSS.RichViewEdit1WriteHyperlink(
Sender: TCustomRichView; id: Integer; RVData: TCustomRVData;
ItemNo: Integer; SaveFormat: TRVSaveFormat; var Target, Extras: String);
begin
if isExporting = True then begin
Target := PChar(RVData.GetItemTag(ItemNo));
if _frmSettings.cbxLinksTarget.Checked then Extras := 'target=_blank';
end;
end;
Could you please tell me what I am doing wrong?
Thanks.
Hyperlinks do not export to HTML
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
That fixed it. Thank you.Sergey Tkachenko wrote:In new version of TRichView, ItemName parameter of OnReadHyperlink has the type TRVRawByteString instead of String.
You can change it manually. This type is defined in RVTypes unit.
What's the meaning of isExporting, and does it really equal to True when you save to HTML?
var isExporting
I wrap RVE code into my own HTML and that var is internal to the app. Sorry I shounl't have mentioned that proc.
Thanks again for a quick reply.
Dan
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
So may be the problem with non-exporting links is because isExporting is False, so the line
is not executed?
Code: Select all
Target := PChar(RVData.GetItemTag(ItemNo));
You are right! The var isExporting was not set timely in my code before writing the link. All fixed!Sergey Tkachenko wrote:So may be the problem with non-exporting links is because isExporting is False, so the lineis not executed?Code: Select all
Target := PChar(RVData.GetItemTag(ItemNo));
Thanks again.