/** * @param color * @param map * @return null if color is null, new instance otherwise */ public static XSSFColor from(CTColor color, IndexedColorMap map) { return color == null ? null : new XSSFColor(color, map); }
private void initializeThemeTrackToStyleMap() { this.themeTrackToStyleMap = new HashMap<>(); TangoColorFactory tangoColorFactory = new TangoColorFactory(); List<String> themeTrackList = solution.getTalkList().stream() .flatMap(talk -> talk.getThemeTrackTagSet().stream()) .distinct().collect(toList()); for (String themeTrack : themeTrackList) { XSSFCellStyle style = createStyle(new XSSFColor(tangoColorFactory.pickColor(themeTrack))); themeTrackToStyleMap.put(themeTrack, style); } }
XSSFColor backgroundColor = new XSSFColor(Color.decode(facetBackground)); ((XSSFCellStyle) facetStyle).setFillForegroundColor(backgroundColor); facetStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); XSSFColor facetColor = new XSSFColor(Color.decode(facetFontColor)); ((XSSFFont) facetFont).setColor(facetColor);
String cellFontColor = options.getCellFontColor(); if (cellFontColor != null) { XSSFColor cellColor = new XSSFColor(Color.decode(cellFontColor)); ((XSSFFont) cellFont).setColor(cellColor);
private XSSFColor buildXSSFColor(String colorStr){ String[] color=colorStr.split(","); Color c=new Color(Integer.valueOf(color[0]),Integer.valueOf(color[1]),Integer.valueOf(color[2])); XSSFColor xssfColor=new XSSFColor(c); return xssfColor; }
return null; return new XSSFColor(rgb, colorMap);
XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = wb.createSheet(); XSSFRow row = sheet.createRow(0); XSSFCell cell = row.createCell( 0); cell.setCellValue("custom XSSF colors"); XSSFCellStyle style1 = wb.createCellStyle(); style1.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128))); style1.setFillPattern(CellStyle.SOLID_FOREGROUND);
/** * @param color * @param map * @return null if color is null, new instance otherwise */ public static XSSFColor from(CTColor color, IndexedColorMap map) { return color == null ? null : new XSSFColor(color, map); }
public static XSSFColor parseColor(String color) { XSSFColor poiColor = null; if (StringUtils.isNotBlank(color)) { Color awtColor = getAwtColor(color); if (awtColor != null) { poiColor = new XSSFColor(awtColor, null); } } return poiColor; }
private void initializeThemeTrackToStyleMap() { this.themeTrackToStyleMap = new HashMap<>(); TangoColorFactory tangoColorFactory = new TangoColorFactory(); List<String> themeTrackList = solution.getTalkList().stream() .flatMap(talk -> talk.getThemeTrackTagSet().stream()) .distinct().collect(toList()); for (String themeTrack : themeTrackList) { XSSFCellStyle style = createStyle(new XSSFColor(tangoColorFactory.pickColor(themeTrack))); themeTrackToStyleMap.put(themeTrack, style); } }
/** * * @return xssf color wrapper or null if color info is missing */ public XSSFColor getXSSFColor(){ if(_font.sizeOfColorArray() == 0) return null; return new XSSFColor(_font.getColorArray(0)); }
/** * Set the color to use for the bottom border * @param color the index of the color definition * @see org.apache.poi.ss.usermodel.IndexedColors */ public void setBottomBorderColor(short color) { XSSFColor clr = new XSSFColor(); clr.setIndexed(color); setBottomBorderColor(clr); }
/** * Set the color to use for the right border * * @param color the index of the color definition * @see org.apache.poi.ss.usermodel.IndexedColors */ public void setRightBorderColor(short color) { XSSFColor clr = new XSSFColor(); clr.setIndexed(color); setRightBorderColor(clr); }
/** * Set the color to use for the left border as a indexed color value * * @param color the index of the color definition * @see org.apache.poi.ss.usermodel.IndexedColors */ public void setLeftBorderColor(short color) { XSSFColor clr = new XSSFColor(); clr.setIndexed(color); setLeftBorderColor(clr); }
/** * Set the color to use for the top border * * @param color the index of the color definition * @see org.apache.poi.ss.usermodel.IndexedColors */ public void setTopBorderColor(short color) { XSSFColor clr = new XSSFColor(); clr.setIndexed(color); setTopBorderColor(clr); }
XSSFWorkbook wb = new XSSFWorkbook(); XSSFCellStyle cellStyle = wb.createCellStyle(); byte[] rgb = new byte[3]; rgb[0] = (byte) 242; // red rgb[1] = (byte) 220; // green rgb[2] = (byte) 219; // blue XSSFColor myColor = new XSSFColor(rgb); // #f2dcdb cellStyle.setFillForegroundColor(myColor); cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
CellStyle createHeaderStyle(Workbook wb) { XSSFCellStyle xstyle = (XSSFCellStyle) wb.createCellStyle(); XSSFColor header = new XSSFColor(new Color(79, 129, 189)); xstyle.setFillForegroundColor(header); xstyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); XSSFFont font = (XSSFFont) wb.createFont(); font.setColor(IndexedColors.WHITE.index); xstyle.setFont(font); return xstyle; }
CellStyle createHeaderStyle(Workbook wb){ XSSFCellStyle xstyle = (XSSFCellStyle)wb.createCellStyle(); XSSFColor header = new XSSFColor(new Color(79, 129, 189)); xstyle.setFillForegroundColor(header); xstyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); XSSFFont font = (XSSFFont)wb.createFont(); font.setColor(IndexedColors.WHITE.index); xstyle.setFont(font); return xstyle; }
SXSSFWorkbook workbook = new SXSSFWorkbook(50); Sheet sheet = workbook.createSheet("Image Data"); .... Cell cell = row.createCell(j); cell.setCellValue(j); XSSFCellStyle cs1 = (XSSFCellStyle) workbook.createCellStyle(); cs1.setFillForegroundColor(new XSSFColor(new java.awt.Color(red,green,blue))); cs1.setFillPattern(CellStyle.SOLID_FOREGROUND); cell.setCellStyle(cs1);
XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = wb.createSheet(); XSSFRow row = sheet.createRow(0); XSSFCell cell = row.createCell( 0); cell.setCellValue("custom XSSF colors"); XSSFCellStyle style1 = wb.createCellStyle(); style1.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128))); style1.setFillPattern(CellStyle.SOLID_FOREGROUND);