relative paths for hyperlinks

Posted on 2007-10-19
Medium Priority
Last Modified: 2013-12-26
I am using OpenOffice Impress.  I want to make a hyperlink that uses a relative path to a text file I have.  I want to put the impress file and stuff.txt in the same directory.  I then want to use "./stuff.txt" as the path of the file that I want to include as a hyperlink in my impress file.  

I can get it to work if I use an absolute path to stuff.txt.  I want to use relative paths so I can mail the impress file and stuff.txt to someone.  

Any ideas?
Question by:dwcronin
  • 4
LVL 14

Expert Comment

ID: 20111988
Hmm, maybe I don't quite get it but ...

if you choose
Insert > Hyperlink > Document: and for Path click on the folder icon you then can
insert any kind of document from your filesystem as a target for your link.
LVL 14

Expert Comment

ID: 20112034
I mean what I don't quite get here, sorry:

>>>I want to use relative paths so I can mail the impress file and stuff.txt to someone

??? Do you want to create hyperlinks for your impress slide or
organize your mail programm ? both things seem not really related to me.

Author Comment

ID: 20115870
Sorry for the delay xberry but I asked the question right before I left work on Friday and I did not look after I got home on Friday evening.

The problem I have is:
I have written an impress slide that has names of all subroutines in a program someone gave me to fix.  So I have the main impress slide that has the names of all of subroutines.  I try to make hyperlinks from this main page to slides showing the code in the subroutine referenced in the main slide.  A couple subroutines have a significant amount of code written.  I made text files for each of those subroutines instead of having the main page reference a slide for the function, Then the main page references the text file for the particular function.

Say that my text files are:

When I hyperlink to these, it put the path in as:

This works fine on my computer because I am cronind and these are the correct paths on my computer.  This will not work if I send my impress file and three text files to my boss.  How do I make the main page reference:


LVL 14

Expert Comment

ID: 20117329
I did browse for help and related issues and as a summary it should work if you
follow these:

- Check the relative links checkboxes under Tools | Options | Load/Save | General.
- Copy your entire directory structure to an unrelated location, i.e your bosses computer.

Then, so it is said, it should work, though this is not sideproofed from my side.

from open office help file:

Relative and Absolute Links:
When you include hyperlinks, two factors must be taken into account: whether they are set as relative or absolute on saving, and whether or not the file is present.
Choose Tools - Options - Load/Save - General and specify in the Save URLs relative to field if OpenOffice.org creates relative or absolute hyperlinks. Relative linking is only possible when the document you are working on and the link destination are on the same drive.
You should create the same directory structure on your hard disc as that which exists in the web space hosted by your Internet provider. Call the root directory for the homepage on your hard disc "homepage", for example. The start file is then "index.htm", the full path being "C:\homepage\index.htm". The URL on your Internet provider's server might, then be as follows: "http://www.myprovider.com/mypage/index.htm". With relative addressing, you indicate the link relative to the location of the output document. For example, if you placed all the graphics for your homepage in a subfolder called "C:\homepage\images", you would need to give the following path to access the graphic "picture.gif": "images\picture.gif". This is the relative path, starting from the location of the file "index.htm". On the provider's server, you would place the picture in the folder "mypage/images". When you transfer the document "index.htm" to the provider's server through the File - Save As dialogue, and if you have marked the option Copy local graphics to Internet under Tools - Options - Load/Save - HTML Compatibility, OpenOffice.org will automatically copy the graphic to the correct directory on the server.
An absolute path such as "C:\homepage\graphics\picture.gif" would no longer function on the provider server. Neither a server nor the computer of a reader needs to have a C hard drive: operating systems such as Unix or MacOS do not recognise drive letters, and even if the folder homepage\graphics existed, your picture would not be available. It is better to use relative addressing for file links.
A link to a web page, for example, "www.sun.com" or "www.myprovider.com/mypage/index.htm" is an absolute link.
OpenOffice.org also reacts differently, depending on whether the file referred to in the link exists, and where it is located. OpenOffice.org checks every new link and sets a target and protocol automatically. The result can be seen in the generated HTML code after saving the source document.
The following rules apply: A relative reference ("graphic/picture.gif") is only possible when both files exist on the same drive. If the files are on different drives in your local file system, the absolute reference follows the "file:" protocol ("file:///data1/xyz/picture.gif"). If the files are on different servers or if the target of the link is not available, the absolute reference uses the "http:" protocol ("http://data2/abc/picture.gif").
Be sure to organise all files for your homepage on the same drive as the start file of the homepage. In this way, OpenOffice.org can set the protocol and target so that the reference on the server is always correct.

When you rest your mouse on a hyperlink, a help tip displays the absolute reference, since OpenOffice.org uses absolute path names internally. The complete path and address can only be seen when you view the result of the HTML export, by loading the HTML file as "Text" or opening it with a text editor.
LVL 14

Accepted Solution

xberry earned 2000 total points
ID: 20117364
Also one thing I found out:
if you type the path in Hyperlink > Document > path
as you are used to do with web pages then it won't work.
Lets say your main impress slide from which you link to sub pages is in directory
then you create a realtive hyperlink to files in the same directory (cronind) like this:

AND NOT  ./one.txt or one.txt
syntax for file paths (file) is here different than for web links (http)

the full path URL syntax to your files would be

in http you'd have
http:// (only two slashes) so the third slash
for file Urls is signaling the origination point or root point here
and should go in with the path description, either relative or absolute, ok ?


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Social messanging services like WhatsApp and Facebook can help businesses in ways that many owners don't even imagine, giving new opportunities to connect with customers. Discover some of the most innovative things they can do for your company.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question