Docx4JWordTemplate { public void writeAsOpenXML(OutputStream out) throws IOException { try { SaveToZipFile saveToZipFile = new SaveToZipFile(wordMLPackage); saveToZipFile.save(out); } catch (Docx4JException e) { unwrapIOException(e); throw new WteException("Can not marshall document", e); } } Docx4JWordTemplate();  Docx4JWordTemplate(InputStream in); PlainTextContent addPlainTextContent(); List<PlainTextContent> getPlainTextContent(); void writeAsOPCXml(OutputStream out); void writeAsOpenXML(OutputStream out); void writeAsPDF(OutputStream out);  }
@Test public void writeAsOpenXMLTest() throws IOException, Docx4JException, JAXBException { Docx4JWordTemplate doc = new Docx4JWordTemplate(); File file = File.createTempFile("test", "docx"); OutputStream out = FileUtils.openOutputStream(file); try { doc.writeAsOpenXML(out); } finally { IOUtils.closeQuietly(out); } ZipFile zipFile = new ZipFile(file); ZipEntry entry = zipFile.getEntry("word/document.xml"); assertNotNull(entry); }