deason 6 years ago
parent
commit
9b4bb7d175

+ 2 - 2
examcloud-core-print-common/src/main/java/cn/com/qmth/examcloud/core/print/common/utils/ExcelStyle.java

@@ -60,9 +60,9 @@ public class ExcelStyle extends AbstractExcelExportStyler implements IExcelExpor
         CellStyle titleStyle = this.workbook.createCellStyle();
         CellStyle titleStyle = this.workbook.createCellStyle();
         Font font = this.workbook.createFont();
         Font font = this.workbook.createFont();
         font.setBold(true);
         font.setBold(true);
-        font.setColor(IndexedColors.WHITE.getIndex());
+        font.setColor(IndexedColors.BLACK.getIndex());
         titleStyle.setFont(font);
         titleStyle.setFont(font);
-        titleStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        titleStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
         titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
         titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
         titleStyle.setBorderLeft(BorderStyle.THIN);
         titleStyle.setBorderLeft(BorderStyle.THIN);
         titleStyle.setBorderRight(BorderStyle.THIN);
         titleStyle.setBorderRight(BorderStyle.THIN);

+ 12 - 0
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/ApplicationTest.java

@@ -7,8 +7,14 @@
 
 
 package cn.com.qmth.examcloud.core.print.test;
 package cn.com.qmth.examcloud.core.print.test;
 
 
+import cn.com.qmth.examcloud.core.print.common.utils.ExcelUtils;
+import cn.com.qmth.examcloud.core.print.entity.ObjectiveQuestionStructure;
 import org.junit.Test;
 import org.junit.Test;
 
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
 /**
  * @author: fengdesheng
  * @author: fengdesheng
  * @since: 2018/10/17
  * @since: 2018/10/17
@@ -17,7 +23,13 @@ public class ApplicationTest {
 
 
     @Test
     @Test
     public void demoTest() throws Exception {
     public void demoTest() throws Exception {
+        List<ObjectiveQuestionStructure> objectives = new ArrayList<>();
+        for (int i = 0; i < 10; i++) {
+            objectives.add(new ObjectiveQuestionStructure());
+        }
 
 
+        String objectiveFile = "C:/Users/deason/Desktop/objectives.xlsx";
+        ExcelUtils.exportExcel(ObjectiveQuestionStructure.class, objectives, new File(objectiveFile), "客观题");
     }
     }
 
 
 }
 }