XmlApi - pdx:searchAndReplace

pdx:searchAndReplace

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

Note

You are reading the XMLAPI documentation. For the API method please go to searchAndReplace.

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 highlighting.

searchTerm

The string of text that you want to replace.

replaceTerm

The string of text that you want to include.

options

Key Description
document If true searches and replaces the string in the body of the document. The default value is true.
endnotes If true searches and replaces the string in the document endnotes. The default value is false.
comments If true searches and replaces the string in the document comments. The default value is false.
headersAndFooters If true searches and replaces the string in headers and footers. The default value is true.
footnotes If true searches and replaces the string in the document footnotes. The default value is false.
Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code

The resulting Word document looks like: