title: How to de-fragment docx files for using with Apache POI 3.8?
body: <p>I'm trying to find &amp; replace text passages in docx files with POI 3.8 like described <a href="http://mail-archives.apache.org/mod_mbox/poi-user/201012.mbox/%3C1291298981596-3289423.post@n5.nabble.com%3E" rel="nofollow">here</a>.</p>
  
  <p>That works just fine if I insert my tags on the first run. But as soon as I re-open the docx file and do some modifications, Word actually does fragment across runs of text. So for example, "hello world" might be:</p>
  
  <p><code>&lt;w:r&gt;&lt;w:t&gt;Hello wo&lt;/w:t&gt;&lt;/w:r&gt;&lt;w:r w:rsidR="00FB0672"&gt;&lt;w:t&gt;rld&lt;/w:t&gt;&lt;/w:r&gt;</code></p>
  
  <p>Such fragmentation will be due to things like change tracking, formatting, and spell checking I think.</p>
  
  <p>Does anybody have an idea how to ...</p>
  
  <p>a) ... disable this feature in MS Word?</p>
  
  <p>b) ... somehow de-fragment the docx file afterwards?</p>
  
  <p>c) ... any other solution to get rid of this fragmentation?</p>
  
  <p>I already tried to save the file as .doc/.odt and re-save the file to .docx. But these fragmentations still persist...</p>
  
  <p>Any help highly appreciated — thanks in advance for your help!</p>