protected XSSFCellStyle createStyle(XSSFColor color) { XSSFCellStyle style = workbook.createCellStyle(); if (color != null) { style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillForegroundColor(color); } style.setWrapText(true); style.setVerticalAlignment(VerticalAlignment.CENTER); return style; }
protected XSSFCellStyle createStyle(XSSFColor color) { XSSFCellStyle style = workbook.createCellStyle(); if (color != null) { style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillForegroundColor(color); } style.setWrapText(true); style.setVerticalAlignment(VerticalAlignment.CENTER); return style; }
CellStyle colStyle=cell.getColumn().getCustomCellStyle(); XSSFCellStyle style=(XSSFCellStyle)wb.createCellStyle(); style.setWrapText(true); String bgcolor=cellStyle.getBgcolor(); if(customStyle!=null && StringUtils.isNotBlank(customStyle.getBgcolor())){
style.setWrapText(true); StreamSupport.stream(Spliterators.spliteratorUnknownSize(spreadsheet.iterator(), Spliterator.ORDERED), false) .skip(5)
public static XSSFCellStyle getHeadCellStyle(XSSFWorkbook wb, XSSFFont font) { XSSFCellStyle headCellStyle = wb.createCellStyle(); headCellStyle.setFont(font); headCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); headCellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); headCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); headCellStyle.setWrapText(false); headCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); headCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); return headCellStyle; }
private static XSSFCellStyle getHeadCellStyle(XSSFWorkbook wb, XSSFFont font) {//用到 XSSFCellStyle headCellStyle = wb.createCellStyle(); headCellStyle.setFont(font); headCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); headCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); headCellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); headCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); headCellStyle.setWrapText(false); headCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); headCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); return headCellStyle; }
styleNew.setLocked(styleOld.getLocked()); styleNew.setVerticalAlignment(styleOld.getVerticalAlignment()); styleNew.setWrapText(styleOld.getWrapText()); this.styleMap.put(hash, styleNew);
textCs.setFont(f); textCs.setDataFormat(df.getFormat("text")); textCs.setWrapText(true); putBorders(textCs); styleMap.put(IHierarchicalExportWriter.Type.TEXT, textCs);
private CellStyle backgroundStyle(SXSSFWorkbook workbook, Integer rgb, Font font) { XSSFCellStyle style = (XSSFCellStyle) workbook.createCellStyle(); if (rgb != null) { IndexedColorMap indexedColors = workbook.getXSSFWorkbook().getStylesSource().getIndexedColors(); XSSFColor color = new XSSFColor(convertRGB(rgb), indexedColors); style.setFillForegroundColor(color); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); } style.setBorderBottom(BorderStyle.THIN); style.setBorderTop(BorderStyle.THIN); style.setBorderLeft(BorderStyle.THIN); style.setBorderRight(BorderStyle.THIN); if (font != null) { style.setFont(font); } style.setWrapText(true); style.setVerticalAlignment(VerticalAlignment.CENTER); return style; }
private void fillHeaderRow(XSSFWorkbook workbook, XSSFSheet sheet, Locale locale) { XSSFRow header = sheet.createRow(3); Font font = createFontArialNormal(workbook); XSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setWrapText(true); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); for (int i = 0; i < TrackingOperationProductInComponentAdditionalInformationReportColumns.ALL_COLUMNS.length; i++) { String column = TrackingOperationProductInComponentAdditionalInformationReportColumns.ALL_COLUMNS[i]; XSSFCell headerCell = header.createCell(i); headerCell.setCellValue(translationService.translate(column, locale)); headerCell.setCellStyle(style); } }
protected void createExcelHeader(XSSFWorkbook workbook, XSSFSheet tableSheet) throws Exception { XSSFFont f = workbook.createFont(); f.setFontHeightInPoints((short) 12); f.setColor(IndexedColors.BLACK.getIndex()); XSSFDataFormat df = workbook.createDataFormat(); XSSFCellStyle cs = workbook.createCellStyle(); cs.setFont(f); cs.setDataFormat(df.getFormat("text")); cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); cs.setFillPattern(FillPatternType.SOLID_FOREGROUND); cs.setWrapText(true); XSSFCreationHelper createHelper = workbook.getCreationHelper(); XSSFRow rh = tableSheet.createRow(0); for (int i = 0; i < table.getColumnCount(); i++) { XSSFCell c1 = rh.createCell(i); c1.setCellStyle(cs); c1.setCellValue(createHelper.createRichTextString(table.getColumnName(i))); c1.setCellType(XSSFCell.CELL_TYPE_STRING); } }
private void createExcelHeader(XSSFWorkbook workbook, XSSFSheet tableSheet) throws Exception { XSSFFont f = workbook.createFont(); f.setFontHeightInPoints((short) 12); f.setColor(IndexedColors.BLACK.getIndex()); XSSFDataFormat df = workbook.createDataFormat(); XSSFCellStyle cs = workbook.createCellStyle(); cs.setFont(f); cs.setDataFormat(df.getFormat("text")); cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); cs.setFillPattern(FillPatternType.SOLID_FOREGROUND); cs.setWrapText(true); XSSFCreationHelper createHelper = workbook.getCreationHelper(); XSSFRow rh = tableSheet.createRow(0); for (int i = 0; i < table.getColumnCount(); i++) { XSSFCell c1 = rh.createCell(i); c1.setCellStyle(cs); c1.setCellValue(createHelper.createRichTextString(table.getColumnName(i))); c1.setCellType(XSSFCell.CELL_TYPE_STRING); } }
textCs.setFont(f); textCs.setDataFormat(df.getFormat("text")); textCs.setWrapText(true);
textCs.setFont(f); textCs.setDataFormat(df.getFormat("text")); textCs.setWrapText(true);
CellStyle colStyle=cell.getColumn().getCustomCellStyle(); XSSFCellStyle style=(XSSFCellStyle)wb.createCellStyle(); style.setWrapText(true); String bgcolor=cellStyle.getBgcolor(); if(customStyle!=null && StringUtils.isNotBlank(customStyle.getBgcolor())){