Submitted by alla on Thu, 11/25/2010 - 15:52

Hyperlinks and Bookmarks | Table of Contents | Hyperlinks in OpenOffice Templates >

Microsoft Word documents can contain hyperlinks to parts of the same document or to external resources. To link to some part of the document we need to point a hyperlink to a bookmark in the document. Microsoft Word GUI prevents us from creating hyperlinks that link to non-existant bookmarks.

However we can still create hyperlinks that point to arbitrary values (including XPath placeholders) by pretending that the hyperlink points to an external resource. To do that, select the text you want to link, go to "Insert" menu and select "Hyperlink...". In the "Insert Hyperlink" dialog box in the "Link to..." panel on the left, make sure that "Existing File or Web Page" is selected and not "Place in This Document". Type the XPath placeholder in the Address: text field, for example host , then click "OK".

By default the MagicTree Report generator assumes that all hyperlinks that have XPath placeholders in their targets are internal hyperlinks, pointing to a bookmark in the document. However you may want to link to an external resource, such as a web page. For example, for all CVE IDs you want to create a hyperlink to the appropriate page on cve.mitre.org site. This is also possible. To instruct MagicTree report generator to treat the hyperlink as external, add the "external" flag to the XPath placeholder in the hyperlink target. For example you may type the following in the "Address:" text field:

http://cve.mitre.org/cgi-bin/cvename.cgi?name={{cve|external}}

Mictosoft Word performs URL encoding on the hyperlink targets, so next time you view the hyperlink, it may be URL-encoded. MagicTree report generator decodes URL-encoding in hyperlink targets before extracting and evaluating XPath expressions.

Troubleshooting

You can see the location where the hyperlink is pointing in a tooltip when you place the mouse pointer over the hyperlink.

Microsoft Word sometimes behaves strangely when it sees forward slashes in a hyperlink target and replaces it with back slash. To prevent this, two slashes in XPath expressions may be URL-encoded as %2f%2f.

When MS Word sees the "at" sign (@) in a hyperlink target, it assumes it is an email address and inserts "mailto:" in front of it. To prevent this behaviour, use %40 instead of @.

Hyperlinks and Bookmarks | Table of Contents | Hyperlinks in OpenOffice Templates >

Contacts

+32 (0) 2 215 53 58

Gremwell BVBA
Sint-Katherinastraat 24
1742 Ternat
Belgium
VAT: BE 0821.897.133.