How to convert xml to docx?

Hi everyone,

i am working on an application with meteor. I need to replace specific words (get them from mongoDB) in docx document, I found a way to convert docx files into xml. The question is, how to restore xml to docx document after replacing those words ?

Thank you in advance.

A docx file is just a zip file, if you open the zip, look in the folder ‘word’ there will be an xml file called document.xml.
I’ve never done what you’re trying to do, but I have had to go fish some info out before thats why I know. You could try just modifying that xml file rather than convert the docx back and forward.

edit, not sure what happened to the rest of my post. Updated now.

Thank you @cstrat for your answer

in fact i just found a solution and it works,

after extracting the zip file,you edit the xml file you want (document.xml, footer2.xml,…) and then you replace the edited files in the zip file, then you change the extention from .zip to .docx and here you are.
but, there’s a problem, you can’t do the same with images, even though i change the path of the image i can’t find it in the word document