Consider this Basic macro: sub addHyperlinkA1 doc = StarDesktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, Array()) oCell = doc.Sheets(0).getCellByPosition(0,0) oField = doc.createInstance("com.sun.star.text.TextField.URL") oField.URL = "http://www.example.org/" oField.Representation = "hyperlink" 'oCell.insertTextContent(oCell.createTextCursor(), oField, False) oCell.insertTextContent(oCell.getEnd(), oField, False) end sub This macro fails on the last line with 'insertTextContent' with: > BASIC runtime error. > An exception occurred > Type: com.sun.star.lang.IllegalArgumentException > Message: . But uncommenting the line with createTextCursor (and commenting the line with 'getEnd') succeeds. insertTextContent doesn't require that the passed range be cursor. So it must succeed.
https://gerrit.libreoffice.org/c/core/+/190080
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/48dae1af66b227e72d58935d5719610c957da30d tdf#168066: implement Format property for Calc's URL field It will be available in 26.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.