Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Spreadsheet .NET
>
Tutorial
> Create Hyperlink
The following example shows you how to create a hyperlink.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Spreadsheet; using Independentsoft.Office.Spreadsheet.Styles; namespace Sample { class Program { static void Main(string[] args) { Font font1 = new Font(); font1.Name = "Calibri"; font1.Size = 11; font1.Family = 2; font1.Underline = new Underline(UnderlineType.Single); font1.Color = new DataBarColor("#0000FF"); //blue CellFormat format1 = new CellFormat(); format1.Font = font1; Cell a1 = new Cell("Independentsoft"); a1.Hyperlink = new Hyperlink("http://www.independentsoft.com"); a1.Format = format1; Worksheet sheet1 = new Worksheet(); sheet1["A1"] = a1; Workbook book = new Workbook(); book.Sheets.Add(sheet1); book.Save("c:\\test\\output.xlsx", true); } } }
VB example
Imports System Imports Independentsoft.Office Imports Independentsoft.Office.Spreadsheet Imports Independentsoft.Office.Spreadsheet.Styles Module Module1 Sub Main(ByVal args As String()) Dim font1 As New Font() font1.Name = "Calibri" font1.Size = 11 font1.Family = 2 font1.Underline = New Underline(UnderlineType.Single) font1.Color = New DataBarColor("#0000FF") ''blue Dim format1 As New CellFormat() format1.Font = font1 Dim a1 As New Cell("Independentsoft") a1.Hyperlink = New Hyperlink("http://www.independentsoft.com") a1.Format = format1 Dim sheet1 As New Worksheet() sheet1("A1") = a1 Dim book As New Workbook() book.Sheets.Add(sheet1) book.Save("c:\test\output.xlsx", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*