Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class OutDoc
- {
- OutDoc() throws FileNotFoundException, IOException, InvalidFormatException
- {
- File fil1=new File(FileSelect.patchin);
- File fil2=new File("C:\\Users\\Капитошка\\Desktop\\nullfile.docx");
- Files.copy(fil1.toPath(), fil2.toPath());
- try{
- FileInputStream strr=new FileInputStream(FileSelect.patchin);
- final XWPFDocument doc = new XWPFDocument(strr);
- XWPFParagraph p1 = doc.createParagraph();
- XWPFRun r1 = p1.createRun();
- textField.getField();
- r1.setText(textField.finaltxt);
- final FileOutputStream out = new FileOutputStream(FileSelect.patchin);
- doc.write(out);
- out.close();}
- catch(Exception e)
- {
- FileInputStream strr=new FileInputStream(FileSelect.patchin);
- final HWPFDocument doc = new HWPFDocument(strr);
- Range range = doc.getRange();
- textField.getField();
- range.insertAfter(textField.finaltxt);
- final FileOutputStream out = new FileOutputStream(FileSelect.patchin);
- doc.write(out);
- out.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement