| | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.poi.word.WordUtil; |
| | | import com.aspose.words.Document; |
| | | import com.aspose.words.SaveFormat; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.xwpf.NiceXWPFDocument; |
| | | import com.google.common.collect.Maps; |
| | |
| | | } |
| | | |
| | | public static File toDocx(File file) { |
| | | if (!AsposeUtil.getLicense(2)) { |
| | | return file; |
| | | } |
| | | String docxName = UUID.randomUUID().toString() + ".docx"; |
| | | File docxFile = new File(file.getParent() + File.separator + docxName); |
| | | String tempDir = Global.getSystemConfig("temp.dir", "./attachment/temp"); |
| | |
| | | return docxFile; |
| | | } |
| | | |
| | | public static File toDoc(File file) { |
| | | if (!AsposeUtil.getLicense(2)) { |
| | | return file; |
| | | } |
| | | String docxName = UUID.randomUUID().toString() + ".doc"; |
| | | File docxFile = new File(file.getParent() + File.separator + docxName); |
| | | String tempDir = Global.getSystemConfig("temp.dir", "./attachment/temp"); |
| | | File tempFile = new File(tempDir + File.separator + docxName); |
| | | try { |
| | | Document document = new Document(new FileInputStream(file)); |
| | | document.save(tempFile.getAbsolutePath(), SaveFormat.DOC); |
| | | return tempFile; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return docxFile; |
| | | } |
| | | |
| | | /** |
| | | * 批量打包 |
| | | * |