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

Hyperlinks in OpenOffice Templates | Table of Contents | Files and Directories >


  1. XPath Placeholder Does Not Get Replaced

  2. Troubleshooting Hyperlinks

  3. Troubleshooting Tables

  4. If All Else Fails

XPath Placeholder Does Not Get Replaced

Most probably it means that the placeholder got split by some XML tag in the template. Most often this happens when OpenOffice sees an "@" in a string, thinks it is an e-mail address and automatically inserts a hyperlink. In Microsoft Word this sometimes happens because of the spell checker highlighting.

In OpenOffice select the whole placeholder (including all the curly brackets), right click to call the context menu and select "Default Formatting". Save the template.

Microsoft Word sometimes introduces additonal XML markup to indicate spellchecker and grammar checking errors. This markup may break the placeholder text, so it does not get replaced when the document is generated. If this happens, try switching off spell checker and grammar checker and saving the template. In Word 2003, go to "Tools" → "Spelling And Grammar...", click on "Options.." button and uncheck "Check spelling as you type" and "Check grammar as you type", thenk click "OK" to dismiss Options dialog and "Cancel" to dismiss "Spelling and Grammar" dialog.

Troubleshooting Hyperlinks

In a generated report you can see where a hyperlink is pointing if you hover the mouse pointer over the hyperlink.

Hyperlink targets are evaluated before the hyperlink text and modify the current scope. Suppose you want to create hyperlinks to hosts sections, where each host has a bookmark with the name set to its @id.

Hosts section will look something like this:

Test Details By Host

Host {{//host}}{{./@id|bookmark,leaf}}

Some text related to this host

The section containing hyperlinks to hosts will look like this (without hyperlinks)

Affected Systems

  • {{ancestor::host}}

Now if we want to hyperlink each host in Affected Systems section, we can do the following. First, set the scope to host using a placeholder with a "hidden" flag, and then use this scope both in the hyperlink text and target, making sure we put in the "leaf" flag in the hyperlink target. Now the Affected Systems section will look like this:

Affected Systems

  • {{ancestor::host|hidden}}{{.}}

The hyperlink target will contain the following placeholder: {{./@id|leaf}}

When the report generator processes the template first it will read the first placeholder, and create the copies of the paragraph, each with its own host as a base node. Then it will process the hyperlink target and replace it with the host @id. Since it is marked as leaf, it will not affect the current base node. Then it will process the hyperlink text "{{.}}" and replace it with the current host IP address. When the report is generated, this section will become a list of IP addresses each hyperlinked to the appropriate host details section.

Troubleshooting Headings

In OpenOffice if you see that placeholders in headings are not properly scoped (that is, heading seems to be treated like a normal text paragraph, not like a heading) it means that the heading style being used is represented by text:p rather than text:h tag in OpenOffice XML. This happens when a heading style is not assigned and outline level.

To correct this, go to Tools→Outline Numbering in OpenOffice Writer and assign the heading styles that are not handled correctly to appropriate outline levels. Save the template and regenerate the report.

Troubleshooting Tables

MagicTree report generator currently does not handle tables embedded inside other tables. It probably won't handle the placehodlers occuring inside lists embedded inside tables either.

Consider using tab stops for formatting instead of tables.

If this limitation really bugs you, contact us. We just thought that nowbody cares about embedded tables too much, so we did not implement recursing into tables. If somebody does care, we'll try to implement it.

If All Else Fails

Take your report template and unzip it. Look at content.xml file in OpenOffice or at word/document.xml in Microsoft Word template and try to find the placeholder that is problematic. If that does not provide any enlightenment, contact us.

Hyperlinks in OpenOffice Templates | Table of Contents | Files and Directories >


+32 (0) 2 215 53 58

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