diff --git a/ClosedXML/Excel/CalcEngine/Functions/Text.cs b/ClosedXML/Excel/CalcEngine/Functions/Text.cs index b91728c..ad9e220 100644 --- a/ClosedXML/Excel/CalcEngine/Functions/Text.cs +++ b/ClosedXML/Excel/CalcEngine/Functions/Text.cs @@ -38,7 +38,7 @@ ce.RegisterFunction("TRIM", 1, Trim); // Removes spaces from text ce.RegisterFunction("UPPER", 1, Upper); // Converts text to uppercase ce.RegisterFunction("VALUE", 1, Value); // Converts a text argument to a number - ce.RegisterFunction("HYPERLINK", 1, Hyperlink); + ce.RegisterFunction("HYPERLINK", 2, Hyperlink); } private static object _Char(List p) diff --git a/ClosedXML_Examples/Misc/Hyperlinks.cs b/ClosedXML_Examples/Misc/Hyperlinks.cs index e40d32a..1dca03e 100644 --- a/ClosedXML_Examples/Misc/Hyperlinks.cs +++ b/ClosedXML_Examples/Misc/Hyperlinks.cs @@ -91,6 +91,11 @@ ws.Cell(ro, 1).Style.Font.FontColor = XLColor.Red; ws.Cell(ro, 1).Style.Font.Underline = XLFontUnderlineValues.Double; ws.Cell(ro, 1).Hyperlink = new XLHyperlink(ws.Range("B1:C2")); + + // Hyperlink via formula + ws.Cell( ++ro, 1 ).SetValue( "Send Email" ) + .SetFormulaA1( "=HYPERLINK(\"mailto:test@test.com\", \"Send Email\")" ) + .Hyperlink = new XLHyperlink( "mailto:test@test.com", "'Send Email'" ); // List all hyperlinks in a worksheet: var hyperlinksInWorksheet = ws.Hyperlinks; diff --git a/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx index 7735bd4..d5ffe20 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx Binary files differ