ExcelCell Hyperlinks

GemBox.Spreadsheet can read and write hyperlinks, but the level of support depends on the Excel file format:

  • In XLS, only HYPERLINK formula is supported.
  • In XLSX, both Hyperlink property and HYPERLINK formula are supported.
  • In PDF, ODS and HTML, only Hyperlink property is supported.

You can set hyperlink to URL or to some location in the workbook.

ExcelCell Hyperlinks Screenshot
using System;
using GemBox.Spreadsheet;

class Program
{
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        ExcelFile ef = new ExcelFile();
        ExcelWorksheet ws = ef.Worksheets.Add("Hyperlinks");

        ws.Cells["A1"].Value = "Hyperlink examples:";

        ExcelCell cell = ws.Cells["B3"];
        cell.Value = "GemBoxSoftware";
        cell.Style.Font.UnderlineStyle = UnderlineStyle.Single;
        cell.Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue);
        cell.Hyperlink.Location = "https://www.gemboxsoftware.com";
        cell.Hyperlink.IsExternal = true;

        cell = ws.Cells["B5"];
        cell.Value = "Jump";
        cell.Style.Font.UnderlineStyle = UnderlineStyle.Single;
        cell.Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue);
        cell.Hyperlink.ToolTip = "This is tool tip! This hyperlink jumps to E1.";
        cell.Hyperlink.Location = ws.Name + "!E1";

        ws.Cells["E1"].Value = "Destination";

        cell = ws.Cells["B8"];
        cell.Formula = "=HYPERLINK(\"https://www.gemboxsoftware.com/spreadsheet/examples/excel-cell-hyperlinks/207\", \"Example of HYPERLINK formula\")";
        cell.Style.Font.UnderlineStyle = UnderlineStyle.Single;
        cell.Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue);

        ef.Save("Hyperlinks.%OutputFileType%");
    }
}
Imports System
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        Dim ef As ExcelFile = New ExcelFile
        Dim ws As ExcelWorksheet = ef.Worksheets.Add("Hyperlinks")

        ws.Cells("A1").Value = "Hyperlink examples:"

        With ws.Cells.Item("B3")
            .Value = "GemboxSoftware"
            .Style.Font.UnderlineStyle = UnderlineStyle.Single
            .Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue)
            .Hyperlink.Location = "https://www.gemboxsoftware.com"
            .Hyperlink.IsExternal = True
        End With

        With ws.Cells.Item("B5")
            .Value = "Jump"
            .Style.Font.UnderlineStyle = UnderlineStyle.Single
            .Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue)
            .Hyperlink.ToolTip = "This is tool tip! This hyperlink jumps to E1!"
            .Hyperlink.Location = (ws.Name & "!E1")
        End With

        ws.Cells("E1").Value = "Destination"

        With ws.Cells.Item("B8")
            .Formula = "=HYPERLINK(""https://www.gemboxsoftware.com/spreadsheet/examples/excel-cell-hyperlinks/207"", ""Example of HYPERLINK formula"")"
            .Style.Font.UnderlineStyle = UnderlineStyle.Single
            .Style.Font.Color = SpreadsheetColor.FromName(ColorName.Blue)
        End With

        ef.Save("Hyperlinks.%OutputFileType%")

    End Sub

End Module

Check next example or download examples from GitHub.