| | |
| | | String excelName = "FBX-"+nowFormat; |
| | | HSSFWorkbook wb = new HSSFWorkbook(); |
| | | |
| | | HSSFSheet sheet = wb.createSheet("图表"); |
| | | HSSFSheet sheet = wb.createSheet("数据总览"); |
| | | |
| | | //图片元素 |
| | | HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); |
| | |
| | | cellStyle.setFont(font); |
| | | |
| | | int rowNumSheet = 0; |
| | | FboDataHeadStart start = fboDataInf.fboDataStart; |
| | | sheet.createRow(rowNumSheet); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池组名称:"+start.battNameStr); |
| | | rowNumSheet++; |
| | | sheet.createRow(rowNumSheet); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池品牌:"+start.battBrandStr); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("安装日期:"+start.batt_date_str); |
| | | sheet.getRow(rowNumSheet).createCell(2).setCellValue("单体数量:"+start.batt_mon_num); |
| | | rowNumSheet++; |
| | | sheet.createRow(rowNumSheet); |
| | | //sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池品牌:"+formartDate(,"yyyy-MM-dd")); |
| | | //sheet.getRow(rowNumSheet).createCell(1).setCellValue("安装日期:"+start.batt_date_str); |
| | | //sheet.getRow(rowNumSheet).createCell(2).setCellValue("单体数量:"+start.batt_mon_num); |
| | | rowNumSheet+=2; |
| | | //插入图片 |
| | | int picNum = 0; |
| | |
| | | cellTitle.setCellStyle(cellStyle); |
| | | rowNum++; |
| | | |
| | | FboDataHeadStart start = fboDataInf.fboDataStart; |
| | | HSSFRow rowHand = sheet1.createRow(rowNum); |
| | | rowHand.createCell(0).setCellValue("电池名称:"); |
| | | rowHand.createCell(1).setCellValue(start.battNameStr); |
| | | rowHand.createCell(2).setCellValue("电池品牌:"); |
| | | rowHand.createCell(3).setCellValue(start.battBrandStr); |
| | | rowNum++; |
| | | |
| | | |
| | | |
| | | //属性栏 |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将日期格式转换成指定的字符串格式 |
| | | * @param date 日期 |
| | | * @param str 字符串的格式 |
| | | * @return |
| | | */ |
| | | public String formartDate(Date date, String str){ |
| | | return new SimpleDateFormat(str).format(date); |
| | | } |
| | | |
| | | |
| | | } |