pdx:searchAndReplace

Searches and replaces a given string of text in a Word document.

Description

Element definition

This element allows the substitution of plain text in a DOCX document.

Attributes and sub-elements

src

The path to the source Word document.

target

The path to the Word document resulting after the text replacement.

searchTerm

The string of text that we want to replace.

replaceTerm

The string of text that we want to include.

options

key Description
document If true searchs and replaces the string in the body of the document. The default value is true.
endnotes If true searchs and replaces the string in the document endnotes. The default value is false.
comments If true searchs and replaces the string in the document comments. The default value is false.
headersAndFooters If true searchs and replaces the string in headers and footers. The default value is true.
footnotes If true searchs and replaces the string in the document footnotes. The default value is false.
Code samples
#Example 1

config.xml

content.xml

settings.xml

The resulting Word document looks like: