Replies: 1   Views: 981
Problem html ckeditor to docx
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 dev-info  · 19-07-2021 - 07:02

I have a problem to retrieve the content of CKEditor (html content and save this data in a docx)

I do first in js: CKEDITOR.instances.editor1.getData () in order to retrieve the html data from CKEditor.
Then, in php, I do:
$docx = new Phpdocx \ Create \ CreateDocx ();

$docx-> embedHTML ($ html);

docx-> createDocx ($ root.'array _ '. $ country_code);

BUT the output is written literally in html, and therefore in the docx is written in html code, without having been interpreted.

How do I save CKEditor data correctly?

Thanks for your help


Posted by admin  · 19-07-2021 - 07:34


It seems you are applying htmlentities ( or a similar function to the HTML content before adding it with embedHTML, so the tags are added instead of being transformed. If you are sending HTML entities you may need to use html_entity_decode ( to get the correct HTML to transform it.

On there's a sample using the output of CKEditor. It seems the problem comes from how your code is sending the HTML content to PHP.

We recommend you to check the HTML content you are adding, the setup of CKEditor and how you are sending the HTML to PHP (using AJAX or any other approach). Please note that this is not a phpdocx problem but how the HTML content to be transformed is being sent to phpdocx.