Visio Guy

Visio Discussions => Visio 2010 Issues => Topic started by: ashley.clements on June 12, 2013, 06:16:12 PM

Title: Tooltip Linebreak
Post by: ashley.clements on June 12, 2013, 06:16:12 PM
I am trying to create a datacenter layout that will ultimately be in HTML form. My goal is to have the equipment information pop up on hover while viewing the HTML document. I have successfully got the tooltip popping up with the information I desire, just not in a format I desire. It is one continuous string with no line breaks. I have tried using the CHAR(10) and CHAR(13) with no success. Any one have any way to insert line breaks. My current formula is below.

Current:
user.visEquivTitle = "Enclosure ID: " & Prop.EnclosureID & Prop.Location

Tried using this with no success:
user.visEquivTitle = "Enclosure ID: " & Prop.EnclosureID & CHAR(10) & Prop.Location
Title: Re: Tooltip Linebreak
Post by: Jumpy on June 14, 2013, 07:01:08 AM
Could you fool the Convert to HTML with a <br> already in the formula?
Or maybe do the changes in the HTML ducumet afterwards?
Title: Re: Tooltip Linebreak
Post by: Hey Ken on June 17, 2013, 03:46:19 PM

Ashley:

   Got just what you need. 

   I also encountered various problems when publishing hover text to the web that required me to A) hack at Visio, and B) diddle the HTML when the hacking failed.  But I eventually got what I needed, a macro for publishing a drawing to the web (http://visguy.com/vgforum/index.php?topic=2207.msg18990#msg18990) that sets the proper Visio options and automatically edits the main HTML source and each individual HTML page to fix all the anomalies.  With a minor modification, you can use the macro to address your line break issue (and maybe a number of other issues you're not yet aware of).

   The way I'd suggest you approach it is a two-step process:

1)  In Visio, put in some unique string where you'd like to see a line break, such as "~";
2)  Edit the final HTML to replace the "~" with the HTML code for a line break, specifically "&#10;".

   You can manually edit each of the generated HTML files, but the easier way is to use the web publishing code (http://visguy.com/vgforum/index.php?topic=2207.msg18990#msg18990) I mention above and add one more edit.  Where it says, "Remove floating page name (only appears in IE)", add the following:


        Const Marker = "~"
        Do Until I = 0
            I = InStr(1, AString, Marker)
            If I > 0 Then
                AString = Left(AString, I - 1) & "&#10;" & Right(AString, Len(AString) - I - (Len(Marker) - 1))
                End If
            Loop


   When you run the entire macro, it'll automatically replace the "~" with the HTML new line code.  Of course you can use other marker characters besides the tilde; just be sure to change the Const in the code above.  FYI I tried using CHAR(10) as the marker, but it always grabbed the end of every line.  Not good.  I also tried CHAR(13) (i.e., carriage return), but Visio translates it into a space somewhere along the line such that it doesn't appear in the HTML.  I also tried using <br>, but it doesn't work inside quotes.  There may be other solutions, but at least this one works.

   Good luck! 

   - Ken