Java使用poi加载Excel模板,将查询出来的数据封装到Excel中并进行指定某些列的合并操作
最近一周项目中需要读取数据库中的记录将记录封装到给定的模板中,指定业务列需要进行合并;下面将它进行整理,有不足之处望多加指出。

下面是需要读取的模板:
模板在项目中的存放位置:

导出后的效果如下

下面是代码部分:

// controller层
@Logger(action = "导出", logger = "导出报表汇总页面Excel",model="报表报送")
@RequestMapping(value = "/reportSummary")
public void reportSummary(@RequestParam(value="unitId", defaultValue="", required=false) String unitId,@RequestParam(value="state", defaultValue="2", required=false) String state,@RequestParam(value="sTime", defaultValue="", required=false) String sTime,@RequestParam(value="eTime", defaultValue="", required=false) String eTime,HttpServletRequest request, HttpServletResponse response) throws WebUIException {ServletOutputStream out=null;try {Map<String, Object> paramMap = new HashMap<String, Object>();UserBean userBean = AuthSystemFacade.getLoginUserInfo();String cusNumber="";String uId="";if("".equals(unitId) || unitId ==null){cusNumber=userBean.getOrgCode();}else {String[] split = unitId.split(",");for(String string : split){if("1130".equals(string) || "100060006".equals(string)){cusNumber="1100";}uId+=(uId.equals("")?"":",") + "'"+string+"'";}uId=uId.substring(1,uId.length()-1);}paramMap.put("state", state);paramMap.put("cusNumber", cusNumber);paramMap.put("unitId", uId);paramMap.put("sTime", sTime);paramMap.put("eTime", eTime);//设置相应到客户端的文件名编码// 解决乱码response.setCharacterEncoding("UTF-8");//定义下载的文件名字String fileName = "。。。。基本情况报表汇总.xlsx";response.setContentType("application/octet-stream;charset=UTF-8");response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));response.addHeader("Pargam", "no-cache");response.addHeader("Cache-Control", "no-cache");//获取响应报文输出流对象out = response.getOutputStream();//调用业务方法,获得需要下载的excel文件XSSFWorkbook book=null;UserBean user = AuthSystemFacade.getLoginUserInfo();String orgCode = user.getOrgCode();book =dailyBasicWorksheetService.reportSummary(request,paramMap);book.write(out);out.flush();out.close();} catch (Exception ex) {ex.printStackTrace();}}```java
//业务接口
XSSFWorkbook reportSummary(HttpServletRequest request, Map<String,Object> map) throws Exception;
//业务层实现类
@Override
public XSSFWorkbook reportSummary(HttpServletRequest request,Map<String,Object> map) throws Exception{UserBean user = AuthSystemFacade.getLoginUserInfo();SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");String time = sdf.format(new Date());Map<String, Object> summaryCountData = this.getDao().summaryData(map.get("cusNumber").toString(),map.get("unitId").toString(),map.get("state").toString(),map.get("sTime").toString(), map.get("eTime").toString());//市局报表汇总数据List<DailyBasicWorksheetDto> DailyBasicWorksheets = this.getDao().findSummaryData(map);for(DailyBasicWorksheetDto worksheetDto:DailyBasicWorksheets){String unitId2 = worksheetDto.getUnitId();if(unitId2.startsWith("1000600")){//戒毒所worksheetDto.setZcZfs(worksheetDto.getZcJds());worksheetDto.setZyZfs(worksheetDto.getSyJds());worksheetDto.setJhzsZfs(worksheetDto.getJhzsJds());worksheetDto.setJwzxZfs(worksheetDto.getJwzxJds());worksheetDto.setTxljZfs(worksheetDto.getTxljJds());worksheetDto.setWcjyZfs(worksheetDto.getWcjyJds());worksheetDto.setZxyyzyZfs(worksheetDto.getZxyyzyJds());worksheetDto.setQhyyzyZfs(worksheetDto.getQhyyzyJds());worksheetDto.setLkyyzyZfs(worksheetDto.getLkyyzyJds());worksheetDto.setShyyzyZfs(worksheetDto.getShyyzyJds());worksheetDto.setShyyzyKymj(worksheetDto.getShyyzyJdkymj());worksheetDto.setJyZfs(worksheetDto.getJyJds());worksheetDto.setLyZfs(worksheetDto.getLyJds());worksheetDto.setXsyManZfs(worksheetDto.getXsyManJds());worksheetDto.setXsyWomanZfs(worksheetDto.getXsyWomanJds());worksheetDto.setZfDcs(worksheetDto.getDcJds());worksheetDto.setSfZfs(worksheetDto.getSfJds());worksheetDto.setJsZfs(worksheetDto.getJsJds());worksheetDto.setSwZfs(worksheetDto.getSwJds());}}String filePath = request.getSession().getServletContext().getRealPath("")+"/WEB-INF/static/excelMoudle/bbhz.xlsx";//String srcFilePath = "D:\\bbhz.xlsx";//创建Excel文件的输入流对象FileInputStream fis = new FileInputStream(filePath);//根据模板创建excel工作簿XSSFWorkbook workBook = new XSSFWorkbook(fis);//获取创建的工作簿第一页XSSFSheet sheet = workBook.getSheetAt(0);//给指定的sheet命名workBook.setSheetName(0,"报表汇总");//设置字体大小、加粗  样式XSSFCellStyle cellStyle = workBook.createCellStyle();Font font=workBook.createFont();font.setFontName("宋体");//宋体font.setFontHeightInPoints((short)12);//字号font.setBold(false);//加粗 否cellStyle.setFont(font);cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中cellStyle.setBorderTop(BorderStyle.THIN);cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());cellStyle.setBorderBottom(BorderStyle.THIN);cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());cellStyle.setBorderRight(BorderStyle.THIN);cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());cellStyle.setBorderLeft(BorderStyle.THIN);cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());//获取当前sheet最后一行数据对应的行索引int currentLastRowIndex = sheet.getLastRowNum();int size = DailyBasicWorksheets.size();if(DailyBasicWorksheets.size()>0){int sjNum=0;int sj=6;int fjNum=0;int fj=6;int xkNum=0;int xk=2;int xkCount=0;int lkNum=0;int lk=2;int lkCount=0;for(int i=0;i<DailyBasicWorksheets.size();i++){DailyBasicWorksheetDto worksheet = DailyBasicWorksheets.get(i);String unitId = worksheet.getUnitId();String reportDeptName = worksheet.getReportDeptName();if("1100".equals(unitId)){//创建新的行XSSFRow newRow = sheet.createRow(currentLastRowIndex+1+i);//创建一个单元格,设置其内的数据格式为字符串,并填充内容,其余单元格类同XSSFCell newNameCellReportUnitName = newRow.createCell(0);newNameCellReportUnitName.setCellStyle(cellStyle);newNameCellReportUnitName.setCellValue(worksheet.getUnitName());XSSFCell newNameCellJsldXm1 = newRow.createCell(1);newNameCellJsldXm1.setCellValue(worksheet.getOnePositionLeader()==""?"":worksheet.getOnePositionLeader()==null?"":worksheet.getOnePositionLeader());newNameCellJsldXm1.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone1 = newRow.createCell(2);newNameCellJsldPhone1.setCellValue(worksheet.getOnePositionPhone()==""?"":worksheet.getOnePositionPhone()==null?"":worksheet.getOnePositionPhone());newNameCellJsldPhone1.setCellStyle(cellStyle);XSSFCell newNameCellJsldXm2 = newRow.createCell(3);newNameCellJsldXm2.setCellValue(worksheet.getTwoPositionLeader()==""?"":worksheet.getTwoPositionLeader()==null?"":worksheet.getTwoPositionLeader());newNameCellJsldXm2.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone2 = newRow.createCell(4);newNameCellJsldPhone2.setCellValue(worksheet.getTwoPositionPhone()==""?"":worksheet.getTwoPositionPhone()==null?"":worksheet.getTwoPositionPhone());newNameCellJsldPhone2.setCellStyle(cellStyle);XSSFCell newNameCellZhzxXm = newRow.createCell(5);newNameCellZhzxXm.setCellValue("—");newNameCellZhzxXm.setCellStyle(cellStyle);XSSFCell newNameCellZhzxPhone = newRow.createCell(6);newNameCellZhzxPhone.setCellValue("—");newNameCellZhzxPhone.setCellStyle(cellStyle);XSSFCell newNameCellZggjZs = newRow.createCell(7);newNameCellZggjZs.setCellValue(worksheet.getZggjZs());newNameCellZggjZs.setCellStyle(cellStyle);XSSFCell newNameCellZggjjg = newRow.createCell(8);newNameCellZggjjg.setCellValue(worksheet.getZggjJg());newNameCellZggjjg.setCellStyle(cellStyle);XSSFCell newNameCellZggjjq = newRow.createCell(9);newNameCellZggjjq.setCellValue("—");newNameCellZggjjq.setCellStyle(cellStyle);XSSFCell newNameCellZbgjZs = newRow.createCell(10);newNameCellZbgjZs.setCellValue(worksheet.getZbgjZs());newNameCellZbgjZs.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjg = newRow.createCell(11);newNameCellZbgjjg.setCellValue(worksheet.getZbgjJg());newNameCellZbgjjg.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjq = newRow.createCell(12);newNameCellZbgjjq.setCellValue("—");newNameCellZbgjjq.setCellStyle(cellStyle);XSSFCell newNameCellBqjl = newRow.createCell(13);newNameCellBqjl.setCellValue(worksheet.getBqJl());newNameCellBqjl.setCellStyle(cellStyle);XSSFCell newNameCellWtZs = newRow.createCell(14);newNameCellWtZs.setCellValue("—");newNameCellWtZs.setCellStyle(cellStyle);XSSFCell newNameCellJgwt = newRow.createCell(15);newNameCellJgwt.setCellValue("—");newNameCellJgwt.setCellStyle(cellStyle);XSSFCell newNameCellQtwt = newRow.createCell(16);newNameCellQtwt.setCellValue("—");newNameCellQtwt.setCellStyle(cellStyle);XSSFCell newNameCellZcs = newRow.createCell(17);newNameCellZcs.setCellValue("—");newNameCellZcs.setCellStyle(cellStyle);XSSFCell newNameCellZys = newRow.createCell(18);newNameCellZys.setCellValue("—");newNameCellZys.setCellStyle(cellStyle);XSSFCell newNameCellJhzss = newRow.createCell(19);newNameCellJhzss.setCellValue("—");newNameCellJhzss.setCellStyle(cellStyle);XSSFCell newNameCellJwzxs = newRow.createCell(20);newNameCellJwzxs.setCellValue("—");newNameCellJwzxs.setCellStyle(cellStyle);XSSFCell newNameCellTxljs = newRow.createCell(21);newNameCellTxljs.setCellValue("—");newNameCellTxljs.setCellStyle(cellStyle);XSSFCell newNameCellWcjys = newRow.createCell(22);newNameCellWcjys.setCellValue("—");newNameCellWcjys.setCellStyle(cellStyle);XSSFCell newNameCellZxyy = newRow.createCell(23);newNameCellZxyy.setCellValue("—");newNameCellZxyy.setCellStyle(cellStyle);XSSFCell newNameCellQhyy = newRow.createCell(24);newNameCellQhyy.setCellValue("—");newNameCellQhyy.setCellStyle(cellStyle);XSSFCell newNameCellLkyy = newRow.createCell(25);newNameCellLkyy.setCellValue("—");newNameCellLkyy.setCellStyle(cellStyle);XSSFCell newNameCellShyyZf_Jds = newRow.createCell(26);newNameCellShyyZf_Jds.setCellValue("—");newNameCellShyyZf_Jds.setCellStyle(cellStyle);XSSFCell newNameCellShyyKymjs = newRow.createCell(27);newNameCellShyyKymjs.setCellValue("—");newNameCellShyyKymjs.setCellStyle(cellStyle);XSSFCell newNameCellJys = newRow.createCell(28);newNameCellJys.setCellValue("—");newNameCellJys.setCellStyle(cellStyle);XSSFCell newNameCellLys = newRow.createCell(29);newNameCellLys.setCellValue("—");newNameCellLys.setCellStyle(cellStyle);XSSFCell newNameCellXsyMan = newRow.createCell(30);newNameCellXsyMan.setCellValue("—");newNameCellXsyMan.setCellStyle(cellStyle);XSSFCell newNameCellXsyWoman = newRow.createCell(31);newNameCellXsyWoman.setCellValue("—");newNameCellXsyWoman.setCellStyle(cellStyle);XSSFCell newNameCellDcs = newRow.createCell(32);newNameCellDcs.setCellValue("—");newNameCellDcs.setCellStyle(cellStyle);XSSFCell newNameCellSfs = newRow.createCell(33);newNameCellSfs.setCellValue("—");newNameCellSfs.setCellStyle(cellStyle);XSSFCell newNameCellJss = newRow.createCell(34);newNameCellJss.setCellValue("—");newNameCellJss.setCellStyle(cellStyle);XSSFCell newNameCellSws = newRow.createCell(35);newNameCellSws.setCellValue("—");newNameCellSws.setCellStyle(cellStyle);XSSFCell newNameCellBsPerson = newRow.createCell(36);newNameCellBsPerson.setCellValue(worksheet.getReportPerson());newNameCellBsPerson.setCellStyle(cellStyle);XSSFCell newNameCellBsTime = newRow.createCell(37);newNameCellBsTime.setCellValue(sdf.format(worksheet.getReportTime()));newNameCellBsTime.setCellStyle(cellStyle);XSSFCell newNameCellBz = newRow.createCell(38);newNameCellBz.setCellValue(worksheet.getRemark()==""?"":worksheet.getRemark()==null?"":worksheet.getRemark());newNameCellBz.setCellStyle(cellStyle);//设置行高 行高设置30newRow.setHeightInPoints(30);if("市局总值班长一".equals(reportDeptName)){sjNum=i;marginSjExcelCell(sheet,currentLastRowIndex,sjNum,sj);}} else if("1140".equals(unitId)){//创建新的行XSSFRow newRow = sheet.createRow(currentLastRowIndex+1+i);//创建一个单元格,设置其内的数据格式为字符串,并填充内容,其余单元格类同XSSFCell newNameCellReportUnitName = newRow.createCell(0);newNameCellReportUnitName.setCellStyle(cellStyle);newNameCellReportUnitName.setCellValue(worksheet.getUnitName());XSSFCell newNameCellJsldXm1 = newRow.createCell(1);newNameCellJsldXm1.setCellValue(worksheet.getOnePositionLeader());newNameCellJsldXm1.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone1 = newRow.createCell(2);newNameCellJsldPhone1.setCellValue(worksheet.getOnePositionPhone());newNameCellJsldPhone1.setCellStyle(cellStyle);XSSFCell newNameCellJsldXm2 = newRow.createCell(3);newNameCellJsldXm2.setCellValue(worksheet.getTwoPositionLeader());newNameCellJsldXm2.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone2 = newRow.createCell(4);newNameCellJsldPhone2.setCellValue(worksheet.getTwoPositionPhone());newNameCellJsldPhone2.setCellStyle(cellStyle);XSSFCell newNameCellZhzxXm = newRow.createCell(5);newNameCellZhzxXm.setCellValue(worksheet.getZhzXm()==""?"":worksheet.getZhzXm()==null?"":worksheet.getZhzXm());newNameCellZhzxXm.setCellStyle(cellStyle);XSSFCell newNameCellZhzxPhone = newRow.createCell(6);newNameCellZhzxPhone.setCellValue(worksheet.getZhzPhone()==""?"":worksheet.getZhzPhone()==null?"":worksheet.getZhzPhone());newNameCellZhzxPhone.setCellStyle(cellStyle);XSSFCell newNameCellZggjZs = newRow.createCell(7);newNameCellZggjZs.setCellValue(worksheet.getZggjZs());newNameCellZggjZs.setCellStyle(cellStyle);XSSFCell newNameCellZggjjg = newRow.createCell(8);newNameCellZggjjg.setCellValue(worksheet.getZggjJg());newNameCellZggjjg.setCellStyle(cellStyle);XSSFCell newNameCellZggjjq = newRow.createCell(9);newNameCellZggjjq.setCellValue("—");newNameCellZggjjq.setCellStyle(cellStyle);XSSFCell newNameCellZbgjZs = newRow.createCell(10);newNameCellZbgjZs.setCellValue(worksheet.getZbgjZs());newNameCellZbgjZs.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjg = newRow.createCell(11);newNameCellZbgjjg.setCellValue(worksheet.getZbgjJg());newNameCellZbgjjg.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjq = newRow.createCell(12);newNameCellZbgjjq.setCellValue("—");newNameCellZbgjjq.setCellStyle(cellStyle);XSSFCell newNameCellBqjl = newRow.createCell(13);newNameCellBqjl.setCellValue(worksheet.getBqJl());newNameCellBqjl.setCellStyle(cellStyle);XSSFCell newNameCellWtZs = newRow.createCell(14);newNameCellWtZs.setCellValue(worksheet.getProblemCount());newNameCellWtZs.setCellStyle(cellStyle);XSSFCell newNameCellJgwt = newRow.createCell(15);newNameCellJgwt.setCellValue(worksheet.getSupervisionProblemCount());newNameCellJgwt.setCellStyle(cellStyle);XSSFCell newNameCellQtwt = newRow.createCell(16);newNameCellQtwt.setCellValue(worksheet.getOtherProblemCount());newNameCellQtwt.setCellStyle(cellStyle);XSSFCell newNameCellZcs = newRow.createCell(17);newNameCellZcs.setCellValue("—");newNameCellZcs.setCellStyle(cellStyle);XSSFCell newNameCellZys = newRow.createCell(18);newNameCellZys.setCellValue("—");newNameCellZys.setCellStyle(cellStyle);XSSFCell newNameCellJhzss = newRow.createCell(19);newNameCellJhzss.setCellValue("—");newNameCellJhzss.setCellStyle(cellStyle);XSSFCell newNameCellJwzxs = newRow.createCell(20);newNameCellJwzxs.setCellValue("—");newNameCellJwzxs.setCellStyle(cellStyle);XSSFCell newNameCellTxljs = newRow.createCell(21);newNameCellTxljs.setCellValue("—");newNameCellTxljs.setCellStyle(cellStyle);XSSFCell newNameCellWcjys = newRow.createCell(22);newNameCellWcjys.setCellValue("—");newNameCellWcjys.setCellStyle(cellStyle);XSSFCell newNameCellZxyy = newRow.createCell(23);newNameCellZxyy.setCellValue("—");newNameCellZxyy.setCellStyle(cellStyle);XSSFCell newNameCellQhyy = newRow.createCell(24);newNameCellQhyy.setCellValue("—");newNameCellQhyy.setCellStyle(cellStyle);XSSFCell newNameCellLkyy = newRow.createCell(25);newNameCellLkyy.setCellValue("—");newNameCellLkyy.setCellStyle(cellStyle);XSSFCell newNameCellShyyZf_Jds = newRow.createCell(26);newNameCellShyyZf_Jds.setCellValue("—");newNameCellShyyZf_Jds.setCellStyle(cellStyle);XSSFCell newNameCellShyyKymjs = newRow.createCell(27);newNameCellShyyKymjs.setCellValue("—");newNameCellShyyKymjs.setCellStyle(cellStyle);XSSFCell newNameCellJys = newRow.createCell(28);newNameCellJys.setCellValue("—");newNameCellJys.setCellStyle(cellStyle);XSSFCell newNameCellLys = newRow.createCell(29);newNameCellLys.setCellValue("—");newNameCellLys.setCellStyle(cellStyle);XSSFCell newNameCellXsyMan = newRow.createCell(30);newNameCellXsyMan.setCellValue("—");newNameCellXsyMan.setCellStyle(cellStyle);XSSFCell newNameCellXsyWoman = newRow.createCell(31);newNameCellXsyWoman.setCellValue("—");newNameCellXsyWoman.setCellStyle(cellStyle);XSSFCell newNameCellDcs = newRow.createCell(32);newNameCellDcs.setCellValue("—");newNameCellDcs.setCellStyle(cellStyle);XSSFCell newNameCellSfs = newRow.createCell(33);newNameCellSfs.setCellValue("—");newNameCellSfs.setCellStyle(cellStyle);XSSFCell newNameCellJss = newRow.createCell(34);newNameCellJss.setCellValue("—");newNameCellJss.setCellStyle(cellStyle);XSSFCell newNameCellSws = newRow.createCell(35);newNameCellSws.setCellValue("—");newNameCellSws.setCellStyle(cellStyle);XSSFCell newNameCellBsPerson = newRow.createCell(36);newNameCellBsPerson.setCellValue(worksheet.getReportPerson());newNameCellBsPerson.setCellStyle(cellStyle);XSSFCell newNameCellBsTime = newRow.createCell(37);newNameCellBsTime.setCellValue(sdf.format(worksheet.getReportTime()));newNameCellBsTime.setCellStyle(cellStyle);XSSFCell newNameCellBz = newRow.createCell(38);newNameCellBz.setCellValue(worksheet.getRemark()==""?"":worksheet.getRemark()==null?"":worksheet.getRemark());newNameCellBz.setCellStyle(cellStyle);//设置行高 行高设置30newRow.setHeightInPoints(30);if("分局总值班长".equals(reportDeptName)){fjNum=i;marginFjExcelCell(sheet,currentLastRowIndex,fjNum,fj);}} else if("1130".equals(unitId) || "100060010".equals(unitId)){if("1130".equals(unitId)){xkNum=i;xkCount++;if(xkCount % 2 ==0){marginXkExcelCell(sheet, currentLastRowIndex, xkNum, xk);}}else {lkNum=i;lkCount++;if(lkCount % 2 ==0){marginXkExcelCell(sheet, currentLastRowIndex, lkNum, lk);}}//创建新的行XSSFRow newRow = sheet.createRow(currentLastRowIndex+1+i);//创建一个单元格,设置其内的数据格式为字符串,并填充内容,其余单元格类同XSSFCell newNameCellReportUnitName = newRow.createCell(0);newNameCellReportUnitName.setCellStyle(cellStyle);newNameCellReportUnitName.setCellValue(worksheet.getUnitName());XSSFCell newNameCellJsldXm1 = newRow.createCell(1);newNameCellJsldXm1.setCellValue(worksheet.getOnePositionLeader());newNameCellJsldXm1.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone1 = newRow.createCell(2);newNameCellJsldPhone1.setCellValue(worksheet.getOnePositionPhone());newNameCellJsldPhone1.setCellStyle(cellStyle);XSSFCell newNameCellJsldXm2 = newRow.createCell(3);newNameCellJsldXm2.setCellValue(worksheet.getTwoPositionLeader());newNameCellJsldXm2.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone2 = newRow.createCell(4);newNameCellJsldPhone2.setCellValue(worksheet.getTwoPositionPhone());newNameCellJsldPhone2.setCellStyle(cellStyle);XSSFCell newNameCellZhzxXm = newRow.createCell(5);newNameCellZhzxXm.setCellValue(worksheet.getZhzXm()==""?"":worksheet.getZhzXm()==null?"":worksheet.getZhzXm());newNameCellZhzxXm.setCellStyle(cellStyle);XSSFCell newNameCellZhzxPhone = newRow.createCell(6);newNameCellZhzxPhone.setCellValue(worksheet.getZhzPhone()==""?"":worksheet.getZhzPhone()==null?"":worksheet.getZhzPhone());newNameCellZhzxPhone.setCellStyle(cellStyle);XSSFCell newNameCellZggjZs = newRow.createCell(7);newNameCellZggjZs.setCellValue(worksheet.getZggjZs());newNameCellZggjZs.setCellStyle(cellStyle);XSSFCell newNameCellZggjjg = newRow.createCell(8);newNameCellZggjjg.setCellValue(worksheet.getZggjJg());newNameCellZggjjg.setCellStyle(cellStyle);XSSFCell newNameCellZggjjq = newRow.createCell(9);newNameCellZggjjq.setCellValue(worksheet.getZggjJq());newNameCellZggjjq.setCellStyle(cellStyle);XSSFCell newNameCellZbgjZs = newRow.createCell(10);newNameCellZbgjZs.setCellValue(worksheet.getZbgjZs());newNameCellZbgjZs.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjg = newRow.createCell(11);newNameCellZbgjjg.setCellValue(worksheet.getZbgjJg());newNameCellZbgjjg.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjq = newRow.createCell(12);newNameCellZbgjjq.setCellValue(worksheet.getZbgjJq());newNameCellZbgjjq.setCellStyle(cellStyle);XSSFCell newNameCellBqjl = newRow.createCell(13);newNameCellBqjl.setCellValue(worksheet.getBqJl());newNameCellBqjl.setCellStyle(cellStyle);XSSFCell newNameCellWtZs = newRow.createCell(14);newNameCellWtZs.setCellValue(worksheet.getProblemCount());newNameCellWtZs.setCellStyle(cellStyle);XSSFCell newNameCellJgwt = newRow.createCell(15);newNameCellJgwt.setCellValue(worksheet.getSupervisionProblemCount());newNameCellJgwt.setCellStyle(cellStyle);XSSFCell newNameCellQtwt = newRow.createCell(16);newNameCellQtwt.setCellValue(worksheet.getOtherProblemCount());newNameCellQtwt.setCellStyle(cellStyle);XSSFCell newNameCellZcs = newRow.createCell(17);newNameCellZcs.setCellValue(worksheet.getZcZfs());newNameCellZcs.setCellStyle(cellStyle);XSSFCell newNameCellZys = newRow.createCell(18);newNameCellZys.setCellValue(worksheet.getZyZfs());newNameCellZys.setCellStyle(cellStyle);XSSFCell newNameCellJhzss = newRow.createCell(19);newNameCellJhzss.setCellValue(worksheet.getJhzsZfs());newNameCellJhzss.setCellStyle(cellStyle);XSSFCell newNameCellJwzxs = newRow.createCell(20);newNameCellJwzxs.setCellValue(worksheet.getJwzxZfs());newNameCellJwzxs.setCellStyle(cellStyle);XSSFCell newNameCellTxljs = newRow.createCell(21);newNameCellTxljs.setCellValue(worksheet.getTxljZfs());newNameCellTxljs.setCellStyle(cellStyle);XSSFCell newNameCellWcjys = newRow.createCell(22);newNameCellWcjys.setCellValue(worksheet.getWcjyZfs());newNameCellWcjys.setCellStyle(cellStyle);XSSFCell newNameCellZxyy = newRow.createCell(23);newNameCellZxyy.setCellValue(worksheet.getZxyyzyZfs());newNameCellZxyy.setCellStyle(cellStyle);XSSFCell newNameCellQhyy = newRow.createCell(24);newNameCellQhyy.setCellValue(worksheet.getQhyyzyZfs());newNameCellQhyy.setCellStyle(cellStyle);XSSFCell newNameCellLkyy = newRow.createCell(25);newNameCellLkyy.setCellValue(worksheet.getLkyyzyZfs());newNameCellLkyy.setCellStyle(cellStyle);XSSFCell newNameCellShyyZf_Jds = newRow.createCell(26);newNameCellShyyZf_Jds.setCellValue(worksheet.getShyyzyZfs());newNameCellShyyZf_Jds.setCellStyle(cellStyle);XSSFCell newNameCellShyyKymjs = newRow.createCell(27);newNameCellShyyKymjs.setCellValue(worksheet.getShyyzyKymj());newNameCellShyyKymjs.setCellStyle(cellStyle);XSSFCell newNameCellJys = newRow.createCell(28);newNameCellJys.setCellValue(worksheet.getJyZfs());newNameCellJys.setCellStyle(cellStyle);XSSFCell newNameCellLys = newRow.createCell(29);newNameCellLys.setCellValue(worksheet.getLyZfs());newNameCellLys.setCellStyle(cellStyle);XSSFCell newNameCellXsyMan = newRow.createCell(30);newNameCellXsyMan.setCellValue(worksheet.getXsyManZfs());newNameCellXsyMan.setCellStyle(cellStyle);XSSFCell newNameCellXsyWoman = newRow.createCell(31);newNameCellXsyWoman.setCellValue(worksheet.getXsyWomanZfs());newNameCellXsyWoman.setCellStyle(cellStyle);XSSFCell newNameCellDcs = newRow.createCell(32);newNameCellDcs.setCellValue(worksheet.getZfDcs());newNameCellDcs.setCellStyle(cellStyle);XSSFCell newNameCellSfs = newRow.createCell(33);newNameCellSfs.setCellValue(worksheet.getSfZfs());newNameCellSfs.setCellStyle(cellStyle);XSSFCell newNameCellJss = newRow.createCell(34);newNameCellJss.setCellValue(worksheet.getJsZfs());newNameCellJss.setCellStyle(cellStyle);XSSFCell newNameCellSws = newRow.createCell(35);newNameCellSws.setCellValue(worksheet.getSwZfs());newNameCellSws.setCellStyle(cellStyle);XSSFCell newNameCellBsPerson = newRow.createCell(36);newNameCellBsPerson.setCellValue(worksheet.getReportPerson());newNameCellBsPerson.setCellStyle(cellStyle);XSSFCell newNameCellBsTime = newRow.createCell(37);newNameCellBsTime.setCellValue(sdf.format(worksheet.getReportTime()));newNameCellBsTime.setCellStyle(cellStyle);XSSFCell newNameCellBz = newRow.createCell(38);newNameCellBz.setCellValue(worksheet.getRemark()==""?"":worksheet.getRemark()==null?"":worksheet.getRemark());newNameCellBz.setCellStyle(cellStyle);//设置行高 行高设置30newRow.setHeightInPoints(30);}else {//创建新的行XSSFRow newRow = sheet.createRow(currentLastRowIndex+1+i);//创建一个单元格,设置其内的数据格式为字符串,并填充内容,其余单元格类同XSSFCell newNameCellReportUnitName = newRow.createCell(0);newNameCellReportUnitName.setCellStyle(cellStyle);newNameCellReportUnitName.setCellValue(worksheet.getUnitName());XSSFCell newNameCellJsldXm1 = newRow.createCell(1);newNameCellJsldXm1.setCellValue(worksheet.getOnePositionLeader());newNameCellJsldXm1.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone1 = newRow.createCell(2);newNameCellJsldPhone1.setCellValue(worksheet.getOnePositionPhone());newNameCellJsldPhone1.setCellStyle(cellStyle);XSSFCell newNameCellJsldXm2 = newRow.createCell(3);newNameCellJsldXm2.setCellValue(worksheet.getTwoPositionLeader());newNameCellJsldXm2.setCellStyle(cellStyle);XSSFCell newNameCellJsldPhone2 = newRow.createCell(4);newNameCellJsldPhone2.setCellValue(worksheet.getTwoPositionPhone());newNameCellJsldPhone2.setCellStyle(cellStyle);XSSFCell newNameCellZhzxXm = newRow.createCell(5);newNameCellZhzxXm.setCellValue(worksheet.getZhzXm()==""?"":worksheet.getZhzXm()==null?"":worksheet.getZhzXm());newNameCellZhzxXm.setCellStyle(cellStyle);XSSFCell newNameCellZhzxPhone = newRow.createCell(6);newNameCellZhzxPhone.setCellValue(worksheet.getZhzPhone()==""?"":worksheet.getZhzPhone()==null?"":worksheet.getZhzPhone());newNameCellZhzxPhone.setCellStyle(cellStyle);XSSFCell newNameCellZggjZs = newRow.createCell(7);newNameCellZggjZs.setCellValue(worksheet.getZggjZs());newNameCellZggjZs.setCellStyle(cellStyle);XSSFCell newNameCellZggjjg = newRow.createCell(8);newNameCellZggjjg.setCellValue(worksheet.getZggjJg());newNameCellZggjjg.setCellStyle(cellStyle);XSSFCell newNameCellZggjjq = newRow.createCell(9);newNameCellZggjjq.setCellValue(worksheet.getZggjJq());newNameCellZggjjq.setCellStyle(cellStyle);XSSFCell newNameCellZbgjZs = newRow.createCell(10);newNameCellZbgjZs.setCellValue(worksheet.getZbgjZs());newNameCellZbgjZs.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjg = newRow.createCell(11);newNameCellZbgjjg.setCellValue(worksheet.getZbgjJg());newNameCellZbgjjg.setCellStyle(cellStyle);XSSFCell newNameCellZbgjjq = newRow.createCell(12);newNameCellZbgjjq.setCellValue(worksheet.getZbgjJq());newNameCellZbgjjq.setCellStyle(cellStyle);XSSFCell newNameCellBqjl = newRow.createCell(13);newNameCellBqjl.setCellValue(worksheet.getBqJl());newNameCellBqjl.setCellStyle(cellStyle);XSSFCell newNameCellWtZs = newRow.createCell(14);newNameCellWtZs.setCellValue(worksheet.getProblemCount());newNameCellWtZs.setCellStyle(cellStyle);XSSFCell newNameCellJgwt = newRow.createCell(15);newNameCellJgwt.setCellValue(worksheet.getSupervisionProblemCount());newNameCellJgwt.setCellStyle(cellStyle);XSSFCell newNameCellQtwt = newRow.createCell(16);newNameCellQtwt.setCellValue(worksheet.getOtherProblemCount());newNameCellQtwt.setCellStyle(cellStyle);XSSFCell newNameCellZcs = newRow.createCell(17);newNameCellZcs.setCellValue(worksheet.getZcZfs());newNameCellZcs.setCellStyle(cellStyle);XSSFCell newNameCellZys = newRow.createCell(18);newNameCellZys.setCellValue(worksheet.getZyZfs());newNameCellZys.setCellStyle(cellStyle);XSSFCell newNameCellJhzss = newRow.createCell(19);newNameCellJhzss.setCellValue(worksheet.getJhzsZfs());newNameCellJhzss.setCellStyle(cellStyle);XSSFCell newNameCellJwzxs = newRow.createCell(20);newNameCellJwzxs.setCellValue(worksheet.getJwzxZfs());newNameCellJwzxs.setCellStyle(cellStyle);XSSFCell newNameCellTxljs = newRow.createCell(21);newNameCellTxljs.setCellValue(worksheet.getTxljZfs());newNameCellTxljs.setCellStyle(cellStyle);XSSFCell newNameCellWcjys = newRow.createCell(22);newNameCellWcjys.setCellValue(worksheet.getWcjyZfs());newNameCellWcjys.setCellStyle(cellStyle);XSSFCell newNameCellZxyy = newRow.createCell(23);newNameCellZxyy.setCellValue(worksheet.getZxyyzyZfs());newNameCellZxyy.setCellStyle(cellStyle);XSSFCell newNameCellQhyy = newRow.createCell(24);newNameCellQhyy.setCellValue(worksheet.getQhyyzyZfs());newNameCellQhyy.setCellStyle(cellStyle);XSSFCell newNameCellLkyy = newRow.createCell(25);newNameCellLkyy.setCellValue(worksheet.getLkyyzyZfs());newNameCellLkyy.setCellStyle(cellStyle);XSSFCell newNameCellShyyZf_Jds = newRow.createCell(26);newNameCellShyyZf_Jds.setCellValue(worksheet.getShyyzyZfs());newNameCellShyyZf_Jds.setCellStyle(cellStyle);XSSFCell newNameCellShyyKymjs = newRow.createCell(27);newNameCellShyyKymjs.setCellValue(worksheet.getShyyzyKymj());newNameCellShyyKymjs.setCellStyle(cellStyle);XSSFCell newNameCellJys = newRow.createCell(28);newNameCellJys.setCellValue(worksheet.getJyZfs());newNameCellJys.setCellStyle(cellStyle);XSSFCell newNameCellLys = newRow.createCell(29);newNameCellLys.setCellValue(worksheet.getLyZfs());newNameCellLys.setCellStyle(cellStyle);XSSFCell newNameCellXsyMan = newRow.createCell(30);newNameCellXsyMan.setCellValue(worksheet.getXsyManZfs());newNameCellXsyMan.setCellStyle(cellStyle);XSSFCell newNameCellXsyWoman = newRow.createCell(31);newNameCellXsyWoman.setCellValue(worksheet.getXsyWomanZfs());newNameCellXsyWoman.setCellStyle(cellStyle);XSSFCell newNameCellDcs = newRow.createCell(32);newNameCellDcs.setCellValue(worksheet.getZfDcs());newNameCellDcs.setCellStyle(cellStyle);XSSFCell newNameCellSfs = newRow.createCell(33);newNameCellSfs.setCellValue(worksheet.getSfZfs());newNameCellSfs.setCellStyle(cellStyle);XSSFCell newNameCellJss = newRow.createCell(34);newNameCellJss.setCellValue(worksheet.getJsZfs());newNameCellJss.setCellStyle(cellStyle);XSSFCell newNameCellSws = newRow.createCell(35);newNameCellSws.setCellValue(worksheet.getSwZfs());newNameCellSws.setCellStyle(cellStyle);XSSFCell newNameCellBsPerson = newRow.createCell(36);newNameCellBsPerson.setCellValue(worksheet.getReportPerson());newNameCellBsPerson.setCellStyle(cellStyle);XSSFCell newNameCellBsTime = newRow.createCell(37);newNameCellBsTime.setCellValue(sdf.format(worksheet.getReportTime()));newNameCellBsTime.setCellStyle(cellStyle);XSSFCell newNameCellBz = newRow.createCell(38);newNameCellBz.setCellValue(worksheet.getRemark()==""?"":worksheet.getRemark()==null?"":worksheet.getRemark());newNameCellBz.setCellStyle(cellStyle);//设置行高 行高设置30newRow.setHeightInPoints(30);}}}//合计XSSFRow row39 = sheet.createRow(currentLastRowIndex+size+1);XSSFCell row39Cell1 = row39.createCell(0);row39Cell1.setCellStyle(cellStyle);row39Cell1.setCellValue("合计");XSSFCell row39Cell2 = row39.createCell(1);row39Cell2.setCellStyle(cellStyle);row39Cell2.setCellValue("—");XSSFCell row39Cell3 = row39.createCell(2);row39Cell3.setCellStyle(cellStyle);row39Cell3.setCellValue("—");XSSFCell row39Cell4 = row39.createCell(3);row39Cell4.setCellStyle(cellStyle);row39Cell4.setCellValue("—");XSSFCell row39Cell5 = row39.createCell(4);row39Cell5.setCellStyle(cellStyle);row39Cell5.setCellValue("—");XSSFCell row39Cell6 = row39.createCell(5);row39Cell6.setCellStyle(cellStyle);row39Cell6.setCellValue("—");XSSFCell row39Cell7 = row39.createCell(6);row39Cell7.setCellStyle(cellStyle);row39Cell7.setCellValue("—");XSSFCell row39Cell8 = row39.createCell(7);row39Cell8.setCellValue(summaryCountData.get("ZGGJ_ZS").toString());row39Cell8.setCellStyle(cellStyle);XSSFCell row39Cell9 = row39.createCell(8);row39Cell9.setCellValue(summaryCountData.get("ZGGJ_JG").toString());row39Cell9.setCellStyle(cellStyle);XSSFCell row39Cell10 = row39.createCell(9);row39Cell10.setCellValue(summaryCountData.get("ZGGJ_JQ").toString());row39Cell10.setCellStyle(cellStyle);XSSFCell row39Cell11 = row39.createCell(10);row39Cell11.setCellValue(summaryCountData.get("ZBGJ_ZS").toString());row39Cell11.setCellStyle(cellStyle);XSSFCell row39Cell12 = row39.createCell(11);row39Cell12.setCellValue(summaryCountData.get("ZBGJ_JG").toString());row39Cell12.setCellStyle(cellStyle);XSSFCell row39Cell13 = row39.createCell(12);row39Cell13.setCellValue(summaryCountData.get("ZBGJ_JQ").toString());row39Cell13.setCellStyle(cellStyle);XSSFCell row39Cell14 = row39.createCell(13);row39Cell14.setCellValue(summaryCountData.get("BQ_JL").toString());row39Cell14.setCellStyle(cellStyle);XSSFCell row39Cell15 = row39.createCell(14);row39Cell15.setCellValue(summaryCountData.get("PROBLEM_COUNT").toString());row39Cell15.setCellStyle(cellStyle);XSSFCell row39Cell16 = row39.createCell(15);row39Cell16.setCellValue(summaryCountData.get("SUPERVISION_PROBLEM_COUNT").toString());row39Cell16.setCellStyle(cellStyle);XSSFCell row39Cell17 = row39.createCell(16);row39Cell17.setCellValue(summaryCountData.get("OTHER_PROBLEM_COUNT").toString());row39Cell17.setCellStyle(cellStyle);XSSFCell row39Cell18 = row39.createCell(17);row39Cell18.setCellValue(summaryCountData.get("ZC_ZFS").toString());row39Cell18.setCellStyle(cellStyle);XSSFCell row39Cell19 = row39.createCell(18);row39Cell19.setCellValue(summaryCountData.get("ZY_ZFS").toString());row39Cell19.setCellStyle(cellStyle);XSSFCell row39Cell20 = row39.createCell(19);row39Cell20.setCellValue(summaryCountData.get("JHZS_ZFS").toString());row39Cell20.setCellStyle(cellStyle);XSSFCell row39Cell21 = row39.createCell(20);row39Cell21.setCellValue(summaryCountData.get("JWZX_ZFS").toString());row39Cell21.setCellStyle(cellStyle);XSSFCell row39Cell22 = row39.createCell(21);row39Cell22.setCellValue(summaryCountData.get("TXLJ_ZFS").toString());row39Cell22.setCellStyle(cellStyle);XSSFCell row39Cell23 = row39.createCell(22);row39Cell23.setCellValue(summaryCountData.get("WCJY_ZFS").toString());row39Cell23.setCellStyle(cellStyle);XSSFCell row39Cell25 = row39.createCell(23);row39Cell25.setCellValue(summaryCountData.get("ZXYYZY_ZFS").toString());row39Cell25.setCellStyle(cellStyle);XSSFCell row39Cell26 = row39.createCell(24);row39Cell26.setCellValue(summaryCountData.get("QHYYZY_ZFS").toString());row39Cell26.setCellStyle(cellStyle);XSSFCell row39Cell27 = row39.createCell(25);row39Cell27.setCellValue(summaryCountData.get("LKYYZY_ZFS").toString());row39Cell27.setCellStyle(cellStyle);XSSFCell row39Cell29 = row39.createCell(26);row39Cell29.setCellValue(summaryCountData.get("SHYYZY_ZFS").toString());row39Cell29.setCellStyle(cellStyle);XSSFCell row39Cell30 = row39.createCell(27);row39Cell30.setCellValue(summaryCountData.get("SHYYZY_KYMJ").toString());row39Cell30.setCellStyle(cellStyle);XSSFCell row39Cell31 = row39.createCell(28);row39Cell31.setCellValue(summaryCountData.get("JY_ZFS").toString());row39Cell31.setCellStyle(cellStyle);XSSFCell row39Cell32 = row39.createCell(29);row39Cell32.setCellValue(summaryCountData.get("LY_ZFS").toString());row39Cell32.setCellStyle(cellStyle);XSSFCell row39Cell33 = row39.createCell(30);row39Cell33.setCellValue(summaryCountData.get("XSY_MAN_ZFS").toString());row39Cell33.setCellStyle(cellStyle);XSSFCell row39Cell34 = row39.createCell(31);row39Cell34.setCellValue(summaryCountData.get("XSY_WOMAN_ZFS").toString());row39Cell34.setCellStyle(cellStyle);XSSFCell row39Cell35 = row39.createCell(32);row39Cell35.setCellValue(summaryCountData.get("ZF_DCS").toString());row39Cell35.setCellStyle(cellStyle);XSSFCell row39Cell36 = row39.createCell(33);row39Cell36.setCellValue(summaryCountData.get("SF_ZFS").toString());row39Cell36.setCellStyle(cellStyle);XSSFCell row39Cell37 = row39.createCell(34);row39Cell37.setCellValue(summaryCountData.get("JS_ZFS").toString());row39Cell37.setCellStyle(cellStyle);XSSFCell row39Cell38 = row39.createCell(35);row39Cell38.setCellValue(summaryCountData.get("SW_ZFS").toString());row39Cell38.setCellStyle(cellStyle);XSSFCell row39Cell39 = row39.createCell(36);row39Cell39.setCellValue(user.getRealName());row39Cell39.setCellStyle(cellStyle);XSSFCell row39Cell40 = row39.createCell(37);row39Cell40.setCellValue(time);row39Cell40.setCellStyle(cellStyle);XSSFCell row39Cell41 = row39.createCell(38);row39Cell41.setCellValue("罪犯数");row39Cell41.setCellStyle(cellStyle);//合计 合并XSSFRow row40 = sheet.createRow(currentLastRowIndex+size+2);XSSFCell row40Cell1 = row40.createCell(0);row40Cell1.setCellStyle(cellStyle);row40Cell1.setCellValue("");XSSFCell row40Cell2 = row40.createCell(1);row40Cell2.setCellStyle(cellStyle);row40Cell2.setCellValue("");XSSFCell row40Cell3 = row40.createCell(2);row40Cell3.setCellStyle(cellStyle);row40Cell3.setCellValue("");XSSFCell row40Cell4 = row40.createCell(3);row40Cell4.setCellStyle(cellStyle);row40Cell4.setCellValue("");XSSFCell row40Cell5 = row40.createCell(4);row40Cell5.setCellStyle(cellStyle);row40Cell5.setCellValue("");XSSFCell row40Cell6 = row40.createCell(5);row40Cell6.setCellStyle(cellStyle);row40Cell6.setCellValue("");XSSFCell row40Cell7 = row40.createCell(6);row40Cell7.setCellStyle(cellStyle);row40Cell7.setCellValue("");XSSFCell row40Cell8 = row40.createCell(7);row40Cell8.setCellStyle(cellStyle);row40Cell8.setCellValue("");XSSFCell row40Cell9 = row40.createCell(8);row40Cell9.setCellStyle(cellStyle);row40Cell9.setCellValue("");XSSFCell row40Cell10 = row40.createCell(9);row40Cell10.setCellStyle(cellStyle);row40Cell10.setCellValue("");XSSFCell row40Cell11 = row40.createCell(10);row40Cell11.setCellStyle(cellStyle);row40Cell11.setCellValue("");XSSFCell row40Cell12 = row40.createCell(11);row40Cell12.setCellStyle(cellStyle);row40Cell12.setCellValue("");XSSFCell row40Cell13 = row40.createCell(12);row40Cell13.setCellStyle(cellStyle);row40Cell13.setCellValue("");XSSFCell row40Cell14 = row40.createCell(13);row40Cell14.setCellStyle(cellStyle);row40Cell14.setCellValue("");XSSFCell row40Cell15 = row40.createCell(14);row40Cell15.setCellStyle(cellStyle);row40Cell15.setCellValue("");XSSFCell row40Cell16 = row40.createCell(15);row40Cell16.setCellStyle(cellStyle);row40Cell16.setCellValue("");XSSFCell row40Cell17 = row40.createCell(16);row40Cell17.setCellStyle(cellStyle);row40Cell17.setCellValue("");XSSFCell row40Cell19 = row40.createCell(17);row40Cell19.setCellValue(summaryCountData.get("ZC_JDS").toString());row40Cell19.setCellStyle(cellStyle);XSSFCell row40Cell20 = row40.createCell(18);row40Cell20.setCellValue(summaryCountData.get("SY_JDS").toString());row40Cell20.setCellStyle(cellStyle);XSSFCell row405Cell21 = row40.createCell(19);row405Cell21.setCellValue(summaryCountData.get("JHZS_JDS").toString());row405Cell21.setCellStyle(cellStyle);XSSFCell row40Cell22 = row40.createCell(20);row40Cell22.setCellValue(summaryCountData.get("JWZX_JDS").toString());row40Cell22.setCellStyle(cellStyle);XSSFCell row40Cell23 = row40.createCell(21);row40Cell23.setCellValue(summaryCountData.get("TXLJ_JDS").toString());row40Cell23.setCellStyle(cellStyle);XSSFCell row40Cell24 = row40.createCell(22);row40Cell24.setCellValue(summaryCountData.get("WCJY_JDS").toString());row40Cell24.setCellStyle(cellStyle);XSSFCell row40Cell25 = row40.createCell(23);row40Cell25.setCellValue(summaryCountData.get("ZXYYZY_JDS").toString());row40Cell25.setCellStyle(cellStyle);XSSFCell row40Cell26 = row40.createCell(24);row40Cell26.setCellValue(summaryCountData.get("QHYYZY_JDS").toString());row40Cell26.setCellStyle(cellStyle);XSSFCell row40Cell27 = row40.createCell(25);row40Cell27.setCellValue(summaryCountData.get("LKYYZY_JDS").toString());row40Cell27.setCellStyle(cellStyle);XSSFCell row40Cell29 = row40.createCell(26);row40Cell29.setCellValue(summaryCountData.get("SHYYZY_JDS").toString());row40Cell29.setCellStyle(cellStyle);XSSFCell row40Cell30 = row40.createCell(27);row40Cell30.setCellValue(summaryCountData.get("SHYYZY_JDKYMJ").toString());row40Cell30.setCellStyle(cellStyle);XSSFCell row40Cell31 = row40.createCell(28);row40Cell31.setCellValue(summaryCountData.get("JY_JDS").toString());row40Cell31.setCellStyle(cellStyle);XSSFCell row40Cell32 = row40.createCell(29);row40Cell32.setCellValue(summaryCountData.get("LY_JDS").toString());row40Cell32.setCellStyle(cellStyle);XSSFCell row40Cell33 = row40.createCell(30);row40Cell33.setCellValue(summaryCountData.get("XSY_MAN_JDS").toString());row40Cell33.setCellStyle(cellStyle);XSSFCell row40Cell34 = row40.createCell(31);row40Cell34.setCellValue(summaryCountData.get("XSY_WOMAN_JDS").toString());row40Cell34.setCellStyle(cellStyle);XSSFCell row40Cell35 = row40.createCell(32);row40Cell35.setCellValue(summaryCountData.get("DC_JDS").toString());row40Cell35.setCellStyle(cellStyle);XSSFCell row40Cell36 = row40.createCell(33);row40Cell36.setCellValue(summaryCountData.get("SF_JDS").toString());row40Cell36.setCellStyle(cellStyle);XSSFCell row40Cell37 = row40.createCell(34);row40Cell37.setCellValue(summaryCountData.get("JS_JDS").toString());row40Cell37.setCellStyle(cellStyle);XSSFCell row40Cell38 = row40.createCell(35);row40Cell38.setCellValue(summaryCountData.get("SW_JDS").toString());row40Cell38.setCellStyle(cellStyle);XSSFCell row40Cell39 = row40.createCell(36);row40Cell39.setCellStyle(cellStyle);row40Cell39.setCellValue("");XSSFCell row40Cell40 = row40.createCell(37);row40Cell40.setCellStyle(cellStyle);row40Cell40.setCellValue("");XSSFCell row40Cell41 = row40.createCell(38);row40Cell41.setCellStyle(cellStyle);row40Cell41.setCellValue("戒毒数");//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 0, 0);sheet.addMergedRegion(region);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region2 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 1, 1);sheet.addMergedRegion(region2);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region3 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 2, 2);sheet.addMergedRegion(region3);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region4 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 3, 3);sheet.addMergedRegion(region4);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region5 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 4, 4);sheet.addMergedRegion(region5);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region6 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 5, 5);sheet.addMergedRegion(region6);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region7 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 6, 6);sheet.addMergedRegion(region7);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region8 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 36, 36);sheet.addMergedRegion(region8);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region9 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 37, 37);sheet.addMergedRegion(region9);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region10 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 7, 7);sheet.addMergedRegion(region10);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region11 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 8, 8);sheet.addMergedRegion(region11);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region12 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 9, 9);sheet.addMergedRegion(region12);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region13 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 10, 10);sheet.addMergedRegion(region13);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region14 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 11, 11);sheet.addMergedRegion(region14);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region15 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 12, 12);sheet.addMergedRegion(region15);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region16 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 13, 13);sheet.addMergedRegion(region16);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region17 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 14, 14);sheet.addMergedRegion(region17);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region18 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 15, 15);sheet.addMergedRegion(region18);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region19 = new CellRangeAddress(currentLastRowIndex+size+1, currentLastRowIndex+size+2, 16, 16);sheet.addMergedRegion(region19);//设置字体大小、加粗  样式XSSFCellStyle cellStyle2 = workBook.createCellStyle();Font font2=workBook.createFont();font2.setFontName("宋体");//宋体font2.setFontHeightInPoints((short)12);//字号font2.setBold(false);//加粗 否cellStyle2.setFont(font2);cellStyle2.setAlignment(HorizontalAlignment.LEFT);//水平居中cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中XSSFRow row41 = sheet.createRow(currentLastRowIndex+size+2+2);XSSFCell row41Cell18 = row41.createCell(17);row41Cell18.setCellStyle(cellStyle2);row41Cell18.setCellValue("校验公式一:实押数=在册数-解回再审数-监/所外执行数-特许离监/所数-外出就医数-局内医院住院数-社会医院住院数-寄押(除住院)+临押(除住院)");XSSFCell row41Cell19 = row41.createCell(18);row41Cell19.setCellStyle(cellStyle2);XSSFCell row41Cell20 = row41.createCell(19);row41Cell20.setCellStyle(cellStyle2);XSSFCell row41Cell21 = row41.createCell(20);row41Cell21.setCellStyle(cellStyle2);XSSFCell row41Cell22 = row41.createCell(21);row41Cell22.setCellStyle(cellStyle2);XSSFCell row41Cell23 = row41.createCell(22);row41Cell23.setCellStyle(cellStyle2);XSSFCell row41Cell24 = row41.createCell(23);row41Cell24.setCellStyle(cellStyle2);XSSFCell row41Cell25 = row41.createCell(24);row41Cell25.setCellStyle(cellStyle2);XSSFCell row41Cell26 = row41.createCell(25);row41Cell26.setCellStyle(cellStyle2);XSSFCell row41Cell27 = row41.createCell(26);row41Cell27.setCellStyle(cellStyle2);XSSFCell row41Cell28 = row41.createCell(27);row41Cell28.setCellStyle(cellStyle2);XSSFCell row41Cell29 = row41.createCell(28);row41Cell29.setCellStyle(cellStyle2);XSSFCell row41Cell30 = row41.createCell(29);row41Cell30.setCellStyle(cellStyle2);XSSFCell row41Cell31 = row41.createCell(30);row41Cell31.setCellStyle(cellStyle2);XSSFCell row41Cell32 = row41.createCell(31);row41Cell32.setCellStyle(cellStyle2);XSSFCell row41Cell33 = row41.createCell(32);row41Cell33.setCellStyle(cellStyle2);XSSFCell row41Cell34 = row41.createCell(33);row41Cell34.setCellStyle(cellStyle2);XSSFCell row41Cell35 = row41.createCell(34);row41Cell35.setCellStyle(cellStyle2);XSSFCell row41Cell36 = row41.createCell(35);row41Cell36.setCellStyle(cellStyle2);XSSFCell row41Cell37 = row41.createCell(36);row41Cell37.setCellStyle(cellStyle2);XSSFCell row41Cell38 = row41.createCell(37);row41Cell38.setCellStyle(cellStyle2);XSSFCell row41Cell39 = row41.createCell(38);row41Cell39.setCellStyle(cellStyle2);XSSFRow row42 = sheet.createRow(currentLastRowIndex+size+2+3);XSSFCell row42Cell18 = row42.createCell(17);row42Cell18.setCellStyle(cellStyle2);XSSFCell row42Cell19 = row42.createCell(18);row42Cell19.setCellStyle(cellStyle2);XSSFCell row42Cell20 = row42.createCell(19);row42Cell20.setCellStyle(cellStyle2);XSSFCell row42Cell21 = row42.createCell(20);row42Cell21.setCellStyle(cellStyle2);XSSFCell row42Cell22 = row42.createCell(21);row42Cell22.setCellStyle(cellStyle2);XSSFCell row42Cell23 = row42.createCell(22);row42Cell23.setCellStyle(cellStyle2);XSSFCell row42Cell24 = row42.createCell(23);row42Cell24.setCellStyle(cellStyle2);XSSFCell row42Cell25 = row42.createCell(24);row42Cell25.setCellStyle(cellStyle2);XSSFCell row42Cell26 = row42.createCell(25);row42Cell26.setCellStyle(cellStyle2);XSSFCell row42Cell27 = row42.createCell(26);row42Cell27.setCellStyle(cellStyle2);XSSFCell row42Cell28 = row42.createCell(27);row42Cell28.setCellStyle(cellStyle2);XSSFCell row42Cell29 = row42.createCell(28);row42Cell29.setCellStyle(cellStyle2);XSSFCell row42Cell30 = row42.createCell(29);row42Cell30.setCellStyle(cellStyle2);XSSFCell row42Cell31 = row42.createCell(30);row42Cell31.setCellStyle(cellStyle2);XSSFCell row42Cell32 = row42.createCell(31);row42Cell32.setCellStyle(cellStyle2);XSSFCell row42Cell33 = row42.createCell(32);row42Cell33.setCellStyle(cellStyle2);XSSFCell row42Cell34 = row42.createCell(33);row42Cell34.setCellStyle(cellStyle2);XSSFCell row42Cell35 = row42.createCell(34);row42Cell35.setCellStyle(cellStyle2);XSSFCell row42Cell36 = row42.createCell(35);row42Cell36.setCellStyle(cellStyle2);XSSFCell row42Cell37 = row42.createCell(36);row42Cell37.setCellStyle(cellStyle2);XSSFCell row42Cell38 = row42.createCell(37);row42Cell38.setCellStyle(cellStyle2);XSSFCell row42Cell39 = row42.createCell(38);row42Cell39.setCellStyle(cellStyle2);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region20 = new CellRangeAddress(currentLastRowIndex+size+2+2, currentLastRowIndex+size+2+3, 17, 38);sheet.addMergedRegion(region20);XSSFRow row43 = sheet.createRow(currentLastRowIndex+size+2+4);XSSFCell row43Cell18 = row43.createCell(17);row43Cell18.setCellStyle(cellStyle2);row43Cell18.setCellValue("校验公式二:在册数(今日)=在册数(昨日)+新收押数-调出数-释放/解除数-假释数-死亡数");XSSFCell row43Cell19 = row43.createCell(18);row43Cell19.setCellStyle(cellStyle2);XSSFCell row43Cell20 = row43.createCell(19);row43Cell20.setCellStyle(cellStyle2);XSSFCell row43Cell21 = row43.createCell(20);row43Cell21.setCellStyle(cellStyle2);XSSFCell row43Cell22 = row43.createCell(21);row43Cell22.setCellStyle(cellStyle2);XSSFCell row43Cell23 = row43.createCell(22);row43Cell23.setCellStyle(cellStyle2);XSSFCell row43Cell24 = row43.createCell(23);row43Cell24.setCellStyle(cellStyle2);XSSFCell row43Cell25 = row43.createCell(24);row43Cell25.setCellStyle(cellStyle2);XSSFCell row43Cell26 = row43.createCell(25);row43Cell26.setCellStyle(cellStyle2);XSSFCell row43Cell27 = row43.createCell(26);row43Cell27.setCellStyle(cellStyle2);XSSFCell row43Cell28 = row43.createCell(27);row43Cell28.setCellStyle(cellStyle2);XSSFCell row43Cell29 = row43.createCell(28);row43Cell29.setCellStyle(cellStyle2);XSSFCell row43Cell30 = row43.createCell(29);row43Cell30.setCellStyle(cellStyle2);XSSFCell row43Cell31 = row43.createCell(30);row43Cell31.setCellStyle(cellStyle2);XSSFCell row43Cell32 = row43.createCell(31);row43Cell32.setCellStyle(cellStyle2);XSSFCell row43Cell33 = row43.createCell(32);row43Cell33.setCellStyle(cellStyle2);XSSFCell row43Cell34 = row43.createCell(33);row43Cell34.setCellStyle(cellStyle2);XSSFCell row43Cell35 = row43.createCell(34);row43Cell35.setCellStyle(cellStyle2);XSSFCell row43Cell36 = row43.createCell(35);row43Cell36.setCellStyle(cellStyle2);XSSFCell row43Cell37 = row43.createCell(36);row43Cell37.setCellStyle(cellStyle2);XSSFCell row43Cell38 = row43.createCell(37);row43Cell38.setCellStyle(cellStyle2);XSSFCell row43Cell39 = row43.createCell(38);row43Cell39.setCellStyle(cellStyle2);XSSFRow row44 = sheet.createRow(currentLastRowIndex+size+2+5);XSSFCell row44Cell18 = row44.createCell(17);row44Cell18.setCellStyle(cellStyle2);XSSFCell row44Cell19 = row44.createCell(18);row44Cell19.setCellStyle(cellStyle2);XSSFCell row44Cell20 = row44.createCell(19);row44Cell20.setCellStyle(cellStyle2);XSSFCell row44Cell21 = row44.createCell(20);row44Cell21.setCellStyle(cellStyle2);XSSFCell row44Cell22 = row44.createCell(21);row44Cell22.setCellStyle(cellStyle2);XSSFCell row44Cell23 = row44.createCell(22);row44Cell23.setCellStyle(cellStyle2);XSSFCell row44Cell24 = row44.createCell(23);row44Cell24.setCellStyle(cellStyle2);XSSFCell row44Cell25 = row44.createCell(24);row44Cell25.setCellStyle(cellStyle2);XSSFCell row44Cell26 = row44.createCell(25);row44Cell26.setCellStyle(cellStyle2);XSSFCell row44Cell27 = row44.createCell(26);row44Cell27.setCellStyle(cellStyle2);XSSFCell row44Cell28 = row44.createCell(27);row44Cell28.setCellStyle(cellStyle2);XSSFCell row44Cell29 = row44.createCell(28);row44Cell29.setCellStyle(cellStyle2);XSSFCell row44Cell30 = row44.createCell(29);row44Cell30.setCellStyle(cellStyle2);XSSFCell row44Cell31 = row44.createCell(30);row44Cell31.setCellStyle(cellStyle2);XSSFCell row44Cell32 = row44.createCell(31);row44Cell32.setCellStyle(cellStyle2);XSSFCell row44Cell33 = row44.createCell(32);row44Cell33.setCellStyle(cellStyle2);XSSFCell row44Cell34 = row44.createCell(33);row44Cell34.setCellStyle(cellStyle2);XSSFCell row44Cell35 = row44.createCell(34);row44Cell35.setCellStyle(cellStyle2);XSSFCell row44Cell36 = row44.createCell(35);row44Cell36.setCellStyle(cellStyle2);XSSFCell row44Cell37 = row44.createCell(36);row44Cell37.setCellStyle(cellStyle2);XSSFCell row44Cell38 = row44.createCell(37);row44Cell38.setCellStyle(cellStyle2);XSSFCell row44Cell39 = row44.createCell(38);row44Cell39.setCellStyle(cellStyle2);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region21 = new CellRangeAddress(currentLastRowIndex+size+2+4, currentLastRowIndex+size+2+5, 17, 38);sheet.addMergedRegion(region21);XSSFRow row45 = sheet.createRow(currentLastRowIndex+size+2+6);XSSFCell row45Cell18 = row45.createCell(17);row45Cell18.setCellStyle(cellStyle2);row45Cell18.setCellValue("校验公式三:今日在册数+今日释放数=昨日在册数");XSSFCell row45Cell19 = row45.createCell(18);row45Cell19.setCellStyle(cellStyle2);XSSFCell row45Cell20 = row45.createCell(19);row45Cell20.setCellStyle(cellStyle2);XSSFCell row45Cell21 = row45.createCell(20);row45Cell21.setCellStyle(cellStyle2);XSSFCell row45Cell22 = row45.createCell(21);row45Cell22.setCellStyle(cellStyle2);XSSFCell row45Cell23 = row45.createCell(22);row45Cell23.setCellStyle(cellStyle2);XSSFCell row45Cell24 = row45.createCell(23);row45Cell24.setCellStyle(cellStyle2);XSSFCell row45Cell25 = row45.createCell(24);row45Cell25.setCellStyle(cellStyle2);XSSFCell row45Cell26 = row45.createCell(25);row45Cell26.setCellStyle(cellStyle2);XSSFCell row45Cell27 = row45.createCell(26);row45Cell27.setCellStyle(cellStyle2);XSSFCell row45Cell28 = row45.createCell(27);row45Cell28.setCellStyle(cellStyle2);XSSFCell row45Cell29 = row45.createCell(28);row45Cell29.setCellStyle(cellStyle2);XSSFCell row45Cell30 = row45.createCell(29);row45Cell30.setCellStyle(cellStyle2);XSSFCell row45Cell31 = row45.createCell(30);row45Cell31.setCellStyle(cellStyle2);XSSFCell row45Cell32 = row45.createCell(31);row45Cell32.setCellStyle(cellStyle2);XSSFCell row45Cell33 = row45.createCell(32);row45Cell33.setCellStyle(cellStyle2);XSSFCell row45Cell34 = row45.createCell(33);row45Cell34.setCellStyle(cellStyle2);XSSFCell row45Cell35 = row45.createCell(34);row45Cell35.setCellStyle(cellStyle2);XSSFCell row45Cell36 = row45.createCell(35);row45Cell36.setCellStyle(cellStyle2);XSSFCell row45Cell37 = row45.createCell(36);row45Cell37.setCellStyle(cellStyle2);XSSFCell row45Cell38 = row45.createCell(37);row45Cell38.setCellStyle(cellStyle2);XSSFCell row45Cell39 = row45.createCell(38);row45Cell39.setCellStyle(cellStyle2);XSSFRow row46 = sheet.createRow(currentLastRowIndex+size+2+7);XSSFCell row46Cell18 = row46.createCell(17);row46Cell18.setCellStyle(cellStyle2);XSSFCell row46Cell19 = row46.createCell(18);row46Cell19.setCellStyle(cellStyle2);XSSFCell row46Cell20 = row46.createCell(19);row46Cell20.setCellStyle(cellStyle2);XSSFCell row46Cell21 = row46.createCell(20);row46Cell21.setCellStyle(cellStyle2);XSSFCell row46Cell22 = row46.createCell(21);row46Cell22.setCellStyle(cellStyle2);XSSFCell row46Cell23 = row46.createCell(22);row46Cell23.setCellStyle(cellStyle2);XSSFCell row46Cell24 = row46.createCell(23);row46Cell24.setCellStyle(cellStyle2);XSSFCell row46Cell25 = row46.createCell(24);row46Cell25.setCellStyle(cellStyle2);XSSFCell row46Cell26 = row46.createCell(25);row46Cell26.setCellStyle(cellStyle2);XSSFCell row46Cell27 = row46.createCell(26);row46Cell27.setCellStyle(cellStyle2);XSSFCell row46Cell28 = row46.createCell(27);row46Cell28.setCellStyle(cellStyle2);XSSFCell row46Cell29 = row46.createCell(28);row46Cell29.setCellStyle(cellStyle2);XSSFCell row46Cell30 = row46.createCell(29);row46Cell30.setCellStyle(cellStyle2);XSSFCell row46Cell31 = row46.createCell(30);row46Cell31.setCellStyle(cellStyle2);XSSFCell row46Cell32 = row46.createCell(31);row46Cell32.setCellStyle(cellStyle2);XSSFCell row46Cell33 = row46.createCell(32);row46Cell33.setCellStyle(cellStyle2);XSSFCell row46Cell34 = row46.createCell(33);row46Cell34.setCellStyle(cellStyle2);XSSFCell row46Cell35 = row46.createCell(34);row46Cell35.setCellStyle(cellStyle2);XSSFCell row46Cell36 = row46.createCell(35);row46Cell36.setCellStyle(cellStyle2);XSSFCell row46Cell37 = row46.createCell(36);row46Cell37.setCellStyle(cellStyle2);XSSFCell row46Cell38 = row46.createCell(37);row46Cell38.setCellStyle(cellStyle2);XSSFCell row46Cell39 = row46.createCell(38);row46Cell39.setCellStyle(cellStyle2);//合并第1列 中的currentLastRowIndex+size+1和currentLastRowIndex+size+2行CellRangeAddress region22 = new CellRangeAddress(currentLastRowIndex+size+2+6, currentLastRowIndex+size+2+7, 17, 38);sheet.addMergedRegion(region22);//设置行高 行高设置30row39.setHeightInPoints(30);row40.setHeightInPoints(30);return workBook;}
private void marginSjExcelCell(XSSFSheet sheet,Integer currentLastRowIndex,Integer sjNum,Integer sj){//合并 市局记录 第8列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+m+n行CellRangeAddress region = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 7, 7);sheet.addMergedRegion(region);//合并 市局记录第9列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region2 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 8, 8);sheet.addMergedRegion(region2);//合并 市局记录第11列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region3 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 10, 10);sheet.addMergedRegion(region3);//合并 市局记录第12列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region4 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 11, 11);sheet.addMergedRegion(region4);//合并 市局记录第14列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region5 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 13, 13);sheet.addMergedRegion(region5);//合并 市局记录第37列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region6 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 36, 36);sheet.addMergedRegion(region6);//合并 市局记录第38列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region7 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 37, 37);sheet.addMergedRegion(region7);//合并 市局记录第39列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+sjNum+n行CellRangeAddress region8 = new CellRangeAddress(currentLastRowIndex+1+sjNum, currentLastRowIndex+1+sjNum+sj-1, 38, 38);sheet.addMergedRegion(region8);}private void marginFjExcelCell(XSSFSheet sheet,Integer currentLastRowIndex,Integer fjNum,Integer fj){//合并 分局记录 第6列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+m+n行CellRangeAddress region9 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 5, 5);sheet.addMergedRegion(region9);//合并 分局记录 第7列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region10 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 6, 6);sheet.addMergedRegion(region10);//合并 分局记录 第8列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region11 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 7, 7);sheet.addMergedRegion(region11);//合并 分局记录 第9列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region12 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 8, 8);sheet.addMergedRegion(region12);//合并 分局记录 第11列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region13 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 10, 10);sheet.addMergedRegion(region13);//合并 分局记录 第12列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region14 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 11, 11);sheet.addMergedRegion(region14);//合并 分局记录 第14列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region15 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1-2, 13, 13);sheet.addMergedRegion(region15);//合并 分局记录 第15列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region16 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 14, 14);sheet.addMergedRegion(region16);//合并 分局记录 第16列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region17 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 15, 15);sheet.addMergedRegion(region17);//合并 分局记录 第17列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region18 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 16, 16);sheet.addMergedRegion(region18);//合并 分局记录 第37列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region19 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 36, 36);sheet.addMergedRegion(region19);//合并 分局记录 第38列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region20 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 37, 37);sheet.addMergedRegion(region20);//合并 分局记录 第39列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+fjNum+n行CellRangeAddress region21 = new CellRangeAddress(currentLastRowIndex+1+fjNum, currentLastRowIndex+1+fjNum+fj-1, 38, 38);sheet.addMergedRegion(region21);}private void marginXkExcelCell(XSSFSheet sheet,Integer currentLastRowIndex,Integer xkNum,Integer xk){//合并 新康记录 第1列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+m+n行CellRangeAddress region22 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 0, 0);sheet.addMergedRegion(region22);//合并 新康记录 第2列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region23 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 1, 1);sheet.addMergedRegion(region23);//合并 新康记录 第3列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region24 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 2, 2);sheet.addMergedRegion(region24);//合并 新康记录 第4列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region25 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 3, 3);sheet.addMergedRegion(region25);//合并 新康记录 第5列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region26 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 4, 4);sheet.addMergedRegion(region26);//合并 新康记录 第6列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region27 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 5, 5);sheet.addMergedRegion(region27);//合并 新康记录 第7列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region28 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 6, 6);sheet.addMergedRegion(region28);//合并 新康记录 第8列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region29 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 7, 7);sheet.addMergedRegion(region29);//合并 新康记录 第9列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region30 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 8, 8);sheet.addMergedRegion(region30);//合并 新康记录 第10列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region31 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 9, 9);sheet.addMergedRegion(region31);//合并 新康记录 第11列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region32 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 10, 10);sheet.addMergedRegion(region32);//合并 新康记录 第12列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region33 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 11, 11);sheet.addMergedRegion(region33);//合并 新康记录 第13列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region34 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 12, 12);sheet.addMergedRegion(region34);//合并 新康记录 第14列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region35 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 13, 13);sheet.addMergedRegion(region35);//合并 新康记录 第15列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region36 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 14, 14);sheet.addMergedRegion(region36);//合并 新康记录 第16列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region37 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 15, 15);sheet.addMergedRegion(region37);//合并 新康记录 第17列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region38 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 16, 16);sheet.addMergedRegion(region38);//合并 新康记录 第37列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region39 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 36, 36);sheet.addMergedRegion(region39);//合并 新康记录 第38列 中的currentLastRowIndex+1+m和currentLastRowIndex+1+xkNum+n行CellRangeAddress region40 = new CellRangeAddress(currentLastRowIndex+1+xkNum-1, currentLastRowIndex+1+xkNum+xk-2, 37, 37);sheet.addMergedRegion(region40);}

Java使用poi加载Excel模板,将查询出来的数据封装到Excel中并进行指定某些列的合并操作相关推荐

  1. Java类的加载过程详解 面试高频!!!值得收藏!!!

    受多种情况的影响,又开始看JVM 方面的知识. 1.Java 实在过于内卷,没法不往深了学. 2.面试题问的多,被迫学习. 3.纯粹的好奇. 很喜欢一句话: 八小时内谋生活,八小时外谋发展. 望别日与 ...

  2. Java实现动态加载页面_[Java教程]动态加载页面数据的小工具 javascript + jQuery (持续更新)...

    [Java教程]动态加载页面数据的小工具 javascript + jQuery (持续更新) 0 2014-05-07 18:00:06 使用该控件,可以根据url,参数,加载html记录模板(包含 ...

  3. 这篇文章绝对让你深刻理解java类的加载以及ClassLoader源码分析

    前言 package com.jvm.classloader;class Father2{public static String strFather="HelloJVM_Father&qu ...

  4. 初识jvm-1.Java类的加载机制

    转载: jvm系列---纯洁的微笑 地址: http://www.ityouknow.com/jvm.html 1.什么是类的加载 类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其 ...

  5. java虚拟机规范-加载、链接与初始化

    前言 java虚拟机是java跨平台的基石,本文的描述以jdk7.0为准,其他版本可能会有一些微调.java代码本身并不能为jvm识别,实际上在jvm中的表现形式为Class对象,一个java类从字节 ...

  6. Java深度历险(二)——Java类的加载、链接和初始化

    在上一篇文章中介绍了Java字节代码的操纵,其中提到了利用Java类加载器来加载修改过后的字节代码并在JVM上执行.本文接着上一篇的话题,讨论Java类的加载.链接和初始化.Java字节代码的表现形式 ...

  7. 28 Java类的加载机制、什么是类的加载、类的生命周期、加载:查找并加载类的二进制数据、连接、初始化、类加载器、双亲委派模型、自定义类加载器

    28Java类的加载机制 28.1.什么是类的加载 28.2.类的生命周期 28.2.1.加载:查找并加载类的二进制数据 28.2.2.连接 28.2.3.初始化 28.3.类加载器 28.4.类的加 ...

  8. jvm系列(一):java类的加载机制

    1.什么是类的加载 类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后在堆区创建一个 java.lang.Class对象,用来封装类在方法区内的数据结 ...

  9. java类的加载机制

    一.什么是类的加载 类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后在堆区创建一个java.lang.Class对象,用来封装类在方法区内的数据结构 ...

最新文章

  1. springweb拦截器
  2. canal 监听不到数据变化_数据的异构实战(二)手写迷你版同步工程
  3. Python基础教程:为元组中的每一个元素命名
  4. P4884-多少个1?【BSGS】
  5. 【离散数学】代数系统的同态(同构)
  6. 微服务系统下架构可视化上的探索
  7. 鼎利软件测试终端刷机,世纪鼎利pioneer连接移动平台进行volte测试操作说明.doc...
  8. linux安装mysql_Linux学习笔记-安装MySQL
  9. 微信公众号定位显示EC-01G模组+STM32F103
  10. 机械革命计算机配置,机械革命笔记本Bios设置方法
  11. DevOps和SRE
  12. 7---可变参数+Collections集合工具类+冒泡排序+Map集合
  13. 国外香港云计算服务器评测,UCLOUD云计算活动及体验香港云主机综合评测记录
  14. 让行动持续下去的动力-《刻意练习》读后感
  15. [Luogu P3613] 睡觉困难综合征
  16. 【神经网络第三期】RBF神经网络基本原理和模型应用
  17. C# winform设置开机启动
  18. Python计算机视觉编程第一章 基本的图像操作与处理
  19. 在数据库插入大量不同数据
  20. 如何用企业微信SCRM系统解决离职员工带走客户信息的问题

热门文章

  1. 前端实现XLSX文件下载
  2. 江苏警官学院计算机技术,江苏警官学院公安科技系简介
  3. 判断一个数组是否有序
  4. EasySwoole教程
  5. 0114 vi和vim
  6. 转载:设计资料 - 百科秘密
  7. 面试搜狗C语言职位实记
  8. 分享 | 数字图像处理:边缘检测(Edge detection)
  9. Android 集成zxing二维码扫描、自定义
  10. Pytorch实现Top1准确率和Top5准确率