Browse Source

#施工日志word文档导出

zhongwei
yang_shj 11 months ago
parent
commit
495a8f23d7
  1. 23
      hzims-service/operational/pom.xml
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/ConstructionServiceImpl.java

23
hzims-service/operational/pom.xml

@ -18,6 +18,23 @@
</properties>
<dependencies>
<!--转pdf-->
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-local</artifactId>
<version>${documents4j.version}</version>
</dependency>
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-transformer-msoffice-word</artifactId>
<version>${documents4j.version}</version>
</dependency>
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-UTIL-ALL</artifactId>
<version>${documents4j.version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
@ -232,6 +249,12 @@
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger-bootstrap-ui.version}</version>
</dependency>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls.free</artifactId>
<version>3.9.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/ConstructionServiceImpl.java

@ -88,11 +88,11 @@ public class ConstructionServiceImpl extends BaseServiceImpl<ConstructionMapper,
throw new ServiceException("文件创建失败!");
}
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
response.setContentType("application/vnd.ms-word");
ServletOutputStream outputStream;
try {
//设置docx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".docx", "UTF-8"));
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
//创建一个输出流
outputStream = response.getOutputStream();
//写入数据

Loading…
Cancel
Save