Epplus use Excel Styles like Hyperlink

后端 未结 1 1060
耶瑟儿~
耶瑟儿~ 2021-02-19 12:04

I am trying to style some cells, I\'d like to use the standard \"Hyperlink\" Style, but I am unable to find it.

here is my best guess code, but the Workbook does not con

相关标签:
1条回答
  • 2021-02-19 12:23

    Try to create a named style and set it to the cell as follows:

    // string link = "your link".
    // worksheet is your worksheet reference.
    var namedStyle = worksheet.Workbook.Styles.CreateNamedStyle("HyperLink");
    namedStyle.Style.Font.UnderLine = true;
    namedStyle.Style.Font.Color.SetColor(Color.Blue);
    cell.Hyperlink = new ExcelHyperLink(link);
    cell.StyleName = namedStyle.Name;
    cell.Value = link;
    

    Please refer to EPP example for detail.

    0 讨论(0)
提交回复
热议问题