Create a hyperlink to a webpage

D

Damo

We automatically convert our Organisation to html in Visio. If you
CTRL-Click on a shape you get to see the "properties" of that shape over on
the left of the screen. One of the fields is currently text and we want to
make it a hyperlink to a separate web page.

I can see where the text is stored after the html is created (a file called
data.xml)

<Prop ID="6" Name="Link" NameU="Link">
<Value Unit="STR">http://www.webpage.com</Value>
<Label>Link</Label>
</Prop>

What I need is http://www.webpage.com to be an HTML hyperlink, but I don't
need the shape to be a hyperlink.

Does anyone know how to do this?

Cheers
 
C

Chris Roth [MVP]

Hi Damo,

I tried to trick the Save As Web by putting html in the shape property, ie:

Prop.Link = "<a href='http://www.visguy.com' title='Visio Guy'>Visio
Guy</a>"

but the export seems to be too clever and is escaping the link so that it
appears as text. I don't know if there are any cleverer ways to
"anti-escape" the property-text in order to fool the export. Kinda starts to
sound like a security risk at some point... : )

If your summer interns are still around, they might be able to massage the
Save As Web output with some sort of post-process utility that would make
your link a link again, but this is extra programming, and an extra step in
your publishing process...

Anybody else got any ideas?

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 
J

John Goldsmith

Hello Damo,

Inspired by Chris's suggestion I've been having a look at the frameset.js
file (which I'm assuming your reasonably ok with as you're looking in that
folder area already).

As Chris says there's an HTMLEscape function at the bottom of this file
which prevents the links from being links, however with a little editting
you can get the behaviour you're after:

Search the file for "if (oPropValue)" (there's only one instance of this)
and replace the following:

if (oPropValue)

{

strValueText = HTMLEscape (oPropValue.text);

}



.....with:

if (oPropValue)

{

if (String(oPropValue.text).charAt(0) == "s")

{

strValueText =
String(oPropValue.text).substring(1,(String(oPropValue.text).length));

}

else

{

strValueText = HTMLEscape (oPropValue.text);

}

}



You can then use the following link text in the shapesheet:

="s<a href='http://www.bbc.co.uk' target='_blank'>BBC</a>"

If you always use the same Save as web page settings then you can just
replace the frameset.js file with your editted version so at least you won't
javascripting each time. You may also want to choose a start character
other than "s" that will be unique within the Shape Data cells.

Anyway, hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.co.uk
 
C

Chris Roth [MVP]

Oooh John!

It's nice to find smart folks like you out there! I'm glad you had the
patience to pore through the Visio/html-output and work this out! Tempted to
turn this one into an article/utility for my blog...

--
Thanks!

Chris Roth
Visio MVP
http://www.visguy.com
 
D

Damo

Thanks to both of you. I shall try this first thing on Monday & let you know
of the results :)

John Goldsmith said:
Thanks Chris. Better get on with my own work now:)

Look forward to your next blog post.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

Chris Roth said:
Oooh John!

It's nice to find smart folks like you out there! I'm glad you had the
patience to pore through the Visio/html-output and work this out! Tempted
to turn this one into an article/utility for my blog...

--
Thanks!

Chris Roth
Visio MVP
http://www.visguy.com


John Goldsmith said:
Hello Damo,

Inspired by Chris's suggestion I've been having a look at the frameset.js
file (which I'm assuming your reasonably ok with as you're looking in
that folder area already).

As Chris says there's an HTMLEscape function at the bottom of this file
which prevents the links from being links, however with a little editting
you can get the behaviour you're after:

Search the file for "if (oPropValue)" (there's only one instance of this)
and replace the following:

if (oPropValue)

{

strValueText = HTMLEscape (oPropValue.text);

}



....with:

if (oPropValue)

{

if (String(oPropValue.text).charAt(0) == "s")

{

strValueText =
String(oPropValue.text).substring(1,(String(oPropValue.text).length));

}

else

{

strValueText = HTMLEscape (oPropValue.text);

}

}



You can then use the following link text in the shapesheet:

="s<a href='http://www.bbc.co.uk' target='_blank'>BBC</a>"

If you always use the same Save as web page settings then you can just
replace the frameset.js file with your editted version so at least you
won't javascripting each time. You may also want to choose a start
character other than "s" that will be unique within the Shape Data cells.

Anyway, hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

"Chris Roth [MVP]" <visioguy [at] hotmail [dot] com> wrote in message
Hi Damo,

I tried to trick the Save As Web by putting html in the shape property,
ie:

Prop.Link = "<a href='http://www.visguy.com' title='Visio Guy'>Visio
Guy</a>"

but the export seems to be too clever and is escaping the link so that
it appears as text. I don't know if there are any cleverer ways to
"anti-escape" the property-text in order to fool the export. Kinda
starts to sound like a security risk at some point... : )

If your summer interns are still around, they might be able to massage
the Save As Web output with some sort of post-process utility that would
make your link a link again, but this is extra programming, and an extra
step in your publishing process...

Anybody else got any ideas?

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/

We automatically convert our Organisation to html in Visio. If you
CTRL-Click on a shape you get to see the "properties" of that shape
over on
the left of the screen. One of the fields is currently text and we
want to
make it a hyperlink to a separate web page.

I can see where the text is stored after the html is created (a file
called
data.xml)

<Prop ID="6" Name="Link" NameU="Link">
<Value Unit="STR">http://www.webpage.com</Value>
<Label>Link</Label>
</Prop>

What I need is http://www.webpage.com to be an HTML hyperlink, but I
don't
need the shape to be a hyperlink.

Does anyone know how to do this?

Cheers
 
D

Damo

Yep, it worked perfectly.

Thank you so much!

Damo said:
Thanks to both of you. I shall try this first thing on Monday & let you know
of the results :)

John Goldsmith said:
Thanks Chris. Better get on with my own work now:)

Look forward to your next blog post.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

Chris Roth said:
Oooh John!

It's nice to find smart folks like you out there! I'm glad you had the
patience to pore through the Visio/html-output and work this out! Tempted
to turn this one into an article/utility for my blog...

--
Thanks!

Chris Roth
Visio MVP
http://www.visguy.com


Hello Damo,

Inspired by Chris's suggestion I've been having a look at the frameset.js
file (which I'm assuming your reasonably ok with as you're looking in
that folder area already).

As Chris says there's an HTMLEscape function at the bottom of this file
which prevents the links from being links, however with a little editting
you can get the behaviour you're after:

Search the file for "if (oPropValue)" (there's only one instance of this)
and replace the following:

if (oPropValue)

{

strValueText = HTMLEscape (oPropValue.text);

}



....with:

if (oPropValue)

{

if (String(oPropValue.text).charAt(0) == "s")

{

strValueText =
String(oPropValue.text).substring(1,(String(oPropValue.text).length));

}

else

{

strValueText = HTMLEscape (oPropValue.text);

}

}



You can then use the following link text in the shapesheet:

="s<a href='http://www.bbc.co.uk' target='_blank'>BBC</a>"

If you always use the same Save as web page settings then you can just
replace the frameset.js file with your editted version so at least you
won't javascripting each time. You may also want to choose a start
character other than "s" that will be unique within the Shape Data cells.

Anyway, hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

"Chris Roth [MVP]" <visioguy [at] hotmail [dot] com> wrote in message
Hi Damo,

I tried to trick the Save As Web by putting html in the shape property,
ie:

Prop.Link = "<a href='http://www.visguy.com' title='Visio Guy'>Visio
Guy</a>"

but the export seems to be too clever and is escaping the link so that
it appears as text. I don't know if there are any cleverer ways to
"anti-escape" the property-text in order to fool the export. Kinda
starts to sound like a security risk at some point... : )

If your summer interns are still around, they might be able to massage
the Save As Web output with some sort of post-process utility that would
make your link a link again, but this is extra programming, and an extra
step in your publishing process...

Anybody else got any ideas?

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/

We automatically convert our Organisation to html in Visio. If you
CTRL-Click on a shape you get to see the "properties" of that shape
over on
the left of the screen. One of the fields is currently text and we
want to
make it a hyperlink to a separate web page.

I can see where the text is stored after the html is created (a file
called
data.xml)

<Prop ID="6" Name="Link" NameU="Link">
<Value Unit="STR">http://www.webpage.com</Value>
<Label>Link</Label>
</Prop>

What I need is http://www.webpage.com to be an HTML hyperlink, but I
don't
need the shape to be a hyperlink.

Does anyone know how to do this?

Cheers
 

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