- Demo
- C# source
- VB.Net source
The sample demonstrates how to write hyperlinks into spreadsheet.
private void ExcelDocViewer( string fileName ) { try { System.Diagnostics.Process.Start(fileName); } catch{} } private void btnRun_Click(object sender, System.EventArgs e) { Workbook workbook = new Workbook(); Worksheet sheet = workbook.Worksheets[0]; sheet.Range["B2"].Text = "Home page"; HyperLink hylink1 = sheet.HyperLinks.Add(sheet.Range["B3"]); hylink1.Type = HyperLinkType.Url; hylink1.Address = @"http:\\www.e-iceblue.com"; sheet.Range["B5"].Text = "Support"; HyperLink hylink2 = sheet.HyperLinks.Add(sheet.Range["B6"]); hylink2.Type = HyperLinkType.Url; hylink2.Address = "mailto:support(at)e-iceblue.com"; workbook.SaveToFile("Sample.xls"); ExcelDocViewer(workbook.FileName); }
Private Sub ExcelDocViewer(ByVal fileName As String) Try System.Diagnostics.Process.Start(fileName) Catch End Try End Sub Private Sub btnRun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRun.Click Dim workbook As Workbook = New Workbook() Dim sheet As Worksheet = workbook.Worksheets(0) sheet.Range("B2").Text = "Home page" Dim hylink1 As HyperLink = sheet.HyperLinks.Add(sheet.Range("B3")) hylink1.Type = HyperLinkType.Url hylink1.Address = "http:\\www.e-iceblue.com" sheet.Range("B5").Text = "Support" Dim hylink2 As HyperLink = sheet.HyperLinks.Add(sheet.Range("B6")) hylink2.Type = HyperLinkType.Url hylink2.Address = "mailto:support(at)e-iceblue.com" workbook.SaveToFile("Sample.xls") ExcelDocViewer(workbook.FileName) End Sub