FlatOpcXmlCreator foxc = new FlatOpcXmlCreator(docxTemplate);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
foxc.marshal(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
FlatOpcXmlImporter foxi = new FlatOpcXmlImporter(bais);
docxTemplate = (WordprocessingMLPackage) foxi.get();
} catch (Docx4JException e) {
throw new MergeException("unable to defensive copy (problem exporting)", e);
} catch (@SuppressWarnings("restriction") JAXBException e) {
throw new MergeException("unable to defensive copy (problem importing)", e);
}