First Last

First Last

  • 1.8k
  • 40
  • 173

Add hyperlink in Excel file using Open XML

Sep 12 2019 8:38 AM
I have added a sample line of code that's what i am trying to get my result. Please help if anybody have idea how to achieve this, only need using openXml library.
 
Hyperlink hyperlink = new Hyperlink()
{
Reference = "A" + indexer, Location = "Unique" + (indexer - 1) + "!A1", Display = "Unique" + indexeattributes.Add(new OpenXmlAttribute("t", null, "inlineStr"));
var cell = new Cell() { CellReference = hyperlink.Display };
//cell.InnerText = "dfd";
writer.WriteStartElement(cell, attributes);
//writer.WriteStartElement(hyperlink, attributes);
//writer.WriteString("fdf");
//writer.WriteElement(new InlineString(new Text("dfdfs")));
writer.WriteStartElement(new InlineString(hyperlink));
writer.WriteEndElement();

Answers (4)