|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.report.jasperreports.engine.export;
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
|
+import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
|
|
|
import net.sf.jasperreports.engine.export.Cut;
|
|
|
import net.sf.jasperreports.engine.export.JRXlsExporter;
|
|
|
@@ -25,9 +26,14 @@ public class CustomJRXlsExporter extends JRXlsExporter {
|
|
|
public static final int CELL_HEIGHT = 12;
|
|
|
|
|
|
/**
|
|
|
- * 单元格边框
|
|
|
+ * 单元格边框宽度
|
|
|
*/
|
|
|
- public static final short CELL_BORDER = 1;
|
|
|
+ public static final short CELL_BORDER_WIDTH = 1;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单元格边框颜色
|
|
|
+ */
|
|
|
+ public static final short CELL_BORDER_CORLOR = IndexedColors.GREY_25_PERCENT.index;
|
|
|
|
|
|
/**
|
|
|
* 是否自定义单元格格式
|
|
|
@@ -58,10 +64,14 @@ public class CustomJRXlsExporter extends JRXlsExporter {
|
|
|
protected HSSFCellStyle getLoadedCellStyle(StyleInfo style) {
|
|
|
HSSFCellStyle cellStyle = super.getLoadedCellStyle(style);
|
|
|
if (customCellStyle) {
|
|
|
- cellStyle.setBorderTop(CELL_BORDER);
|
|
|
- cellStyle.setBorderLeft(CELL_BORDER);
|
|
|
- cellStyle.setBorderBottom(CELL_BORDER);
|
|
|
- cellStyle.setBorderRight(CELL_BORDER);
|
|
|
+ cellStyle.setBorderTop(CELL_BORDER_WIDTH);
|
|
|
+ cellStyle.setBorderLeft(CELL_BORDER_WIDTH);
|
|
|
+ cellStyle.setBorderBottom(CELL_BORDER_WIDTH);
|
|
|
+ cellStyle.setBorderRight(CELL_BORDER_WIDTH);
|
|
|
+ cellStyle.setTopBorderColor(CELL_BORDER_CORLOR);
|
|
|
+ cellStyle.setLeftBorderColor(CELL_BORDER_CORLOR);
|
|
|
+ cellStyle.setBottomBorderColor(CELL_BORDER_CORLOR);
|
|
|
+ cellStyle.setRightBorderColor(CELL_BORDER_CORLOR);
|
|
|
}
|
|
|
return cellStyle;
|
|
|
}
|