Forum


Replies: 1   Views: 1988
Block used within a paragraph will work but deletes the paragraph where the tag exists.
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 admin  · 17-10-2019 - 10:10

Hello,

The replace methods allow doing an inline replacement (keep the content of the paragraph but only inline elements are added) or a block replacement (remove the content of the paragraph keeping all new contents), but they don't allow mixing both.

Using DOCXPath (https://www.phpdocx.com/documentation/introduction/docxpath) and WordFragments you can replace an inline placeholder keeping all new contents (block and inline elements), but this task may require closing the previous block tag (w:p) and opening a new one (before and after the previous placeholder) to avoid generating corrupted documents.

As this may be a complex task, if you open a support ticket (https://www.phpdocx.com/support) and attach the template you are using, the dev team will generate a custom script.

Regards.