//4.设置字体样式
                Font titleFont = wb.createFont();
//                设置字体的名称(例如Arial)
                titleFont.setFontName("宋体");
//                以1/20点为单位设置字体高度。
                titleFont.setFontHeight((short) 10);
//                设置是否使用斜体
                titleFont.setItalic(true);
//                设置是否在文本中使用删除线横线
                titleFont.setStrikeout(true);
                //颜色设置
                titleFont.setColor((short) 111);
//                设置普通、上标或下标。
                titleFont.setTypeOffset((short) 5);
                //下划线
                titleFont.setUnderline((byte) 0000);
//                是否加粗
                titleFont.setBold(true);
//                设置字体高度
                titleFont.setFontHeightInPoints((short) 12);
                style.setFont(titleFont);
                 // 6.合并单元格
 SXSSFSheet sheet = wb.createSheet("测试sheet");
 sheet.addMergedRegion(new CellRangeAddress(X, Y, a, b));
//设置单元格宽度 ,X代表第几列
 sheet.setColumnWidth(X, 20 * 260);
 public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) {
		super(firstRow, lastRow, firstCol, lastCol);
		
		if (lastRow < firstRow || lastCol < firstCol) {
			throw new IllegalArgumentException("Invalid cell range, having lastRow < firstRow || lastCol < firstCol, " +
					"had rows " + lastRow + " >= " + firstRow + " or cells " + lastCol + " >= " + firstCol);
		}
	}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.