Hyperlink to Bookmark

Home Forums Open-Xml-Sdk Hyperlink to Bookmark

This topic contains 1 reply, has 2 voices, and was last updated by  Eric White 8 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3599

    Dear All,

    I write C# code, which creates “Bookmark”. I would like to create Hyperlink which open that bookmark which created earlier steps.

    Please give me some solution to achive this.

    I am using OpenXML-SDK 2.5.

    Thanks in advance.

    Sandip Dutta

    #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 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.