Using:
XWPFDocument document = new XWPFDocument();
How do I assign it so it doesn't overwrite the file if it already exists?
Using:
XWPFDocument document = new XWPFDocument();
How do I assign it so it doesn't overwrite the file if it already exists?
The following will create a brand new, empty XWPF Word Document to work with:
XWPFDocument document = new XWPFDocument();
Whereas this will open up an existing one for editing:
XWPFDocument document = new XWPFDocument(OPCPackage.open("MyFile.docx"));
Or if you have an InputStream
rather than a file:
XWPFDocument document = new XWPFDocument(inputStream);