Problem

Existing bookmarks in a custom Word Export template are missing after exporting in R4J.

Bookmarks that are removed will notably include a trailing white space in the selection and template language directly below that retrieves a null value.

Root Cause

The trailing space at the end of the line when highlighting is called show/hide paragraph mark which indicates paragraph break. This is one of MSWord's non-printable symbols so it is not included in the content itself during parsing and, therefore, cannot be parsed by the template parser. Due to the way MSWord handles this (see here for further reading), the template parser treats the next line as part of the bookmark since the trailing space was highlighted as well.

If the template statement directly below a bookmark with a trailing white space retrieves a null value, the value for the bookmark is considered null and the bookmark is deleted. When the exported file is generated, this bookmark doesn't exist the same way anymore and, thus, Word drops it.

Solution

Recommended

Other