Commit f5231ade by jinxin

群发记录导出

parent 4062b871
......@@ -95,7 +95,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
<version>3.9</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
......@@ -106,7 +106,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
......
package com.gic.haoban.manage.web.qo;
import lombok.Data;
import java.util.List;
/**
......@@ -9,7 +7,6 @@ import java.util.List;
* @Author: wenhua
* @Date: 2023/9/12 11:19
*/
@Data
public class ExcelSheet {
/*** sheet的名称*/
private String fileName;
......@@ -20,6 +17,30 @@ public class ExcelSheet {
/*** sheet里的数据集*/
private List<String[]> dataset;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String[] getHanders() {
return handers;
}
public void setHanders(String[] handers) {
this.handers = handers;
}
public List<String[]> getDataset() {
return dataset;
}
public void setDataset(List<String[]> dataset) {
this.dataset = dataset;
}
public ExcelSheet(String fileName, String[] handers, List<String[]> dataset) {
this.fileName = fileName;
this.handers = handers;
......
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.utils;
import com.gic.haoban.manage.web.qo.ExcelSheet;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.http.MediaType;
......@@ -25,9 +26,9 @@ public class ExportSheetUtil {
//表头样式
HSSFCellStyle style = wb.createCellStyle();
// 垂直
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setVerticalAlignment(CellStyle.ALIGN_CENTER);
// 水平
style.setAlignment(HorizontalAlignment.CENTER);
style.setAlignment(CellStyle.VERTICAL_CENTER);
//字体样式
HSSFFont fontStyle = wb.createFont();
fontStyle.setFontName("微软雅黑");
......@@ -73,7 +74,6 @@ public class ExportSheetUtil {
response.setHeader("Cache-Control", "No-cache");
response.flushBuffer();
wb.write(response.getOutputStream());
wb.close();
} catch (Exception e) {
e.printStackTrace();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment