diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProject4WordService.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProject4WordService.java index f8e7655..9f59874 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProject4WordService.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProject4WordService.java @@ -5,6 +5,8 @@ import org.jeecg.modules.demo.project.dto.ProjectShenBaoDto; import org.jeecg.modules.demo.project.entity.Project; import org.jeecg.modules.demo.project.service.impl.Project4WordServiceImpl; +import java.io.File; + /** * @Description: 项目表 * @Author: jeecg-boot @@ -26,4 +28,6 @@ public interface IProject4WordService extends IService { * @date: 24/11/21 10:22 */ Object createXiangMuShu4Word(Project project); + + Object createPdf(String wordPath, File file, String padFileName); } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/Project4WordServiceImpl.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/Project4WordServiceImpl.java index 2b9491a..c516eac 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/Project4WordServiceImpl.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/Project4WordServiceImpl.java @@ -329,6 +329,7 @@ public class Project4WordServiceImpl extends ServiceImpl return dto; } + @Override public Object createPdf(String wordPath, File file, String padFileName) { if (wordPath.equals("")) { log.error("---------------word文件路径不能为空!"); @@ -338,7 +339,7 @@ public class Project4WordServiceImpl extends ServiceImpl FileUtils.convertDocx2Pdf(wordPath, file + File.separator + padFileName); } catch (Exception e) { e.printStackTrace(); - log.error("------------work转pdf,异常:" + e.getMessage()); + log.error("------------work转pdf,异常:" + e.getMessage()); } } return null; diff --git a/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/baseInfoModel.docx b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/baseInfoModel.docx new file mode 100644 index 0000000..db7a491 Binary files /dev/null and b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/baseInfoModel.docx differ diff --git a/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/shenqingshu.docx b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/shenqingshu.docx new file mode 100644 index 0000000..f162247 Binary files /dev/null and b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/shenqingshu.docx differ diff --git a/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/yiJianModel.docx b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/yiJianModel.docx new file mode 100644 index 0000000..e380777 Binary files /dev/null and b/jeecg-boot/jeecg-module-demo/src/main/resources/static/word/yiJianModel.docx differ diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.java b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.java index 5d42f2f..44b5335 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.java @@ -1,6 +1,5 @@ package org.jeecg.modules.word; -import cn.afterturn.easypoi.entity.ImageEntity; import cn.afterturn.easypoi.word.WordExportUtil; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; @@ -87,12 +86,19 @@ public class WordExportUtil_test { @Test public void test3() { - String wordPath = "C:\\Users\\YX\\Documents\\00.docx"; - String padPath = "C:\\Users\\YX\\Documents\\00.pdf"; + String wordPath = "C:\\Users\\YX\\Documents\\2025黄淮学院工程技术研究中心1121.docx"; + String wordPath2 = "C:\\Users\\YX\\Documents\\copy1121.docx"; +// String wordPath2 = "D:\\model4word\\pdf\\2025黄淮学院工程技术研究中心1121.docx"; +// String wordPath2 = "C:\\Users\\YX\\Documents\\00.docx"; + String padPath = "C:\\Users\\YX\\Documents\\1_1.pdf"; + String padPath2 = "C:\\Users\\YX\\Documents\\1_2.pdf"; +// String padPath2 = "C:\\Users\\YX\\Documents\\00.pdf"; -// FileUtils.convertDocx2Pdf(wordPath, file + File.separator + padFileName); try { - FileUtils.convertDocxToPdf(wordPath, padPath); +// FileUtils.convertDocxToPdf(wordPath, padPath); + FileUtils.convertDocx2Pdf(wordPath, padPath); + FileUtils.convertDocx2Pdf(wordPath2, padPath2); +// FileUtils.convertDocx2Pdf(wordPath, padPath2); } catch (Exception e) { e.printStackTrace(); }