Java does not have classes that can deal with .doc or .docx files. Some limited access is possible through the Jakarta POI library, but inserting text may already be beyond it.
I understand that .docx is an XML format (albeit an undocumented one, unless you count a 6000 page document as 'documentation'), so Java code could access those through the JAXP API. I doubt that that does you any good unless you have mastered the 6000 pages, though.
Any of the 2007 office components are using XML format, hence the .docx. They have done this so that you can take advantage of a feature that allows you to hover over formatting changes and see what the document will look like without having to actually select the change and then hit undo or choose a different one. You should be able to unzip the .docx file into its different parts, which include the XML for the main content.
You might look at the Apache Jakarta project called POI. It's free and open-source. It allows you to interact with various Microsoft OLE documents such as Word and Excel. I have played with it a little, but not enough to give you any guidance. You can find it at: http://jakarta.apache.org/poi/index.html
Jeff Ash<br /><a href="http://www.excellentiasoftware.com" target="_blank" rel="nofollow">Excellentia Software</a>