【已解决】docx4j 结合Thymeleaf 的各种依赖问题(坑)

最近来个需求,复杂的word样式。这边采用的是docx4j 结合Thymeleaf。寻求chatGPT快速使用引发了一些问题。
版本缺少,XHTMLImporterImpl缺失

在这里插入图片描述

版本依赖找不到

在这里插入图片描述

org.docx4j:docx4j:jar:8.1.5 was not found in http://mirrors.cloud.tencent.com/nexus/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of tencent-cloud has elapsed or updates are forced

解决方法

在mvnrepository 中搜索版本信息,一般各大源的版本都同步的,发现最高只到6.1x
在这里插入图片描述

还在仓库中发现,库迁移,那这边直接引入
Relocated → org.docx4j » docx4j-core
在这里插入图片描述

XHTMLImporterImpl 缺少,这边已经引用了 docx4j或者docx4j-cored的最新版本依旧缺少

在这里插入图片描述

依旧搜索GPT,答案一致,依旧网上冲浪
在这里插入图片描述

解决方法

偶然才中央仓库中看到这个依赖
在这里插入图片描述

<dependency>
   <groupId>org.docx4j</groupId>
   <artifactId>docx4j-ImportXHTML</artifactId>
   <version>11.4.8</version>
</dependency>

成功导入
在这里插入图片描述

如果发生类文件错误,请降低版本

docx4j-ImportXHTML 11.4.8采用jdk11的,引用的是jd8的
在这里插入图片描述
在这里插入图片描述

解决方案

<dependency>
   <groupId>org.docx4j</groupId>
   <artifactId>docx4j-ImportXHTML</artifactId>
   <version>8.3.11</version>
</dependency>

xhtmlrender相关环境缺失

导出的时候如果发生xhtmlrender缺失,请加入以下依赖
在这里插入图片描述

<dependency>
   <groupId>org.docx4j</groupId
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值