| | |
| | | |
| | | private List<byte[]> bytes; |
| | | private String excelName = "Echarts"; |
| | | private int rowNumAdd=27; |
| | | |
| | | //文件导出 |
| | | public void exportExcel( HttpServletRequest req, HttpServletResponse resp) { |
| | |
| | | sheet1.createRow(rownum); |
| | | sheet1.getRow(rownum).createCell(1).setCellValue( "报告日期:"); |
| | | sheet1.getRow(rownum).createCell(2).setCellValue(formartDate(new Date(),"yyyy-MM-dd HH:mm:ss")); |
| | | rownum+=2; |
| | | rownum+=4; |
| | | |
| | | int picnum = 0; |
| | | String[] picName = new String[]{ |
| | | "单体电压曲线图","端电压曲线图","单体电流曲线图","单体实际容量柱状图" |
| | | }; |
| | | for(int i=0;i<picName.length;i++){ |
| | | sheet1.createRow(rownum); |
| | | sheet1.getRow(rownum).createCell(1).setCellValue(picName[i]); |
| | | sheet1.createRow(rownum-1); |
| | | sheet1.getRow(rownum-1).createCell(1).setCellValue(picName[i]); |
| | | //rownum++; |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, 25 * (picnum + 1)); |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, rowNumAdd * (picnum + 1)); |
| | | anchor.setAnchorType(3); |
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(picnum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | picnum ++;rownum+=27; |
| | | picnum ++;rownum+=rowNumAdd; |
| | | } |
| | | |
| | | createNewLD9DataSheet(wb,montestdata); |
| | |
| | | sheet1.createRow(rownum); |
| | | sheet1.getRow(rownum).createCell(1).setCellValue( "报告日期:"); |
| | | sheet1.getRow(rownum).createCell(2).setCellValue(formartDate(new Date(),"yyyy-MM-dd HH:mm:ss")); |
| | | rownum+=2; |
| | | rownum+=4; |
| | | |
| | | int picnum = 0; |
| | | |
| | | for(int i=0;i<picName.length;i++){ |
| | | sheet1.createRow(rownum); |
| | | sheet1.getRow(rownum).createCell(1).setCellValue(picName[i]); |
| | | sheet1.createRow(rownum-1); |
| | | sheet1.getRow(rownum-1).createCell(1).setCellValue(picName[i]); |
| | | //rownum++; |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, 25 * (picnum + 1)); |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, rowNumAdd * (picnum + 1)); |
| | | anchor.setAnchorType(3); |
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(picnum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | picnum ++;rownum+=27; |
| | | picnum ++;rownum+=rowNumAdd; |
| | | } |
| | | |
| | | /*sheet1.createRow(rownum); |
| | |
| | | "节约电费统计折线图","电价分布图" |
| | | }; |
| | | for(int i=0;i<picName.length;i++){ |
| | | sheet.createRow(rowNum); |
| | | sheet.getRow(rowNum).createCell(0).setCellValue(picName[i]); |
| | | sheet.createRow(rowNum-1); |
| | | sheet.getRow(rowNum-1).createCell(0).setCellValue(picName[i]); |
| | | //rowNum++; |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+25); |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+rowNumAdd); |
| | | anchor.setAnchorType(3); |
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | picNum ++;rowNum+=27; |
| | | picNum ++;rowNum+=rowNumAdd; |
| | | } |
| | | |
| | | rowNum++; |