Hyperlinks do not export to HTML

General TRichView support forum. Please post your questions here
Post Reply
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Hyperlinks do not export to HTML

Post by vega »

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.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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?
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Post by vega »

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?
That fixed it. Thank you.

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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

So may be the problem with non-exporting links is because isExporting is False, so the line

Code: Select all

Target := PChar(RVData.GetItemTag(ItemNo)); 
is not executed?
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Post by vega »

Sergey Tkachenko wrote:So may be the problem with non-exporting links is because isExporting is False, so the line

Code: Select all

Target := PChar(RVData.GetItemTag(ItemNo)); 
is not executed?
You are right! The var isExporting was not set timely in my code before writing the link. All fixed!

Thanks again.
Post Reply