

Here is the code how to copy a MS word document using java, with all formatting from one document to other -
FileInputStream in = new FileInputStream("source.docx");
XWPFDocument doc = new XWPFDocument(in);
FileOutputStream fos = new FileOutputStream("destination.docx");
doc.write(fos);

will copy the MS word document from test1.docx to result.docx using Apache POI.
required jars - xml-beans-2.3.0.jar dom-4j-1.5.jar poi-3.8.x.jar s-beans-2.1.jar poi-ooxmll-schemas.jar
FileInputStream in = new FileInputStream("test1.docx");
XWPFDocument doc = new XWPFDocument(in);
FileOutputStream fos = new FileOutputStream("result.docx");
doc.write(fos);
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.