提交 5b37ec24 编写于 作者: 庄家钜's avatar 庄家钜

优化写入样式代码

上级 aafb3e9a
......@@ -7,6 +7,16 @@ package com.alibaba.excel.constant;
*/
public class OrderConstant {
/**
* The system's own style
*/
public static int DEFAULT_DEFINE_STYLE = -70000;
/**
* Annotation style definition
*/
public static int ANNOTATION_DEFINE_STYLE = -60000;
/**
* Define style.
*/
......@@ -15,10 +25,10 @@ public class OrderConstant {
/**
* default order.
*/
public static final int DEFAULT_ORDER = 0;
public static int DEFAULT_ORDER = 0;
/**
* Sorting of styles written to cells.
*/
public static final int FILL_STYLE = 50000;
public static int FILL_STYLE = 50000;
}
......@@ -9,6 +9,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import com.alibaba.excel.constant.OrderConstant;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ConverterKeyBuild;
import com.alibaba.excel.converters.DefaultConverterLoader;
......@@ -235,6 +236,11 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ
private void dealStyle(List<WriteHandler> handlerList) {
WriteHandler styleStrategy = new AbstractVerticalCellStyleStrategy() {
@Override
public int order() {
return OrderConstant.ANNOTATION_DEFINE_STYLE;
}
@Override
protected WriteCellStyle headCellStyle(Head head) {
return WriteCellStyle.build(head.getHeadStyleProperty(), head.getHeadFontProperty());
......
......@@ -19,7 +19,7 @@ public class DefaultStyle extends HorizontalCellStyleStrategy {
@Override
public int order() {
return OrderConstant.DEFINE_STYLE - 1;
return OrderConstant.DEFAULT_DEFINE_STYLE;
}
public DefaultStyle() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册