//定义Excel文档对象
XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
//定义sheet
Sheet sheet = xssfWorkbook.createSheet("demo");
//隐藏所有表格线
sheet.setDisplayGridlines(false);
//合并单元格
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 5));
//定义字体样式
Font font = xssfWorkbook.createFont();
//字体
font.setFontName("微软雅黑");
//设置字体大小
font.setFontHeightInPoints((short) 9);
//字体颜色
font.setColor(HSSFColor.LIGHT_ORANGE.index);
//设置单元格样式
CellStyle cellStyle = xssfWorkbook.createCellStyle();
//添加右边框(我这边只定义了右边框)
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//边框颜色
cellStyle.setRightBorderColor(HSSFColor.LIGHT_ORANGE.index);
//左上对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP);
//单元格样式添加内容字体样式
cellStyle.setFont(font);
//遍历单元格添加样式(合并的起始列到终止列)
for (int i=0;i<=5;i++) {
  //添加备注行(合并的起始行到终止行)
  Row row1 = sheet.createRow(0);
  //设置行高
  row1.setHeight((short)300);
  Row row2 = sheet.createRow(1);
  //设置行高
  row2.setHeight((short)300);
  Cell cell = row1.createCell(i);
  Cell cell2 = row2.createCell(i);
   if (i==0){
     cell.setCellValue("备注:");
  }
  cell.setCellStyle(cellStyle);
  cell2.setCellStyle(cellStyle);
}