Page 1 of 1

Hyperlinks do not export to HTML

Posted: Tue Nov 16, 2010 12:50 pm
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.

Posted: Tue Nov 16, 2010 3:26 pm
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?

Posted: Tue Nov 16, 2010 5:59 pm
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

Posted: Wed Nov 17, 2010 9:41 am
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?

Posted: Wed Nov 17, 2010 10:11 am
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.