|
@@ -10,8 +10,8 @@ package cn.com.qmth.examcloud.core.print.common.utils;
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
+import cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerBorderImpl;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
-import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -35,15 +35,17 @@ public class ExcelUtils {
|
|
|
|
|
|
public static <T> void toExcelFile(Class<T> clazz, List<T> list, File excelFile, String title) {
|
|
public static <T> void toExcelFile(Class<T> clazz, List<T> list, File excelFile, String title) {
|
|
if (excelFile == null) {
|
|
if (excelFile == null) {
|
|
- log.warn("excelFile must be not null.");
|
|
|
|
|
|
+ log.warn("[Param] excelFile is null.");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
ExportParams params = new ExportParams();
|
|
ExportParams params = new ExportParams();
|
|
params.setType(ExcelType.XSSF);
|
|
params.setType(ExcelType.XSSF);
|
|
- //params.setColor(IndexedColors.AQUA.getIndex());
|
|
|
|
|
|
+ params.setStyle(ExcelExportStylerBorderImpl.class);
|
|
|
|
+
|
|
if (StringUtils.isNotBlank(title)) {
|
|
if (StringUtils.isNotBlank(title)) {
|
|
params.setTitle(title);
|
|
params.setTitle(title);
|
|
|
|
+ params.setSheetName(title);
|
|
}
|
|
}
|
|
|
|
|
|
try (FileOutputStream fos = new FileOutputStream(excelFile);
|
|
try (FileOutputStream fos = new FileOutputStream(excelFile);
|