Issue 26957 - error opening hyperlink to bookmark in ms word document
Summary: error opening hyperlink to bookmark in ms word document
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: OOo 1.1
Hardware: PC All
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Keywords: ms_interoperability, oooqa
: 59126 (view as issue list)
Depends on:
Reported: 2004-03-25 07:22 UTC by giorgiodemontis
Modified: 2017-05-20 10:55 UTC (History)
4 users (show)

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

more (2.32 KB, application/x-compressed)
2004-03-26 01:25 UTC, giorgiodemontis
no flags Details
zipped file with explicative document (11.72 KB, application/octet-stream)
2004-04-02 22:17 UTC, giorgiodemontis
no flags Details
basic problem (20.92 KB, application/octet-stream)
2004-04-02 22:22 UTC, giorgiodemontis
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description giorgiodemontis 2004-03-25 07:22:47 UTC
This issue is for reopen issue 26425. 
The defect is this 
Hyperlink with bookmark dont link to the bookmark in the hyperlinked file

the problem is not open the file 
the problem is open the file and go to the bookmark into the file

MSOffice winword hyperlink open the file and then put the cursor at the 
bookmark into the bookmarked opened file.

OOO don't open the file an so it's very far to put the cursor on the bookmark

If don't resolve this a lot of documents with hyperlink wroted in MSOffice 
winword document cannot be linked by OOo. Many people has a history with 
msoffice, with a lot of work and time dedicated to him.

Is not a good idea delete the bookmark. 
Image if you have a hyperlink to a 1500 pages file and you need see 
(example)  "chapter 2.2" .
I hope the answer is not like open file and then use find to locate the 
word "chapter 2.2"

thanks and regards
Giorgio Demontis
Comment 1 giorgiodemontis 2004-03-26 01:25:51 UTC
Created attachment 14077 [details]
Comment 2 giorgiodemontis 2004-03-26 01:30:31 UTC
hyperlink with hash-mark from a html file open the hyperlinked file
Comment 3 giorgiodemontis 2004-03-31 08:15:38 UTC
when i edit a html document i cant open the bookmarked file
After save i can open the bookmarked file but curson don't go to the bookmark
Comment 4 utomo99 2004-03-31 08:35:30 UTC
please try to use better summary. I did not understand this issue. 
and I suggest you try OOO 1.1.1. 
Comment 5 giorgiodemontis 2004-04-02 22:17:33 UTC
Created attachment 14291 [details]
zipped file with explicative document
Comment 6 giorgiodemontis 2004-04-02 22:22:18 UTC
Created attachment 14292 [details]
basic problem
Comment 7 jensja 2004-04-04 03:12:38 UTC
Reproducible with OOo1.1.1 on W2k
Duplicate of issue 26425, everything has been explained there.

The hyperlink dialog in OOo Writer allows creation of a hyperlink to a bookmark
inside a word document like "sample.doc#par02"
But OOo fails to open the link target and displays an error box. 

Suggesting new summary "error opening hyperlink to bookmark in msword document"
Comment 8 mci 2004-04-05 12:54:30 UTC
works fine here on Solaris and RedHat Linux 9.0 using OOo1.1.1 and your file and the file  (Apr 2)...
Comment 9 utomo99 2004-04-21 09:04:06 UTC
confirm and change summary
Comment 10 michael.ruess 2004-04-21 11:53:40 UTC
There's an error message from the system, that the file cannot be found, when
the hyperlink contains a "#BookmarkName" at the end.
Comment 11 thorsten.martens 2004-05-13 09:31:29 UTC
TM->ES: Reproducible when using Windows. Links frome one to another Document are
not Framework !
Comment 12 eric.savary 2004-05-14 14:57:41 UTC
ES->AMA: Reproducible on Windows only
Comment 13 Rainer Bielefeld 2005-12-10 09:05:39 UTC
Change OS due to "Additional comments from tm Thu May 13 00:31:29 -0800 2004"
and others. 
I checked with "2.0.1 RC2 German version WIN XP: [680m143(Build8986)]" and found
out that it's still impossible to create a working hyperlink to bookmark in a
WORD document.

It's no problem to create a working hyperlink to a separate WORD document or to
a bookmark in a separate OOo document. But strange, if I add the bookmark
information _for_a_WORD_document_ in the hyperlink dialogue, that hyperlink
won't work any longer, when I try, I get a (WINDOWS-(?)) error message "... can
not be found ..."

I believe that this is a serious migration obstacle, so I change Priority from 4
to 3.

This i not a WRITER issue, same problem for hyperlink in CALC.
Comment 14 Rainer Bielefeld 2005-12-10 09:08:35 UTC
*** Issue 59126 has been marked as a duplicate of this issue. ***
Comment 15 Olaf Felka 2005-12-12 08:32:24 UTC
Please don't change the owners of issue!!
Comment 16 giorgiodemontis 2009-10-25 17:34:53 UTC
No good new for this very important feature who worked fine in OOo 1.1.

Comment 17 Mathias_Bauer 2010-06-16 17:06:48 UTC
the bug is triggered by the fact that the URL to open is handed over to the
system, not handled by OOo internally. That can't work as "#" in file URLs are
not what they are in e.g. http URLs. The only solution would be *not* to let the
system handle the URL (and that's the reason why it works in Word).

Changing that is a matter of minutes, but the side effect could be larger than
expected. Allowing to handle all URLs internally that OOo can open (detected by
pFilter != 0 in the code above) is not wanted, as many other formats like e.g
jpg, png etc. surely should preferably handled by the system and the application
registered there.

Another idea: check for "#" in the URL, and in case there is one, handle the URL

Comment 18 Mathias_Bauer 2010-06-16 19:24:13 UTC
Proposed fix:

In sfx2/source/appl/appopen.cxx we have

// Mark without URL cannot be handled by hyperlink code
if ( bHyperlinkUsed && aFileName.Len() && aFileName.GetChar(0) != '#' )
    // hands over URL to system after some more checks

This code assumes that every URL that contains a file name (with any protocol)
that was dispatched by clicking a hyperlink may be a candidate for handing it
over to the system so that the registered application can be started.

IMHO we should do also for file URLs with jump marks:

INetURLObject aURL( aFileName );
bool bIsPureHashMark = aFileName.GetChar(0) == '#';
bool bIsFileURLWithHashMark = aURL.GetProtocol() == INET_PROT_FILE &&
aFileName.SearchAscii("#") != STRING_NOTFOUND;

if ( bHyperlinkUsed && aFileName.Len() && !bIsPureHashMark &&
!bIsFileURLWithHashMark )
    // etc. etc.
Comment 19 knobo 2010-06-19 01:01:52 UTC
> INetURLObject aURL( aFileName );
> bool bIsPureHashMark = aFileName.GetChar(0) == '#';
> bool bIsFileURLWithHashMark = aURL.GetProtocol() == INET_PROT_FILE &&
> aFileName.SearchAscii("#") != STRING_NOTFOUND;

This is not good enough for html links with bookmarks.
I think it needs hints about what we can and want to handle and what we
absolutely does not handle.

On my system (Ubuntu linux) hyperlinks like this: Works fine now.
...doc#bookmark does not. I have not tried http links on windows.

> if ( bHyperlinkUsed && aFileName.Len() && !bIsPureHashMark &&
> !bIsFileURLWithHashMark )
> {
>     // etc. etc.
Comment 20 knobo 2010-06-19 01:11:10 UTC
> bool bIsFileURLWithHashMark = aURL.GetProtocol() == INET_PROT_FILE &&

Aha.. the INET_PROT_FILE should fix the http issue.. 
argh.. can not delete comments here..
Comment 21 Rainer Bielefeld 2010-06-19 08:38:30 UTC
I still see the problem with "Ooo-Dev 3.3 multilingual version English UI WIN
XP: [DEV300m82 (Build 9510)]"!

TM 3.2 seems to be no longer realistic  ;-)
Comment 22 Mathias_Bauer 2010-06-19 12:37:48 UTC
Of course if your doc file is not in the file system, the check for the file
system protocol must be removed also. My suggestion was thought as the least
invasive change.

The general idea of this code is that content that usually is viewed outside of
OOo should be handled by the system. This makes sense for html, jpg etc.
Bookmarks won't work then if the URL is a file URL as they are not usable with
that protocol. In case of doc files the patch makes sense, in case of html files
we have to choose if we either want the right application (browser) or the bookmark.
Comment 23 knobo 2010-10-14 14:48:08 UTC
If MS Word or WordViewer is default application for .doc-files on my computer,
and I open a .doc file in and click on hyperlink to another
.doc-file, then this .doc-file opens in MS Word or WordViewer.

I can not understand for a second what is right about this. An analogy can be
that when Internet Explorer is the default web-browser, and I click on a
hyperlink from Opera, the link should be opened in Opera, and not IE, even
though IE is the default browser for .html files.

This should be REALLY simple to solve. Always check if we ( can
handle the document (amongst odt,swx,doc,xls,html.....), if not, give it to the
OS. This is the _only_ sane behavior. 

Then a wrapper for the Open dispatch function should be made if you do _not_
want to handle the responce in OOo.

Best regards.
Knut Olav Bøhmer
Comment 24 knobo 2010-10-20 12:48:40 UTC
when I don't want files to be opened in the same application, for example in 
firefox, I right-click and click "open in".

Should be the same in OOo: Right click and "open in default app" for example (or 
ctr-alt click)
Comment 25 Martin Hollmichel 2011-03-15 20:59:53 UTC
set target to 3.x since not release relevant for 3.4 release.
Comment 26 Marcus 2017-05-20 10:55:46 UTC
Reset assigne to the default "".