Issue 124906 - Save as - HTML Document (Calc): Relative hyperlinks become absolute
Summary: Save as - HTML Document (Calc): Relative hyperlinks become absolute
Alias: None
Product: Calc
Classification: Application
Component: save-export (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Windows 7
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2014-05-15 08:43 UTC by Rainer Bielefeld
Modified: 2016-04-28 21:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.2.0-dev
Developer Difficulty: ---

Test Kit showing export results (43.65 KB, application/x-zip-compressed)
2014-05-15 08:43 UTC, Rainer Bielefeld
no flags Details
Can't save spreadsheet as HTML with relative links (750 bytes, text/plain)
2015-02-06 07:57 UTC, kvistbo1
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Bielefeld 2014-05-15 08:43:17 UTC
Created attachment 83395 [details]
Test Kit showing export results

Steps how to reproduce Reproducible with "AOO 4.0.1 – German UI / German locale [AOO401m3(Build:9712) - Rev. 1520285 2013-09-05 13:52:01]" on German WIN7 Home Premium (64bit)", Common 4.0 User Profile (similar to proceeding what created attached test kit):

0. Create a Folder + Subfolder + few simple documents in subfolder
1. From AOO start center open new Calc document
2. Menu 'Tools -> Options -> Load/Save -> General': Check both "Save URLs
3. In a cell insert a word and apply hyperlink to a document in subfolder
4. Save as .ods
5. Menu 'File -> Save As -> Calc HTML document'
6. Close all documents
7. Open both documents in Folder and check hyperlinks: work fine
8. Close all documents
9. Modify name of Folder
10. Open both documents in Folder
   > In .ods hyperlinks to documents in Subfolder still work
   Bug: in .html links do no longer work, because they have been saved as 
        absolute links

Additional Info:
(a) Already a problem with OOo 3.1.1
(b) Test kit: see description in "DocumentWithLinks001.ods"
(c) Not a problem in Writer
(d) Not a Problem in 'File -> Export -> Xhtml' from Calc
(e) Not a problem with save as .xls
Comment 1 kvistbo1 2015-02-06 07:57:14 UTC
Created attachment 84489 [details]
Can't save spreadsheet as HTML with relative links

Can't save a calc spreadsheet as HTML containing relative URLs, they will be changed to absolute links.

Piece of cake to reproduce.

Create one testfile.txt. Create one linktestfile.ods containing a relative URL pointing to testfile.txt. Save linktestfile.ods and also save it as linktestfile.html. 

Open linktestfile.html with notepad and look at the link, it will always be absolute.

No combination of settings will cause the link to be other than an absolute link including disk name etc.

I found this error after debugging a long evening and night in AOO411m6(Build:9775)  -  Rev. 1617669
2014-08-13 09:06:54 (Mi, 13 Aug 2014)
running on Windows 7 ultimate (64).

Checked two older computers running Win XP Home and Pro with OO 3.4.1. The bug exists there too.
Comment 2 realname 2016-04-06 21:40:25 UTC
Comment on attachment 84489 [details]
Can't save spreadsheet as HTML with relative links

Needless to say, this is an issue that needs a fix ASAP!
the fix is easy;
the default settings in tools>options>load/save>general, scrap them

instead save every OO doc,ss whatever as OO
for different format, use EXPORT AS.... menuitem
if one is to open a document in other than OO, allow it but save/saveas is always OO format. EXPORT AS must the ONLY way to save changes to a foreign file!
The problem happens when someone is preparing a document locally with links to images,documents which document is to be delivered to a third party who then must be able to open the file and select links.

Say the document is zipped along with the other docs and images.
When party3 clicks links, the file cannot be found.
BEING ABLE TO SHIP&SHIP a package file is important and the pathing must work for the author as well as any party3 anywhere.

LINKS? how about
for local/network system..
saving document 
precede pathing with "/" or (letter) for hardcode
without the fwd slash for relative

for web access, this will be an EXPORT AS function
Comment 3 realname 2016-04-06 23:20:52 UTC

i dont know how the prog is designed but i would immediately offer a patch for this as a popup box using a "pathlib".plugin say and i would make such changes mastered by "patch manager" which overrides internal functions, making this a component architecture instead of a monolith. could be a little difficult on version control but apache is really good with components. super in fact.
Comment 4 Theodore Matula 2016-04-28 21:10:02 UTC
Summary: I was able to reproduce this bug with the exact steps shown in both comment #1 and the Description.

Version: 4.2.0 AOO420m1(Build:9800)  -  Rev. 1692551

OS: Windows 10 64-bit
Processor: Intel 17 2600k 3.4 Ghz
Graphics Card: Nvidia GTX 770 (2gb VRam)
Monitor: Asus 24" Monitor