Bookmark Tag - Link to locations with a document


To create links to locations in a document based on names retrieved from a datasource.


Inserting a Tag, ForEach Tag, Link tag

Starting Template

Start with the template created in the For-Each Tags tutorial, after finishing the extra-credit section.


1. Insert a Page Break

  • Insert a page break to the beginning of the document.
  • We are inserting a page break before the table, at the very beginning of the document so that the first page is blank. This is where we will put our table of contents. There should now be three pages in your template: a blank page, a page with a table, and a page with an "End ForEach" tag.

    Show Me How!

    2. Add "ForEach" Tag

  • Add a "ForEach" tag and bind it to the customer table.
  • Name the "ForEach" tag's variable: "customer"
  • Add an "End ForEach" tag.
  • Now we will add a "ForEach" tag where we are going to create a table of contents using Link tags. Bind it to the "customer" table in the "Data Tree" and add an "End ForEach" tag. It would be a great idea to give a nickname and variable name to the tag. Name the variable "customer."

    Show Me How!

    3. Add Link

  • Add a link tag, bind it to "customer_id"
  • Prepend " 'id'+ " to the tag's "value" field
  • Select "bookmark" as the type.
  • Now we will add a link tag. The plan is to use the customer ID as the bookmark, which is what the link will point to. In Microsoft Word, bookmark names cannot start with numbers so we are going to pre-pend the bookmark with the text 'id'.

    After adding the link tag, select the customer ID as the data, and then add 'id'+ to the beginning of the "select" string as shown in the video below. We do this because sometimes, ID columns are numbers. When using bookmarks, the value cannot start with a number, so we make it always start with "id." For a row where the ID is 200, the bookmark value is "id200". Finally, select the link "Type" as "bookmark." Don't forget an End Link tag!

    Show Me How!

    4. Add Out Tags

  • Add two out tags, bind them to the first and last name of the customer
  • We are going to add "out" tags that display the first and last name of the customer. This step should be familiar if you have done the inserting a tag tutorial.

    Show Me How!

    5. Add a bookmark tag

  • Add a bookmark tag anywhere in the original foreach table (page 2)
  • For the value, use the same string as the Link tag's value.
  • Next is the bookmark tag. This is the anchor that the link tag will point to, so it's "value" field must be exactly the same. For this reason we'll select "customerID" as the data, and prepend " 'id'+ " to the value.

    Show Me How!

    6. Generate the Output

  • Click "Output" and then "DOCX"
  • Show Me How!

    7. Test: Click Link

  • Try clicking a link in the output (while holding the control key)
  • Show Me How!

    Quiz Yourself!

    True/False: Bookmark tags could be used to create a table of contents in a long report


    You have completed this tutorial. We recommend taking a look at the If-Else tags tutorial next!