views:

34

answers:

1

Hi there, Is it possible to open an html document with word, and have anchor links work within the document?

Basically, It'd be nice to do this:

<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'&gt;
  <head></head>
  <body>
    <h1>Florida Emergency Supplier Network for 2009-2011</h1>
    <table id='table_of_contents'>
      <tr>
        <th></th>
        <th><a href="#service_list">Browse by Services</a></th> !!! THIS LINKS TO 
                                                                    THE CORRECT LOCATION
                                                                    IN THE DOCUMENT.
      </tr>                                                                     /
    </table>                                                                   /
    <hr />                                                                    /
    <h1 id='service_list'>Service List</h1>                 <----------------/
       ....more stuff here...
  </body>
</html>

Right now when I hold Ctrl+click the links, they don't go to the correct location.

EDIT Unfortunately using the name field doesn't work either, from what I can tell...any other ideas?

+2  A: 

Try doing this:

<a name="service_list" />
<h1>Service List</h1> 

Or this:

<a name="service_list"><h1>Service List</h1></a>
Tim S. Van Haren
No dice, ...I keep getting sent back to the beginning of the document. Any idea why that would happen?(I'm generating this with HAML, and am absolutely guaranteed that all ids are unique, and the HTML is valid...checked in a validator)
btelles
What version of MS Word are you using?
Tim S. Van Haren
I tried your code above in MS Word 2003, added a bunch of line breaks to allow me to jump down the document page, and added the named anchor I suggested above, and Ctrl+Click worked for me.
Tim S. Van Haren
Scheisser...all righty...I'll keep chuggin'. I'm using 2007. Thanks Tim.
btelles
Note that although I accepted the answer, I was not able to get this to work on WOrd 2007.
btelles