searchAndRemove
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
searchAndRemove
ADVANCED / PREMIUM
TRIAL
Removes the paragraphs containing a given string of text.
Description
public searchAndRemove (string $source, string $target, mixed $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 or array that you want to remove.
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 false. |
footnotes | bool | If true searches and removes the paragraphs containing the search string in the document footnotes. The default value is false. |
headers | bool | If true highlights the search string in headers. The default value is false. |
footers | bool | If true highlights the search string in footers. The default value is false. |
Exceptions
Error while trying to open the (base) template as a zip file.
Release notes
- phpdocx 15.0:
- htmlspecialchars applied in the search value.
- phpdocx 14.0:
- return DOCXStructure.
- phpdocx 13.5:
- DOCXStructure and in-memory DOCX documents.
- phpdocx 13.0:
- headers and footers scopes.
- phpdocx 12.5:
- array in search parameter.