您的位置:首页 > 财经 > 产业 > java:word文件替换字段,word转pdf

java:word文件替换字段,word转pdf

2024/10/7 0:26:15 来源:https://blog.csdn.net/w1234567465/article/details/142355474  浏览:    关键词:java:word文件替换字段,word转pdf

一、提取字段:

依赖

     <dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.17</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>3.17</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml-schemas</artifactId><version>3.17</version></dependency>

代码


//modelMapValue:例如"${编码}":"6666"
//inputStream:输入的文件流
public InputStream wordReplaceModel(Map<String, String> modelMapValue, InputStream inputStream) {if (modelMapValue == null || modelMapValue.isEmpty()) {throw new BusinessException("500", "模板值参数不能为空");}try (XWPFDocument xwpfDocument = new XWPFDocument(inputStream);ByteArrayOutputStream outputStream = new 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com