杜洪波
2026-03-13 df91d64c7ed78205084828ff5bf018d876970b46
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);