NativeExcel for .Net Developer's Reference

IHyperlinks.AddMethod(Object, String)

Adds a hyperlink given the specified anchor and address.

[Visual Basic]
FunctionAdd(_
ByValAnchorAsObject,_
ByValAddressAsString_
)AsIHyperlink
[C#]
IHyperlinkAdd(
objectAnchor,
stringAddress
);
[C++]
IHyperlink*Add(
Object*Anchor,
String*Address
);
[JScript]
functionAdd(
ObjectAnchor,
StringAddress
):IHyperlink;

Parameters

Anchor
Object. The anchor for the hyperlink. Can be either an IRange interface or String which represents a range.
Address
String. The address of the hyperlink.

Return Value

IHyperlink interface.

Example

This example adds a hyperlink to cell B2.

[C#]
  //variant 1   
  book.Worksheets[1].Hyperlinks.Add("B2", "http://www.nika-soft.com/");   
  //variant 2
  IRange range = book.Worksheets[1].Range["B2"];   
  book.Worksheets[1].Hyperlinks.Add(range, "http://www.nika-soft.com/");   
[VisualBasic]
  //variant 1   
  book.Worksheets(1).Hyperlinks.Add("B2", "http://www.nika-soft.com/")   
  //variant 2
  Dim range As IRange = book.Worksheets(1).Range("B2")
  book.Worksheets(1).Hyperlinks.Add(range, "http://www.nika-soft.com/")   
[C++]
  //variant 1   
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", S"http://www.nika-soft.com/");   
  //variant 2
  IWorksheet* sheet = book->Worksheets->Item[1];  
  IRange* range = sheet->Range->Item[S"B2"];   
  sheet->Hyperlinks->Add(range, S"http://www.nika-soft.com/");   

See Also

IHyperlinks Interface | NativeExcel Namespace | IHyperlinks.Add Overload List