1.获取map的所有value
Collection value = map.values
2.poi导出的时候时间导出注意事项
CellStyle cellStyle = workbook.createCellStyle(); DataFormat formats = workbook.createDataFormat(); cellStyle.setDataFormat(formats.getFormat("yyyy-MM-dd hh:mm:ss")); dataRow.getCell(9).setCellStyle(cellStyle);
3.poi导出字体颜色设置
//声明一个字体对象
Font font = null;
//创建一个字体对象
font = workbook.createFont();
//给字体对象设置颜色属性
font.setColor(HSSFColor.RED.index);
//将字体对象放入XSSFCellStyle对象中
style.setFont(font);
//将样式放入Cell对象中
cell.setCellStyle(style);
4.poi导出单元格为合并单元格
CellRangeAddress region = new CellRangeAddress(起始行, 终止行, 起始列, 终止列); // sheet.addMergedRegion(region);
5.poi判断单元格是否为空
public static boolean isRowEmpty(Row row){
for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) {
Cell cell = row.getCell(i);
if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK){
return false;
}
}
return true;
}
6.poi将单元格设为空
dataRow.createCell(12).setCellType(HSSFCell.CELL_TYPE_BLANK);
7.获取map的所有key
map.keySet();
8.poi实现自定义导出字段
https://blog.csdn.net/weixin_44736584/article/details/109457982
9.后台设置时间加上几个月
Calendar cal = Calendar.getInstance(); cal.setTime(addParam.getReleasedDate()); cal.add(Calendar.MONTH,月份);