Hyperlink to Bookmark

Home Forums Open-Xml-Sdk Hyperlink to Bookmark

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3666
    Eric White
    Keymaster

    As you know, you can create a bookmark by inserting w:bookmarkStart / w:bookmarkEnd elements at the appropriate place in the markup:

        <w:p>
          <w:bookmarkStart w:id="1"
                           w:name="TestBookmark"/>
          <w:bookmarkEnd w:id="1"/>
          <w:r>
            <w:t>To make your document look professionally produced.</w:t>
          </w:r>
        </w:p>

    You can create a link to this bookmark by inserting the following markup:

        <w:p>
          <w:hyperlink w:anchor="TestBookmark"
                       w:history="1">
            <w:r w:rsidRPr="001B53E7">
              <w:rPr>
                <w:rStyle w:val="Hyperlink"/>
              </w:rPr>
              <w:t>TestBookmark</w:t>
            </w:r>
          </w:hyperlink>
          <w:r>
            <w:t>Video provides a powerful way.</w:t>
          </w:r>
        </w:p>

    The w:hyperlink element should be a child of the paragraph, and a sibling to the runs.

    -Eric

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.