XSSFCellStyle style = workbook.createCellStyle(); style.setBorderTop((short) 6); // double lines border style.setBorderBottom((short) 1); // single line border XSSFFont font = workbook.createFont(); font.setFontHeightInPoints((short) 15); font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD); style.setFont(font); Row row = sheet.createRow(0); Cell cell0 = row.createCell(0); cell0.setCellValue("Nav Value"); cell0.setCellStyle(style); for(int j = 0; j<=3; j++) row.getCell(j).setCellStyle(style);
private void fillHeaderRow(XSSFWorkbook xssfWorkbook, XSSFSheet sheet, Integer rowNum, Locale locale) { XSSFRow headerLine = sheet.createRow(rowNum); XSSFFont font = xssfWorkbook.createFont(); font.setFontHeightInPoints((short) 10); font.setFontName("ARIAL"); font.setItalic(false); font.setBold(true); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setColor(HSSFColor.BLACK.index); XSSFCellStyle style = xssfWorkbook.createCellStyle(); style.setFont(font); Lists.newArrayList(MaintenanceEventsElementsReportEnum.values()).forEach( e -> createHeaderCell(e, headerLine, style, locale)); }
font.setFontName("Tahoma"); font.setColor(HSSFColor.BLACK.index); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); styleName.setFont(font); fontDescr.setFontName("Tahoma"); fontDescr.setColor(HSSFColor.BLACK.index); fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); styleDescription.setFont(font); XSSFCell cellDescr = null;
fontNew.setBoldweight(fontOld.getBoldweight()); fontNew.setCharSet(fontOld.getCharSet()); fontNew.setColor(fontOld.getColor());
private void fillHeaderRow(final XSSFWorkbook workbook, final XSSFSheet sheet, Integer rowNum, final Locale locale) { XSSFRow headerLine = sheet.createRow(rowNum); XSSFFont font = workbook.createFont(); font.setFontHeightInPoints((short) 10); font.setFontName("ARIAL"); font.setItalic(false); font.setBold(true); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setColor(HSSFColor.BLACK.index); XSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); int colNumber = 0; for (String column : PlannedEventsXlsConstants.ALL_COLUMNS) { XSSFCell headerCell = headerLine.createCell(colNumber); headerCell.setCellValue(translationService.translate(column, locale)); headerCell.setCellStyle(style); colNumber++; } }
fonttitle.setItalic(true); fonttitle.setFontName("微软雅黑"); fonttitle.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体 fontRed.setColor(IndexedColors.RED.getIndex()); fontRed.setFontName("微软雅黑"); fontRed.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体 fontRed.setFontHeightInPoints((short) 11); CellStyle styleRed = wb.createCellStyle(); fontGreen.setColor(IndexedColors.GREEN.getIndex()); fontGreen.setFontName("微软雅黑"); fontGreen.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体 fontGreen.setFontHeightInPoints((short) 11); CellStyle styleGreen = wb.createCellStyle();
font.setItalic(false); font.setBold(true); font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font.setItalic(false); font.setBold(false); font.setBoldweight(Font.BOLDWEIGHT_NORMAL);