Forum


Replies: 7   Views: 2762
Embedhtml issue
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  · 07-07-2017 - 09:46

Hello,

We recommend you to remove them before transforming HTML to DOCX.

This is using a regex such as;

$html = preg_replace('/<\\/?p(.|\\s)*?>/', '', $html);

or str_replace:

$tags = array('<p>', '</p>');
$html = str_replace($tags, '', $html);

You need to change these codes if there're other paragraphs you need to keep or lists are not added standalone but with more HTML.

You can also use DOCXPath to move contents after transforming the HTML, but the easiest solution is cleaning the HTML before being added.

Regards.