Xceed Workbooks for .NET v1.4 Documentation
Hyperlink Class
Members  Example 


Xceed.Workbooks.NET Assembly > Xceed.Workbooks.NET Namespace : Hyperlink Class
Encapsulates the object that represents an hyperlink.
Syntax
'Declaration

 

Public Class Hyperlink 

   Inherits WorksheetElement
'Usage

 

Dim instance As Hyperlink
public class Hyperlink : WorksheetElement 
Example
using ( var workbook = Workbook.Create( "test.xlsx" ) )

  {

    // Get the first worksheet. A workbook contains at least 1 worksheet.

    var worksheet = workbook.Worksheets[ 0 ];



    // Add an hyperlink for a cell reference(z1) in the same worksheet.

    // Position the hyperlink in cell B6 and extend the hyperlink on 2 columns.

    worksheet.Cells[ "B5" ].Value = "Add an hyperlink to a cell reference in same worksheet:";

    worksheet.Hyperlinks.Add( "z1", "B6", 1, 2, "Link to another cell.", "A cell reference." );



    // Add a new worksheet and fill cells.

    workbook.Worksheets.Add();

    workbook.Worksheets[ 1 ].Cells[ "D4" ].Value = "The other worksheet.";



    // Add an hyperlink for a cell reference in another worksheet (sheet2, cell B1).

    // Position the hyperlink in 8th row and 2nd column and extend the hyperlink on 3 columns.

    worksheet.Cells[ "B8" ].Value = "Add an hyperlink to a cell reference in another worksheet:";

    worksheet.Hyperlinks.Add( "Sheet2!B1", 8, 1, 1, 3, "Link to another worksheet's cell.", "Another worksheet cell reference." );



    // Add an hyperlink to an external document.

    // Position the hyperlink in cell B12 and extend the hyperlink to cell D12.

    worksheet.Cells[ "B11" ].Value = "Add an hyperlink to an external document:";

    worksheet.Hyperlinks.Add( "../abc.xlsx", "B12", "D12", "Link to another document.", "An external document link." );



    // Add an hyperlink to an email address.

    // Position the hyperlink in cell B15 and extend the hyperlink for 2 rows and 2 columns.

    worksheet.Cells[ "B14" ].Value = "Add an hyperlink to an email address:";

    worksheet.Hyperlinks.Add( "sales@xceed.com", "B15", 2, 2, null, "An email link." );



    // Add an hyperlink to a web site.

    // Position the hyperlink in cell B18.

    worksheet.Cells[ "B17" ].Value = "Add an hyperlink to a web site:";

    worksheet.Hyperlinks.Add( "www.xceed.com", "B18", 1, 1, "Xceed", "A web site link." );



    // Save the workbook to disk.

    workbook.Save();

  }
Inheritance Hierarchy

System.Object
   Xceed.Workbooks.NET.WorkbookElement
      Xceed.Workbooks.NET.WorksheetElement
         Xceed.Workbooks.NET.Hyperlink

Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Hyperlink Members
Xceed.Workbooks.NET Namespace