|
|
@ -2,11 +2,20 @@ package com.alibaba.excel.write.metadata.fill; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.enums.WriteDirectionEnum; |
|
|
|
import com.alibaba.excel.enums.WriteDirectionEnum; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
import lombok.Builder; |
|
|
|
|
|
|
|
import lombok.Data; |
|
|
|
|
|
|
|
import lombok.NoArgsConstructor; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Fill config |
|
|
|
* Fill config |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Jiaju Zhuang |
|
|
|
* @author Jiaju Zhuang |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
|
|
|
|
@Data |
|
|
|
|
|
|
|
@Builder |
|
|
|
|
|
|
|
@NoArgsConstructor |
|
|
|
|
|
|
|
@AllArgsConstructor |
|
|
|
public class FillConfig { |
|
|
|
public class FillConfig { |
|
|
|
private WriteDirectionEnum direction; |
|
|
|
private WriteDirectionEnum direction; |
|
|
|
/** |
|
|
|
/** |
|
|
@ -16,23 +25,15 @@ public class FillConfig { |
|
|
|
* say the whole file will be stored in memory. |
|
|
|
* say the whole file will be stored in memory. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Boolean forceNewRow; |
|
|
|
private Boolean forceNewRow; |
|
|
|
private boolean hasInit; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WriteDirectionEnum getDirection() { |
|
|
|
|
|
|
|
return direction; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setDirection(WriteDirectionEnum direction) { |
|
|
|
/** |
|
|
|
this.direction = direction; |
|
|
|
* Automatically inherit style |
|
|
|
} |
|
|
|
* |
|
|
|
|
|
|
|
* default true. |
|
|
|
public Boolean getForceNewRow() { |
|
|
|
*/ |
|
|
|
return forceNewRow; |
|
|
|
private Boolean autoStyle; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setForceNewRow(Boolean forceNewRow) { |
|
|
|
private boolean hasInit; |
|
|
|
this.forceNewRow = forceNewRow; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void init() { |
|
|
|
public void init() { |
|
|
|
if (hasInit) { |
|
|
|
if (hasInit) { |
|
|
@ -44,40 +45,9 @@ public class FillConfig { |
|
|
|
if (forceNewRow == null) { |
|
|
|
if (forceNewRow == null) { |
|
|
|
forceNewRow = Boolean.FALSE; |
|
|
|
forceNewRow = Boolean.FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
hasInit = true; |
|
|
|
if (autoStyle == null) { |
|
|
|
} |
|
|
|
autoStyle = Boolean.TRUE; |
|
|
|
|
|
|
|
|
|
|
|
public static FillConfigBuilder builder() { |
|
|
|
|
|
|
|
return new FillConfigBuilder(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
hasInit = true; |
|
|
|
public static class FillConfigBuilder { |
|
|
|
|
|
|
|
private FillConfig fillConfig; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FillConfigBuilder() { |
|
|
|
|
|
|
|
this.fillConfig = new FillConfig(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FillConfigBuilder direction(WriteDirectionEnum direction) { |
|
|
|
|
|
|
|
fillConfig.setDirection(direction); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FillConfigBuilder forceNewRow(Boolean forceNewRow) { |
|
|
|
|
|
|
|
fillConfig.setForceNewRow(forceNewRow); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FillConfig build() { |
|
|
|
|
|
|
|
return build(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FillConfig build(boolean autoInit) { |
|
|
|
|
|
|
|
if (autoInit) { |
|
|
|
|
|
|
|
fillConfig.init(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return fillConfig; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|