diff --git a/platform-common/pom.xml b/platform-common/pom.xml
index f69b730..2f88a4b 100644
--- a/platform-common/pom.xml
+++ b/platform-common/pom.xml
@@ -39,7 +39,12 @@
commons-lang3
3.4
-
+
+ org.apache.poi
+ poi-ooxml-schemas
+ 3.15
+
+
diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
index 4ae4d39..f09cb1a 100644
--- a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
+++ b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
@@ -114,7 +114,62 @@ public class ExcelUtil {
WritableWorkbook wwb;
try {
wwb = Workbook.createWorkbook(out);
+
+ WritableSheet ws = wwb.createSheet("sheet", 0); // 创建一个工作表
+
+ /**
+ * 设置单元格样式
+ */
+ WritableFont wf = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
+ WritableCellFormat wcf = new WritableCellFormat(wf);
+ ws.setRowView(0, 300); // 设置指定行高
+ // 设置列宽
+ for (int j = 0, columLen = columName.size(); j < columLen; j++) {
+ ws.setColumnView(j, 15);
+ }
+ // 填充数据的内容
+ Map map;
+ for (int i = 0, len = data.size(); i < len; i++) {
+ map = data.get(i);
+ Iterator ite = columName.keySet().iterator();
+ int j = 0;
+ String keyORvalue = "";
+ String keyName = "";
+ while (ite.hasNext()) {
+ keyName = ite.next();
+ if (i > 0) { // 类容数据
+ keyORvalue = map.get(keyName) == null ? "" : map.get(keyName).toString();
+ } else { // 第一行列名
+ keyORvalue = map.get(keyName) == null ? "" : map.get(keyName).toString();
+ keyName = columName.get(keyName);
+ ws.addCell(new Label(j, 0, keyName, wcf));
+ }
+ ws.addCell(new Label(j, 1 + i, keyORvalue));
+ j++;
+ }
+ }
+
+
+ wwb.write();
+ wwb.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (RowsExceededException e) {
+ e.printStackTrace();
+ } catch (WriteException e) {
+ e.printStackTrace();
+ }
+ return out;
+ }
+
+ //导出时隐藏列
+ public static OutputStream toExcelhideLie(OutputStream out, List