I am trying to figure out how to write a Hyperlink inside a cell using EPPlus instead of the cell containing the link text. I need it to be recognized as a link and be clickable
There's a few ways to go about it:
1) To use URI, then set a human readable name
var cell = sheet.Cells["A1"];
cell.Hyperlink = new Uri("http://www.google.com");
cell.Value = "Click me!";
2) To use ExcelHyperLink and set a human readable name using object initializer
var cell = sheet.Cells["A1"];
cell.Hyperlink = new ExcelHyperLink("http://www.google.com") { Display = "Click me! };
3) To use =Hyperlink() formula
var cell = sheet.Cells["A1"];
cell.Formula = string.Format("HYPERLINK({0},{1})", "http://www.google.com", "Click me!");
cell.Calculate();