Ask Your Question
0

How do I insert a hyperlink to a document in the current folder?

asked 2018-10-13 08:58:17 +0100

ovi3747 gravatar image

Hello,

I want to insert a hyperlink to a document. I don't want to use the local path like (C:\Users\Name\etc....).

I want the link to access the file from the same folder as my spreadsheet document.

The reason is because I am editing the documents on a cloud service. When I go to my office, the path to the folder of the cloud service is not the same to the one at home.

Is there a way to do this? I tried searching the internet but with no success.

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-10-14 10:56:47 +0100

ovi3747 gravatar image

I tried first formula =HYPERLINK("relative/path/to/file") in Libre office 6.0.6.2 and I get this message:

""test.txt" is not an absolute URL that can be passed to an external application to open it."

edit flag offensive delete link more

Comments

Sigh. Is reading that hard? I wrote: "This is possible in LibreOffice 6.1". It means 6.1, not 6.0, isn't it?

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-14 11:04:47 +0100 )edit

It doesn't work in 6.1 either. I get the same message

ovi3747 gravatar imageovi3747 ( 2018-10-14 12:07:23 +0100 )edit

I stand corrected. And I apologize, because it's not 6.1, but (to be released in winter) 6.2 where the change was introduced; I tested with my development build. I should have checked explicitly before answering, and not rely on my memory.

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-14 12:28:20 +0100 )edit
0

answered 2018-10-13 09:25:14 +0100

Mike Kaganski gravatar image

updated 2018-10-14 12:28:54 +0100

This is possible in LibreOffice 6.2 (commit e6b18c1d0f377e1295970b94bdf6b90739e13d4d). Putting something like

=HYPERLINK("relative/path/to/file")

I get a proper link working relative to the saved file's path (or relative to working directory in the case of not-yet-saved document).

For older versions, a workaround is required. To get current file's path, you may use these three formulas (say, in A1, A2, and A3):

=SUBSTITUTE(CELL("FILENAME"; A1); "'"; "")
=SUBSTITUTE(A1;"/";"*";LEN(A1)-LEN(SUBSTITUTE(A1;"/";"")))
=LEFT(A1;FIND("*";A2))

Alternatively, a single formula may be used instead of two in A2 and A3, dependent upon regular expressions being enabled in formulas (OptionsLibreOffice CalcCalculateGeneral Calculations):

=LEFT(A1;SEARCH("/[^/]+$"; A1))

The resulting string then may be used throughout the spreadsheet to create the full URL in hyperlinks, like

=HYPERLINK(A3 & "relative/path/to/file")
edit flag offensive delete link more

Comments

I tried first formula =HYPERLINK("relative/path/to/file") in Libre office 6.0.6.2 and I get this message:

""test.txt" is not an absolute URL that can be passed to an external application to open it."

ovi3747 gravatar imageovi3747 ( 2018-10-14 10:57:43 +0100 )edit

Note that Mike wrote it will be possible in 6.2 (after correcting from 6.1) not 6.0.6

erAck gravatar imageerAck ( 2018-10-14 20:10:40 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-13 08:58:17 +0100

Seen: 82 times

Last updated: Oct 14