Bookmarks removed after export using custom Word export template

Problem

Bookmarks in a custom Word export template can go missing after export in R4J. The problem arises in the folloiwng stuation:

  • A bookmark is created from selected text that includes a trailing white space.

  • A line of template code follows immediately beneath.

This example illustrates the problem:

The first line is the bookmark, highlighted to show that it ends with a trailing white space. Immediately following the bookmark is a line of template code. In this situation, the trailing space interferes with how Word parses the line of code, with the result that the bookmark gets deleted and hence doesn’t appear in the exported file.

Solution

Avoid inadvertently including trailing white space in a bookmark by selecting the text for the bookmark directly (not with double click), making sure the trailing white space is excluded from the highlighted text.