Forum


Replies: 1   Views: 578
Can we do searchandreplace only from header or footer
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by ZeroDocs.com1  · 16-05-2022 - 10:47

Hi,

I am using searchAndReplace which works well in the document body or headersAndFooters. Can we searchAndReplace only from the header or only from the footer of the Word documents?

Posted by admin  · 16-05-2022 - 12:13

Hello,

The searchAndReplace method allows using the following scopes ($options parameter): document, endnotes, comments, headersAndFooters and footnotes. Headers and footers are set in the same scope, so there's no option to use searchAndReplace only in headers or footers (both scopes are replaced with headersAndFooters).

We have opened a task to be added in a future release of phpdocx.

Please note that a custom development can be done if you need to use searchAndReplace in headers or footers instead of both scopes at the same time. If you are interested on this custom development, you can open a support ticket and send if you are using the classic or the namespaces package; the dev team will generate and send an updated class attached to a ticket reply to allow the requested task (using headers and footers as standalone scopes in the searchAndReplace method).

Regards.