[Solved] Create relative Hyperlink using Hyperlink editor

Discuss the spreadsheet application
Post Reply
BluePen
Posts: 2
Joined: Wed Sep 01, 2021 10:37 pm

[Solved] Create relative Hyperlink using Hyperlink editor

Post by BluePen »

 Edit: Split from [Solved] Multiple Hyperlinks in one Cell? for new question from new person in solved topic 
Hello OpenOffice community,

In regards to this topic, I would like to ask the question whether it is also possible to reference a target with a relative Hyperlink by using the Hyperlink editor. I am also referencing multiple targets by using the Hyperlink editor in one cell just like guts1999 and I can also confirm that it has been working without problems until so far. However, when the document structure is changed, e.g. by inserting a new column or row and I click on the Hyperlink reference again, it still points to the old target cell. I am aware of the fact that this behavior can be adjusted to behave in a dynamic way according to this forum https://ask.libreoffice.org/t/calc-hype ... tion/42292, nevertheless I did not find an answer on how to do this properly with the Hyperlink editor.

So the question is, how can a target cell in an OpenOffice Calc document be relatively referenced with the Hyperlink editor?

Here is an example scenario for more clarification:
Insert → Hyperlink → Document → Target → cell name (e.g. A30) → Apply → Close
After inserting a row above the cell name, it would need to change to A31, since it shifted 1 row below, but this is not the case, because it still references to A30.

I would appreciate any advice.
Last edited by BluePen on Thu Sep 02, 2021 7:23 pm, edited 1 time in total.
OpenOffice 4.1.10 on Windows 11 Pro 64-bit (10.0, Build 22000)
User avatar
MrProgrammer
Moderator
Posts: 4905
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Create relative Hyperlink using Hyperlink editor

Post by MrProgrammer »

Select the cell to which you want to link, say A30. Insert → Names → Define → Name → Foo → Add → OK. In the hyperlink editor, use Target → Foo instead of Target → A30. If you insert a row above row 30, Foo is changed to point to A31, and the hyperlink will go there. "Foo" can be any name the Define → Name dialog allows. All names which begin with an underscore and contain only alphabetic and numeric characters are allowed: _FooBar31415.

This method applies whether you have 1 or 100 hyperlinks in a cell. Read about defined names in Help → Index or in User Guides (PDF) or searching for topics about that in the Calc Forum.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
BluePen
Posts: 2
Joined: Wed Sep 01, 2021 10:37 pm

Re: Create relative Hyperlink using Hyperlink editor

Post by BluePen »

MrProgrammer, I followed your instructions and can confirm that this is the behaviour I was looking for and besides the selected cell it also works with a selected range too, which is really great! Thank you very much for the quick answer and for the links that you provided me with! I will mark this topic as solved.
OpenOffice 4.1.10 on Windows 11 Pro 64-bit (10.0, Build 22000)
Post Reply