[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IHyperlinks.Add

Add Method

Adds a hyperlink to the specified range (IHyperlink object).

Use this method to attach a hyperlink to the specified anchor range.

Declaration
IHyperlink Add(IRange anchor, string address, string subAddress = "", string screenTip = "", string textToDisplay = "")
Function Add(anchor As IRange, address As String, Optional subAddress As String = "", Optional screenTip As String = "", Optional textToDisplay As String = "") As IHyperlink
Parameters
Type Name Description
IRange anchor

The IRange that serves as the hyperlink anchor.

string address

The hyperlink address. This value can be null when the target is specified by subAddress.

string subAddress

The location within the target document. This value can be null.

string screenTip

The screen tip displayed when the mouse pointer pauses over the hyperlink. This value can be null.

string textToDisplay

The text to be displayed for the hyperlink. Pass an empty string to use the default display text.

Returns
Type Description
IHyperlink

The added IHyperlink object.

IHyperlinks hyperlinks = worksheet.Hyperlinks;
worksheet.Range["A1"].Value = "Example";
IHyperlink hyperlink = hyperlinks.Add(worksheet.Range["A1"], "https://www.example.com");

Adds a hyperlink to the specified shape (IHyperlink object).

Use this method to attach a hyperlink to a shape such as an auto shape, chart, connector, picture, or group shape. The hyperlink target is defined by address and subAddress, and the optional screen tip and display text can be used to customize the user-facing content.

Declaration
IHyperlink Add(IShape shape, string address, string subAddress = "", string screenTip = "", string textToDisplay = "")
Function Add(shape As IShape, address As String, Optional subAddress As String = "", Optional screenTip As String = "", Optional textToDisplay As String = "") As IHyperlink
Parameters
Type Name Description
IShape shape

The shape for the hyperlink.

string address

The hyperlink address. This value can be null when the target is specified by subAddress.

string subAddress

The location within the target document. This value can be null.

string screenTip

The screen tip displayed when the mouse pointer pauses over the hyperlink. This value can be null.

string textToDisplay

The text to be displayed for the hyperlink. Pass an empty string to use the default display text.

Returns
Type Description
IHyperlink

The added IHyperlink object.

IShape shape = worksheet.Shapes.AddShape(AutoShapeType.Oval, 10, 10, 120, 40);
IHyperlinks hyperlinks = worksheet.Hyperlinks;
IHyperlink hyperlink = hyperlinks.Add(
    shape, "https://www.example.com", null, "Open example", "Example");