Hyperlink.SetUri(String, Boolean, String) Method
Sets the hyperlink destination and text to be displayed for the hyperlink in a cell.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
uri | String | A String value that specifies a web page, existing file, e-mail address or cell range in the current workbook to which a hyperlink refers. This value is assigned to the HyperlinkBase.Uri property. |
isExternal | Boolean | A Boolean value that specifies whether a hyperlink refers to an external resource (true) or to a cell range within the current workbook (false). This value is assigned to the HyperlinkBase.IsExternal property. |
displayText | String | A String value that specifies text to be displayed for a hyperlink. This value is assigned to the Hyperlink.DisplayText property and specifies the top left cell value of the range which contains a hyperlink. |
Remarks
When an end-user clicks a cell range, the associated hyperlink navigates to its destination. Pass a hyperlink destination to the HyperlinkCollection.Add method as a parameter when adding a hyperlink to a cell range. The Hyperlink.SetUri
method allows you to change the target location of an existing hyperlink. Note, that if you skip the displayText parameter (HyperlinkBase.SetUri), the hyperlink text is automatically set to the uri parameter value.
The following table lists possible locations to which hyperlinks can refer. A hyperlink can be external or internal depending on its target location.
Hyperlink Destination | Description | Hyperlink Type | Example |
---|---|---|---|
Web Page | A hyperlink opens the specified web page in the default browser. | External | “https://www.devexpress.com/“ |
Existing File or Directory | A hyperlink opens a file or directory. Uri is a path to a file and file name, or a path to a directory. A path can be absolute or relative to the directory where the current workbook is located. | External | “C:\Temp\MyDocument.xlsx” “..\..\..\MyBook.xlsx” “D:\“ |
E-Mail Address | A hyperlink opens the default mail client for the specified e-mail address. Uri is an e-mail address preceded by the “mailto:” prefix. | External | “mailto:support@devexpress.com” |
Cell Range | A hyperlink refers to a cell or cell range within the current workbook. Uri is a cell reference or defined name preceded by the worksheet name. | Internal | “Sheet2!A1:C3” “Sheet2!range_name” |