导出excel

Raod 3 years ago
parent 8941a4e9f4
commit 053807da69

@ -0,0 +1,73 @@
package com.anjiplus.template.gaea.business.enums;
/**
* @author zhouhang
* @description EXCEL
* @date 2021/4/26
*/
public enum ExcelCenterStyleEnum {
/**
*
*/
LEFT((short) 1, 1, "左对齐"),
/**
*
*/
RIGHT((short) 3, 2, "右对齐"),
/**
*
*/
CENTER((short) 2, 0, "居中"),
;
/**
* excelcode
*/
private final short excelCode;
/**
* 线code
*/
private final Integer onlineExcelCode;
/**
*
*/
private final String name;
public Integer getOnlineExcelCode() {
return onlineExcelCode;
}
public String getName() {
return name;
}
public short getExcelCode() {
return excelCode;
}
ExcelCenterStyleEnum(short excelCode, Integer onlineExcelCode, String name) {
this.excelCode = excelCode;
this.onlineExcelCode = onlineExcelCode;
this.name = name;
}
/**
* @param code excelcode
* @return Enum_ExcelCenterStyle
* @description excel线
* @author zhouhang
* @date 2021/4/26
*/
public static ExcelCenterStyleEnum getExcelCenterStyleByExcelCenterCode(short code) {
for (ExcelCenterStyleEnum value : ExcelCenterStyleEnum.values()) {
if (code == value.getExcelCode()) {
return value;
}
}
return CENTER;
}
}

@ -8,6 +8,7 @@ import java.util.List;
/**
*
*
* @author Administrator
*/
@Data

@ -13,31 +13,49 @@ import java.io.Serializable;
*/
@Data
public class ReportExcelDto extends GaeaBaseDTO implements Serializable {
/** 报表名称 */
/**
*
*/
private String reportName;
/** 报表编码 */
/**
*
*/
private String reportCode;
/**数据集编码,以|分割*/
/**
* |
*/
private String setCodes;
/** 分组 */
/**
*
*/
private String reportGroup;
/** 数据集查询参数 */
/**
*
*/
private String setParam;
/** 报表json字符串 */
/**
* json
*/
private String jsonStr;
/** 报表类型 */
/**
*
*/
private String reportType;
/** 数据总计 */
/**
*
*/
private long total;
/**导出类型*/
/**
*
*/
private String exportType;
}

@ -18,7 +18,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**

@ -1,7 +1,6 @@
package com.anjiplus.template.gaea.business.modules.reportexcel.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFPalette;
@ -15,6 +14,7 @@ import org.apache.poi.xssf.usermodel.XSSFColor;
/**
* https://github.com/mengshukeji/LuckysheetServer
*
* @author Administrator
*/
@Slf4j

@ -365,49 +365,34 @@ public class XlsSheetUtil {
}
if ("border-inside".equals(borderType)) {
//所有内边框
if (row_ >= rowList.getInteger(0) && row_ < rowList.getInteger(rowList.size() - 1)) {
style.setBorderRight(BorderStyle.valueOf(style_)); //右边框
style.setRightBorderColor(color);//右边框颜色
style.setBorderBottom(BorderStyle.valueOf(style_)); //底部边框
style.setBottomBorderColor(color);//底部边框颜色 }
}
if (col_ >= columnList.getInteger(0) && col_ < columnList.getInteger(columnList.size() - 1)) {
style.setBorderRight(BorderStyle.valueOf(style_)); //右边框
style.setRightBorderColor(color);//右边框颜色
style.setBorderBottom(BorderStyle.valueOf(style_)); //底部边框
style.setBottomBorderColor(color);//底部边框颜色 }
}
}
if ("border-horizontal".equals(borderType)) {
if ("border-horizontal".equals(borderType) || "border-inside".equals(borderType)) {
//内部横线
if (row_ >= rowList.getInteger(0) && row_ < rowList.getInteger(rowList.size() - 1)) {
style.setBorderBottom(BorderStyle.valueOf(style_)); //底部边框
style.setBottomBorderColor(color);//底部边框颜色 }
}
if (col_ >= columnList.getInteger(0) && col_ < columnList.getInteger(columnList.size() - 1)) {
if (row_ >= rowList.getInteger(0)
&& row_ < rowList.getInteger(rowList.size() - 1)
&& col_ >= columnList.getInteger(0)
&& col_ <= columnList.getInteger(columnList.size() - 1)) {
style.setBorderBottom(BorderStyle.valueOf(style_)); //底部边框
style.setBottomBorderColor(color);//底部边框颜色 }
}
}
if ("border-vertical".equals(borderType)) {
if ("border-vertical".equals(borderType) || "border-inside".equals(borderType)) {
//内部竖线
if (row_ >= rowList.getInteger(0) && row_ < rowList.getInteger(rowList.size() - 1)) {
style.setBorderRight(BorderStyle.valueOf(style_)); //右边框
style.setRightBorderColor(color);//右边框颜色
}
if (col_ >= columnList.getInteger(0) && col_ < columnList.getInteger(columnList.size() - 1)) {
if (row_ >= rowList.getInteger(0)
&& row_ <= rowList.getInteger(rowList.size() - 1)
&& col_ >= columnList.getInteger(0)
&& col_ < columnList.getInteger(columnList.size() - 1)) {
style.setBorderRight(BorderStyle.valueOf(style_)); //右边框
style.setRightBorderColor(color);//右边框颜色
}
}
if ("border-none".equals(borderType)) {
style.setBorderLeft(BorderStyle.NONE); //左边框
style.setBorderRight(BorderStyle.NONE); //左边框
style.setBorderTop(BorderStyle.NONE); //左边框
style.setBorderBottom(BorderStyle.NONE); //左边框
}
}
}

Loading…
Cancel
Save