Calc function HYPERLINK incompletely documented

The description of the HYPERLINK function (at Spreadsheet Functions ) does not clearly state how the URL is constructed, though the example =HYPERLINK("http://www.";"Click ") & "example.org" gives a hint.

Behaviour

HYPERLINK within a larger formula

Experimentation leads me to believe that:

  • As documented in the Help, in a formula HYPERLINK returned its second argument (CellValue) if supplied, and otherwise its first.
  • The URL is constructed by interpreting the formula as though HYPERLINK returned its first argument ("URL"); the result must be a string
    • If the resulting value is numeric, the result is invalid (perhaps unspecified).
      • This happens with the formula =HYPERLINK("http://www.example.org",5)+10 .
      • I observe that the URL is shown as NaN in the mouseover.
      • If I click it on Linux under KDE, something called xdg-open starts something called kde-open5 (apparently a.k.a. the KIO Client), which tries to open a file whose name is the full path name of my document with /NaN appended.

Link access with the keyboard

The use of the keyboard as described does not work for me in LO 7.6.4.1 under KDE on Open Suse Linux. When editing the formula =HYPERLINK("http://www.example.org"), Shift-F10 does not bring up a menu, regardless of whether the cursor is before =, HYPERLINK, " or http:. The object menu key does not do so either.

Improvements to Help

If this is correct, I believe the Help should say in the first paragraph:

URL specifies the link target, or part of it if HYPERLINK is used within a larger formula.

and have another paragraph under Syntax saying:

If HYPERLINK is used within a larger formula, the link target is composed by evaluating the formula as though HYPERLINK returned URL. The result should be a string; otherwise the behaviour is unspecified.

The example =HYPERLINK("http://www.";"Click ") & "example.org" could be replaced or amplified by another example (is there a more plausible use case?):

="https:"&HYPERLINK("//www.nefarious-scoundrel.com","example.org")&"/12345", displays https:example.org/123145 and links to http://www.nefarious-scoundrel.com/12345 . This is bad practice.

It would also be better to replace http: by https: in all examples.