许鹏程
2024-09-30 f1579ea6e661af4ed4fb4d4a1dbbe4f5bc75c284
src/main/java/com/product/file/util/MergeWordDocuments.java
@@ -30,8 +30,17 @@
            }
         }
         String fileType=".docx";
         FileFormat saveType = FileFormat.Docx;
         //判断来源文件是否为wps
         if (source.getName().endsWith(".wps")) {
            saveType = FileFormat.WPS;
            fileType=".wps";
         }
//         doc.insertTextFromStream(targetIn, com.spire.doc.FileFormat.Docx);
         String tempFile = Global.getSystemConfig("temp.dir", "./attachment/temp") + File.separator + UUID.randomUUID() + ".docx";
         String tempFile = Global.getSystemConfig("temp.dir", "./attachment/temp") + File.separator + UUID.randomUUID() + fileType;
         try (FileOutputStream out = new FileOutputStream(tempFile)) {
            sourceDoc.saveToStream(out, FileFormat.Docx);
            return new File(tempFile);