文档生成合并 11.22

master
zhc077 18 hours ago
parent 9e42d8ba45
commit c4cf0217d9
  1. 10
      jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.java

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

Loading…
Cancel
Save