Replaces an existing content by a WordFragment.


Element definition

Attributes and sub-elements


The template variable name to be replaced by the text content.


The possible keys and values of this array are:

key Description
type * (all, default value), break, chart, endnote (content reference, the whole paragraph is removed), footnote (content reference, the whole paragraph is removed), image, paragraph (also for bookmarks, links and lists), section, shape, table.
contains Contains a text string.
ocurrence Number of ocurrence from 1.
attribute Contains a specific attribute key and value.
parent Main document body as default, allows to set any parent or a specific one. w:body (default), '/' (any parent) or any other specific parent (/w:tbl/, /w:tc/, /w:r/...).
target Target content: document, header, footer.
referencePositions Based on the sectPr contents order.
referenceSections Section number.
referenceTypes Header/footer type: first, even, default.
customQuery Custom xpath query, overwrites any other reference.


After (default), before, inlineBefore or inlineAfter. Inline locations don't create a new w:p and add the WordFragment before or after the referenceNode (only inline elements).


If true appends the WordFragment if the reference node could not be found (false as default).

Code samples
#Example 1