Forum


Replies: 1   Views: 303
Detect and remove form fields
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 rabol  · 28-01-2024 - 05:42

Hi

is there a way to detect and remove form fields / elements in a word document

Ideally I would like to detect the form field and then replace it with the 'value' if filled or with a 'placeholder' if it does not have a value.

Thanks

 

 

Posted by admin  · 28-01-2024 - 08:32

Hello,

Since the release of phpdocx 14.5 (https://www.phpdocx.com/news/post/phpdocx-v14-5-release-notes/232), Indexer (https://www.phpdocx.com/api-documentation/docxutilities/indexer-parse-word-documents-with-PHP) can extract input fields.

getDocxPathQueryInfo can also be used to get elements from a DOCX. On https://www.phpdocx.com/en/forum/default/topic/2282 you can read a post with the same question and how to accomplish this same task.

To remove elements from a DOCX, you can use removeWordContent available in DOCXPath.

Regards.