| | |
| | | } |
| | | |
| | | } |
| | | 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); |