/** * Set cell color. This sets some associated values; for finer control * you may want to access these elements individually. * * @param rgbStr - the desired cell color, in the hex form "RRGGBB". */ public void setColor(String rgbStr) { CTTcPr tcpr = getTcPr(); CTShd ctshd = tcpr.isSetShd() ? tcpr.getShd() : tcpr.addNewShd(); ctshd.setColor("auto"); ctshd.setVal(STShd.CLEAR); ctshd.setFill(rgbStr); }
public static void styleTable(XWPFTable table, TableStyle style) { if (null == table || null == style) return; CTTblPr tblPr = table.getCTTbl().getTblPr(); if (null == tblPr) { tblPr = table.getCTTbl().addNewTblPr(); } if (null != style.getAlign()) { CTJc jc = tblPr.isSetJc() ? tblPr.getJc() : tblPr.addNewJc(); jc.setVal(style.getAlign()); } if (StringUtils.isNotBlank(style.getBackgroundColor())) { CTShd ctshd = tblPr.isSetShd() ? tblPr.getShd() : tblPr.addNewShd(); ctshd.setColor("auto"); ctshd.setVal(STShd.CLEAR); ctshd.setFill(style.getBackgroundColor()); } }
CTShd cTShd = run.getCTR().addNewRPr().addNewShd(); cTShd.setVal(STShd.CLEAR); cTShd.setFill(hex_background_color);
ctshd.setFill(toHex(bgcolor.split(",")));
/** * Set cell color. This sets some associated values; for finer control * you may want to access these elements individually. * * @param rgbStr - the desired cell color, in the hex form "RRGGBB". */ public void setColor(String rgbStr) { CTTcPr tcpr = getTcPr(); CTShd ctshd = tcpr.isSetShd() ? tcpr.getShd() : tcpr.addNewShd(); ctshd.setColor("auto"); ctshd.setVal(STShd.CLEAR); ctshd.setFill(rgbStr); }
/** * Set cell color. This sets some associated values; for finer control * you may want to access these elements individually. * @param rgbStr - the desired cell color, in the hex form "RRGGBB". */ public void setColor(String rgbStr) { CTTcPr tcpr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr(); CTShd ctshd = tcpr.isSetShd() ? tcpr.getShd() : tcpr.addNewShd(); ctshd.setColor("auto"); ctshd.setVal(STShd.CLEAR); ctshd.setFill(rgbStr); }
ctshd.setFill(toHex(bgcolor.split(",")));
run.setUnderline(UnderlinePatterns.valueOf(style.getUnderline().name())); if (style.getTextColor() != null) ctshd.setFill(style.getBgColor()); if (style.getBgColor() != null) run.setColor(style.getTextColor());
run.setUnderline(UnderlinePatterns.valueOf(style.getUnderline().name())); if (style.getTextColor() != null) ctshd.setFill(style.getBgColor()); if (style.getBgColor() != null) run.setColor(style.getTextColor());
if(style.getFontFamily()!=null)run.setFontFamily(style.getFontFamily()); if(style.getUnderline()!=null)run.setUnderline(UnderlinePatterns.valueOf(style.getUnderline().name())); if(style.getTextColor()!=null)ctshd.setFill(style.getBgColor()); if(style.getBgColor()!=null)run.setColor(style.getTextColor()); if(style.getFontSize()>0)run.setFontSize(style.getFontSize());