searchAndRemove

searchAndRemove

ADVANCED / PREMIUM BASIC

Removes the paragraphs containing a given string of text.

Description
public searchAndRemove (string $source, string $target, string $search [, array $options])

This method allows to remove paragraphs that contain the search string.

Parameters

source

The path to the source Word document.

target

The path to the resulting Word document.

search

The string of text that you want to search.

options

The possible keys and values are:

Key Type Description
document bool If true searches and removes the paragraphs containing the search string in the body of the document. The default value is true.
endnotes bool If true searches and removes the paragraphs containing the search string in the document endnotes. The default value is false.
comments bool If true searches and removes the paragraphs containing the search string in the document comments. The default value is false.
headersAndFooters bool If true searches and removes the paragraphs containing the search string in headers and footers. The default value is true.
footnotes bool If true searches and removes the paragraphs containing the search string in the document footnotes. The default value is false.
Code samples

Example #1

The resulting Word document looks like: