HotXLS Docs

Add method

Adds a hyperlink to the specified range. Returns an IXLSHyperlink Interface.

Syntax

function Add(Anchor: IXLSRange; Address: WideString; SubAddress: WideString; ScreenTip: WideString; TextToDisplay: WideString): IXLSHyperlink;
Anchor Required IXLSRange. A Range object. The anchor for the hyperlink.
Address Required WideString. The address of the hyperlink.
SubAddress Optional WideString. The subaddress of the hyperlink.
ScreenTip Optional WideString. The screen tip to be displayed when the mouse pointer is paused over the hyperlink.
TextToDisplay Optional WideString. The text to be displayed for the hyperlink.

Example

This example adds a hyperlink to cell B2.

With Workbook.Sheets[1] do 
begin
  Hyperlinks.Add(Range['B2', 'B2'], 'https://www.loslab.com/HotXLS.html');
end;
This example adds a range hyperlink to cell B3.

With Workbook.Sheets[1] do 
begin
  Hyperlinks.Add(Range['B3', 'B3'], '', 'Sheet2!A2:F10', 'Click here to view details...', 'Details');
end;
This example adds a file hyperlink to cell B4.

With Workbook.Sheets[1] do 
begin
  Hyperlinks.Add(Range['B4', 'B4'], 'C:\Docs\readme.txt', '', 'Click here to view instruction...', 'Instruction');
end;