HotXLS 文档

AddHyperlink 方法

Adds a hyperlink to one worksheet cell by coordinates or A1-style reference and writes the display text to that cell

语法

function AddHyperlink(Row, Col: Integer; Address: WideString): IXLSHyperLink; overload;
function AddHyperlink(ARange: WideString; Address: WideString): IXLSHyperLink; overload;
function AddHyperlink(Row, Col: Integer; Address: WideString; TextToDisplay: WideString): IXLSHyperLink; overload;
function AddHyperlink(ARange: WideString; Address: WideString; TextToDisplay: WideString): IXLSHyperLink; overload;
function AddHyperlink(Row, Col: Integer; Address: WideString; TextToDisplay: WideString; ScreenTip: WideString): IXLSHyperLink; overload;
function AddHyperlink(ARange: WideString; Address: WideString; TextToDisplay: WideString; ScreenTip: WideString): IXLSHyperLink; overload;
    

参数

Row, Col 1-based worksheet coordinates of the target cell
ARange A1-style target cell reference
Address URL, file address, or workbook target for the hyperlink
TextToDisplay Text written to the target cell and stored as the hyperlink display text. If omitted or empty, the address is used
ScreenTip Optional tooltip shown by spreadsheet applications

示例

Workbook.Sheets[1].AddHyperlink(
  1, 2,
  'https://www.loslab.com',
  'Visit losLab',
  'Open site');

Workbook.Sheets[1].AddHyperlink(
  'C4',
  'www.loslab.com/docs',
  'Read docs',
  'Open documentation');
    

请参阅

TXLSWorksheet class
TXLSWorksheet.Hyperlinks 属性
IXLSHyperLinks.Add 方法