My question is very specific and I hope that someone has done this conversion from HTMLto DOCX.
To do this I took a sample code from github and tried it in my local Ecli
I had the same problem, Replace your xhtmlrenderer-1.0.0 jar file with version 3.0.0 . This is Maven Repository link
This is not the complete example, is it? Just take a look at ConvertInXHTMLFile.java from docx4j examples.
IMHO you are missing basic parts of the procedure. Furthermore, this topic has been discussed already:
Convert html to doc in java
How to convert HTML to a Microsoft Word document ?
Convert HTML to Microsoft Word Document in Java
how to convert HTML to .docx using docx4j?
check code here. Api used is docx4j-ImportXHTML. Code is simple to follow. Just pass on your xhtml to api as in code and it will do the needful.