POI中关于CellStyle的几个方法
设置日期格式
public static CellStyle getDateStyle(XSSFWorkbook workBook){
CellStyle cellStyle = ();
DataFormat dataFormat = ();
(("yyyy/mm/dd"));
return cellStyle;
}
设置边框格式
public static CellStyle getBorderStyle(Workbook workBook) {
CellStyle cellStyle = ();
//上边框
(XSSFCellStyle.BORDER_THIN);
//下边框
(XSSFCellStyle.BORDER_THIN);
//左边框
(XSSFCellStyle.BORDER_THIN);
//右边框
(XSSFCellStyle.BORDER_THIN);
//居中
(XSSFCellStyle.ALIGN_CENTER);
return cellStyle;
}
使用
(cellStyle);