relative paths for hyperlinks

Posted on 2007-10-19
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
    LVL 14

    Expert Comment

    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

    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

    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

    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 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: "". 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, 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, "" or "" is an absolute link. also reacts differently, depending on whether the file referred to in the link exists, and where it is located. 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, 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 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

    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

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now