Hyperlinks issue in Visio 2007 (Getting "../" in gif_1.htm file)

P

Pradeep

Hi All,
I am creating hyperlink to a document from a image in Visio 2007 by
using INSERT-->Hyperlinks (checking the relative path option). After
that I am saving it as web page and publishing it.
The complete web address of the document will be provided later by my
code. When I run my code hyperlinks doesn't work. I am unable to
understand the issue as the same works fine with Visio 2003. Then I
compared the gif_1.htm file of visio 2003 and visio 2007 for the same
and found that a extra string "../" has been inserted in HREF section
(just before the name of document to be linked) in Visio 2007 created
gif_1.htm. If I remove them mannually then everything works fine.

Can anybody help me out to understand the HTML behaviour in Visio 2003
and Visio 2007 and provide and workaround for that.

Thanks in advace

Pradeep
 
S

Scott Helmers

Pradeep,

I believe you've run into a "behavior change" between Visio 2003 and Visio
2007. Microsoft changed the implied hyperlink base for relative links when
publishing web pages. It's a change for the better, IMHO, but a change
nonetheless.

In Visio 2003, if you create a relative link to a document, the implied
hyperlink base when following the link *from within Visio* is the folder
containing the Visio document. Yet when you save the drawing as a web page,
and follow the link *from your web browser*, the implied hyperlink base is
the subfolder containing all of the javascript, html and other files for the
web-published drawing -- it is *not* the folder containing the visio drawing
and the primary web page but is one level down, i.e., in the subfolder.

In Visio 2007, the code produced by the save as web page function is
different. The implied hyperlink base is the same for both the Visio drawing
file and for saved web pages, which means that for saved web pages, it is the
folder containing the primary html page. Your observation about the contents
of gif_1.htm is correct -- the "../" is what pushes the starting point for
following links back up one level in the Windows directory hierarchy.

You should be able to work around the change in Visio 2007 by moving the
target document up one level in the Windows directory structure.
 
P

Pradeep

Pradeep,

I believe you've run into a "behavior change" between Visio 2003 and Visio
2007. Microsoft changed the implied hyperlink base for relative links when
publishing web pages. It's a change for the better, IMHO, but a change
nonetheless.

In Visio 2003, if you create a relative link to a document, the implied
hyperlink base when following the link *from within Visio* is the folder
containing the Visio document. Yet when you save the drawing as a web page,
and follow the link *from your web browser*, the implied hyperlink base is
the subfolder containing all of the javascript, html and other files for the
web-published drawing -- it is *not* the folder containing the visio drawing
and the primary web page but is one level down, i.e., in the subfolder.

In Visio 2007, the code produced by the save as web page function is
different. The implied hyperlink base is the same for both the Visio drawing
file and for saved web pages, which means that for saved web pages, it is the
folder containing the primary html page. Your observation about the contents
of gif_1.htm is correct -- the "../" is what pushes the starting point for
following links back up one level in the Windows directory hierarchy.

You should be able to work around the change in Visio 2007 by moving the
target document up one level in the Windows directory structure.

Hi Scott,
Thanks for detailed information.
Well, I am not picking the document directly from the file system.
While running my software program the gif_1.htm gets uploaded in a
server and the hyperlink name there will be used. Here the problem
comes, instead of taking the document name it is taking ../<document
name> (as explained by you earlier regarding relative paths in Visio
2007). I have also written logic in my program to remove the string
from gif_1.htm but I don't think that will be the good solution.
Can you suggest any workaround for removing these "../ " ?

Thanks in advance.

regards
Pradeep
 
S

Scott Helmers

You can't prevent Visio 2007 from inserting "../" in the web page files. So I
guess the question is -- do you need your code to work just with Visio 2007
or must your code work with web pages produced by both Visio 2003 and 2007?

If just Visio 2007, then you can avoid the need to modify the gif_1.htm by
changing the placement of the document that is the hyperlink target, i.e.,
ensure that the object of your hyperlink is one level higher in the Windows
directory hierarchy than it was for Visio 2003 web pages.

If you need your code to work for both Visio 2003 and 2007, I think you're
stuck with modifying the gif_1.htm file for the Visio 2007 case.
 
P

Pradeep

You can't prevent Visio 2007 from inserting "../" in the web page files. So I
guess the question is -- do you need your code to work just with Visio 2007
or must your code work with web pages produced by both Visio 2003 and 2007?

If just Visio 2007, then you can avoid the need to modify the gif_1.htm by
changing the placement of the document that is the hyperlink target, i.e.,
ensure that the object of your hyperlink is one level higher in the Windows
directory hierarchy than it was for Visio 2003 web pages.

If you need your code to work for both Visio 2003 and 2007, I think you're
stuck with modifying the gif_1.htm file for the Visio 2007 case.

Hi Scott
You are right. We can't prevent Visio to insert ../. Now, I have
fixed the issue by putting some piece of code in my program for
removing "../".

Thanks for all your suggestions
Pradeep
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top