Open an existing docx document

org.docx4j.openpackaging.packages.WordprocessingMLPackage represents a docx document.

To load a document, all you have to do is:

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));

You can then get the main document part (word/document.xml):

MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();

After that, you can manipulate its contents. See this sample for how to do that.