Forum


Replies: 4   Views: 1497
No linebreak after <p> tag using replacevariablebyhtml
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  · 09-12-2020 - 14:20

Hello,

There's no known bug in phpdocx. That restriction was added some years ago to avoid generating corrupted DOCX when adding block contents inside other block contents. There's no option in the current release (and previous versions but very old ones that miss styles and may return corrupted documents) to do an inline replacement keeping block contents and styles.

If you want to use the same behaviour than the old phpdocx 4 you can edit CreateDocxFromTemplate.php, go to replaceVariableByHTML method and comment the following line:

$options['type'] = $type;

Commenting the previous line you'll get the same output than phpdocx 4 when doing inline replacements with HTML, but please note that corrupted DOCX and styles missing may happen so we don't recommended that change. A future release of phpdocx will allow adding block tags when doing inline replacements, but it's a work in progress.

Regards.