1

We are trying to create a word document with phpWord. The word file contains html and we are saving the html with tinyeditor (tinyMCE) to db. From an api call, it returns html that is from tinyMCE and we are trying to add it into our phpword file.

We first tested it out with simple html such as p, h1, div. Just simple html and trying to use addHTML() method to add the html elements into docx file but when we try to add tinyMCE content (which happens to be html as well) with addHTML() method, it shows error saying that there are unreadable content inside the file.

We tried echoing out the html content from tinyMCE and it is working. From inspect, we found that there are a lot of classes and lang attribute from span tag. That could potentially be the reason why it is not working but let us know.

Is there any solution that could eliminate this issue so that we can add the html from tinyMCE?

2
  • Remove parts of the HTML until you know what is causing the issue? Commented Oct 31, 2023 at 16:29
  • It was the custom attribute from tinyMCE that is causing the phpWord error to pop up. We are trying to see if we can remove the custom attribute but so far, no luck. Commented Nov 1, 2023 at 4:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.