title: How to edit docx using Java
body: <p>I need replace cerain words or phrases in docx-file and save it with another name. I know that my problem is not unik and I tried find solution in the web. But I still can't get a result that I need.</p>
  
  <p>I found two ways to solwe my task but came to the deadlock in each case.
  1. Unfold docx like a zip-file, change xml with main content and pack into archive again. But after that manipulations I can't open new changed docx in MS Word. It is odd because I can do the similar steps by hands (without Java, using WinRar) and get a correct result file.
  So can you explain me how to archive docx content to get a correct file using Java?</p>
  
  <ol start="2">
  <li>Using external API. I get an advice to use docx4j Java library. But all tat I can with it is just replace a label (like ${label}) in template with any words (I used <a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/VariableReplace.java" rel="nofollow">VariableReplace</a> sample). But I want change words that I want without using a template with labels.</li>
  </ol>
  
  <p>I hope for a help.</p>