문제

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 contain a style other than "standard"

      var hLinkStyle = (from s in dataSheet.Workbook.Styles.NamedStyles where s.Name == "Hyperlink" select s).FirstOrDefault();
      hyperlinkCell.StyleName = hLinkStyle.Name;
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top