|
@@ -14,14 +14,13 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class ToolExcel {
|
|
|
- private final List<Integer> widthIndex = new ArrayList<>();
|
|
|
- private final BigExcelWriter writer = cn.hutool.poi.excel.ExcelUtil.getBigWriter();
|
|
|
- private String format = "yyyy-mm-dd hh:mm:ss";
|
|
|
-
|
|
|
public ToolExcel() {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ private final List<Integer> widthIndex = new ArrayList<>();
|
|
|
+ private final BigExcelWriter writer = cn.hutool.poi.excel.ExcelUtil.getBigWriter();
|
|
|
+ private String FORMAT = "yyyy-mm-dd hh:mm:ss";
|
|
|
+
|
|
|
public ToolExcel addTitle(String name, String alias, int width) {
|
|
|
writer.addHeaderAlias(name, alias);
|
|
|
widthIndex.add(width);
|
|
@@ -35,13 +34,13 @@ public class ToolExcel {
|
|
|
}
|
|
|
|
|
|
public ToolExcel setDataFormat(String format) {
|
|
|
- this.format = format;
|
|
|
+ FORMAT = format;
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
private void setCellDateFormat() {
|
|
|
DataFormat dataFormat = writer.getWorkbook().createDataFormat();
|
|
|
- short format = dataFormat.getFormat(this.format);
|
|
|
+ short format = dataFormat.getFormat(FORMAT);
|
|
|
StyleSet styleSet = writer.getStyleSet();
|
|
|
styleSet.getCellStyleForDate()
|
|
|
.setDataFormat(format);
|