execl合并单元格

CellRangeAddress numRegion = new CellRangeAddress(1, 3, 0, 0);
CellRangeAddress signRegion = new CellRangeAddress(1, 3, 1, 1);
CellRangeAddress codeRegion = new CellRangeAddress(1, 3, 2, 2);
CellRangeAddress nameRegion = new CellRangeAddress(1, 3, 3, 3);
CellRangeAddress proRegion = new CellRangeAddress(1, 3, 4, 4);
CellRangeAddress proqRegion = new CellRangeAddress(1, 3, 5, 5);
CellRangeAddress scoreRegion = new CellRangeAddress(1, 3, 6, 6);
CellRangeAddress totalRegion = new CellRangeAddress(1, 2, 7, 7);
sheet.addMergedRegion(numRegion);
sheet.addMergedRegion(signRegion);
sheet.addMergedRegion(codeRegion);
sheet.addMergedRegion(nameRegion);
sheet.addMergedRegion(proRegion);
sheet.addMergedRegion(proqRegion);
sheet.addMergedRegion(scoreRegion);
sheet.addMergedRegion(totalRegion);

HSSFCell numCell = oneRow.createCell(0);
//numCell.setCellStyle(cellStyleTitle);
numCell.setCellValue("序号");
HSSFCell signCell = oneRow.createCell(1);
//signCell.setCellStyle(cellStyleTitle);
signCell.setCellValue("系统标识");
HSSFCell codeCell = oneRow.createCell(2);
//codeCell.setCellStyle(cellStyleTitle);
codeCell.setCellValue("公司代码");
HSSFCell nameCell = oneRow.createCell(3);
//nameCell.setCellStyle(cellStyleTitle);
nameCell.setCellValue("企业名称");
HSSFCell proCell = oneRow.createCell(4);
//proCell.setCellStyle(cellStyleTitle);
proCell.setCellValue("问题个数");
HSSFCell proqCell = oneRow.createCell(5);
//proqCell.setCellStyle(cellStyleTitle);
proqCell.setCellValue("问题确认个数");
HSSFCell scoreCell = oneRow.createCell(6);
//scoreCell.setCellStyle(cellStyleTitle);
scoreCell.setCellValue("扣分情况");
HSSFCell totalCell = oneRow.createCell(7);
//totalCell.setCellStyle(cellStyleTitle);
totalCell.setCellValue("本月检查指标数统计");
HSSFRow twoRow = sheet.createRow(2);
HSSFRow threeRow = sheet.createRow(3);
HSSFCell montnNumCell = threeRow.createCell(7);
//montnNumCell.setCellStyle(cellStyleTitle);
montnNumCell.setCellValue("个数");

猜你喜欢

转载自www.cnblogs.com/lin346112883/p/9993410.html