文档生成合并 11.23

master
zhc077 16 hours ago
parent 603e4c7f06
commit 2250cb1137
  1. 4
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProject4WordService.java
  2. 3
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/Project4WordServiceImpl.java
  3. BIN
      jeecg-boot/jeecg-module-demo/src/main/resources/static/word/baseInfoModel.docx
  4. BIN
      jeecg-boot/jeecg-module-demo/src/main/resources/static/word/shenqingshu.docx
  5. BIN
      jeecg-boot/jeecg-module-demo/src/main/resources/static/word/yiJianModel.docx
  6. 16
      jeecg-boot/jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/word/WordExportUtil_test.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.entity.Project;
import org.jeecg.modules.demo.project.service.impl.Project4WordServiceImpl; import org.jeecg.modules.demo.project.service.impl.Project4WordServiceImpl;
import java.io.File;
/** /**
* @Description: 项目表 * @Description: 项目表
* @Author: jeecg-boot * @Author: jeecg-boot
@ -26,4 +28,6 @@ public interface IProject4WordService extends IService<Project> {
* @date: 24/11/21 10:22 * @date: 24/11/21 10:22
*/ */
Object createXiangMuShu4Word(Project project); Object createXiangMuShu4Word(Project project);
Object createPdf(String wordPath, File file, String padFileName);
} }

@ -329,6 +329,7 @@ public class Project4WordServiceImpl extends ServiceImpl<ProjectMapper, Project>
return dto; return dto;
} }
@Override
public Object createPdf(String wordPath, File file, String padFileName) { public Object createPdf(String wordPath, File file, String padFileName) {
if (wordPath.equals("")) { if (wordPath.equals("")) {
log.error("---------------word文件路径不能为空!"); log.error("---------------word文件路径不能为空!");
@ -338,7 +339,7 @@ public class Project4WordServiceImpl extends ServiceImpl<ProjectMapper, Project>
FileUtils.convertDocx2Pdf(wordPath, file + File.separator + padFileName); FileUtils.convertDocx2Pdf(wordPath, file + File.separator + padFileName);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("------------work转pdf异常:" + e.getMessage()); log.error("------------work转pdf,异常:" + e.getMessage());
} }
} }
return null; return null;

@ -1,6 +1,5 @@
package org.jeecg.modules.word; package org.jeecg.modules.word;
import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.word.WordExportUtil; import cn.afterturn.easypoi.word.WordExportUtil;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -87,12 +86,19 @@ public class WordExportUtil_test {
@Test @Test
public void test3() { public void test3() {
String wordPath = "C:\\Users\\YX\\Documents\\00.docx"; String wordPath = "C:\\Users\\YX\\Documents\\2025黄淮学院工程技术研究中心1121.docx";
String padPath = "C:\\Users\\YX\\Documents\\00.pdf"; 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 { try {
FileUtils.convertDocxToPdf(wordPath, padPath); // FileUtils.convertDocxToPdf(wordPath, padPath);
FileUtils.convertDocx2Pdf(wordPath, padPath);
FileUtils.convertDocx2Pdf(wordPath2, padPath2);
// FileUtils.convertDocx2Pdf(wordPath, padPath2);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

Loading…
Cancel
Save