| | |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.hssf.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFDrawing; |
| | | import org.apache.poi.xssf.usermodel.XSSFRow; |
| | | import org.apache.poi.xssf.usermodel.XSSFSheet; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import sun.misc.BASE64Decoder; |
| | | import testElectronJ.util.ServletUtils; |
| | |
| | | //当前日期 |
| | | String nowFormat = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); |
| | | String excelName = "FBX-"+nowFormat; |
| | | HSSFWorkbook wb = new HSSFWorkbook(); |
| | | |
| | | HSSFSheet sheet = wb.createSheet("数据总表"); |
| | | |
| | | //HSSFWorkbook wb = new HSSFWorkbook(); |
| | | //HSSFSheet sheet = wb.createSheet("数据总表"); |
| | | XSSFWorkbook wb = new XSSFWorkbook(); |
| | | XSSFSheet sheet = wb.createSheet("数据总表"); |
| | | //图片元素 |
| | | HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); |
| | | |
| | | //字体格式-加粗 |
| | | HSSFCellStyle cellStyle = wb.createCellStyle(); |
| | | HSSFFont font = wb.createFont(); |
| | | font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
| | | cellStyle.setFont(font); |
| | | //HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); |
| | | XSSFDrawing patriarch = sheet.createDrawingPatriarch(); |
| | | ////字体格式-加粗 |
| | | //HSSFCellStyle cellStyle = wb.createCellStyle(); |
| | | //HSSFFont font = wb.createFont(); |
| | | //font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
| | | //cellStyle.setFont(font); |
| | | |
| | | int rowNumSheet = 0; |
| | | FboDataHeadStart start = fboDataInf.fboDataStart; |
| | |
| | | } |
| | | } |
| | | |
| | | HSSFSheet sheet1 = wb.createSheet("数据"); |
| | | XSSFSheet sheet1 = wb.createSheet("数据"); |
| | | //新建行 |
| | | |
| | | //抬头 |
| | | int rowNum = 0; |
| | | HSSFRow rowTitle = sheet1.createRow(rowNum); |
| | | HSSFCell cellTitle = rowTitle.createCell(0); |
| | | cellTitle.setCellValue("测试数据"); |
| | | cellTitle.setCellStyle(cellStyle); |
| | | sheet1.createRow(rowNum).createCell(0).setCellValue("测试数据"); |
| | | rowNum++; |
| | | |
| | | |
| | |
| | | |
| | | //属性栏 |
| | | String[] rowName = getRowName(start.DataType); |
| | | HSSFRow row = sheet1.createRow(rowNum); |
| | | XSSFRow row = sheet1.createRow(rowNum); |
| | | for (int i=0;i<rowName.length;i++){ |
| | | row.createCell(i).setCellValue(rowName[i]); |
| | | } |