|
|
|
@ -100,23 +100,23 @@ public class WordExportUtil_test { |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void test4() { |
|
|
|
|
File newFile = new File("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\合并1122v4.docx"); |
|
|
|
|
/*File newFile = new File("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\合并1122v4.docx"); |
|
|
|
|
List<File> srcfile = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
File file1 = new File("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\正文V14.docx"); |
|
|
|
|
File file2 = new File("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\正文V15.docx"); |
|
|
|
|
// File file3 = new File("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\yiJianModel.doc");
|
|
|
|
|
srcfile.add(file1); |
|
|
|
|
srcfile.add(file2); |
|
|
|
|
srcfile.add(file2);*/ |
|
|
|
|
|
|
|
|
|
List<XWPFDocument> wordList = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
|
FileInputStream fis = new FileInputStream("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\正文V14.docx"); |
|
|
|
|
FileInputStream fis = new FileInputStream("D:\\正文V14.docx"); |
|
|
|
|
wordList.add(new XWPFDocument(fis)); |
|
|
|
|
FileInputStream fis2 = new FileInputStream("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\正文V15.docx"); |
|
|
|
|
FileInputStream fis2 = new FileInputStream("D\\正文V15.docx"); |
|
|
|
|
wordList.add(new XWPFDocument(fis2)); |
|
|
|
|
XWPFDocument mergeWordObj = WordUtils.mergeWord(wordList); |
|
|
|
|
FileOutputStream fos = new FileOutputStream("C:\\Users\\YX\\Desktop\\testword\\xiangmushu\\合并1122v4.docx"); |
|
|
|
|
FileOutputStream fos = new FileOutputStream("D:\\合并1122v4.docx"); |
|
|
|
|
mergeWordObj.write(fos); |
|
|
|
|
fos.close(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|