/** * get the fill pattern * * @return fill pattern type. null if fill pattern is not set */ public STPatternType.Enum getPatternType() { CTPatternFill ptrn = _fill.getPatternFill(); return ptrn == null ? null : ptrn.getPatternType(); }
private CTPatternFill ensureCTPatternFill() { CTPatternFill patternFill = _fill.getPatternFill(); if (patternFill == null) { patternFill = _fill.addNewPatternFill(); } return patternFill; }
/** * Get the foreground fill color. * * @return XSSFColor - foreground color. null if color is not set */ public XSSFColor getFillForegroundColor() { CTPatternFill ptrn = _fill.getPatternFill(); if (ptrn == null) return null; CTColor ctColor = ptrn.getFgColor(); return XSSFColor.from(ctColor, _indexedColorMap); }
/** * Get the background fill color. * * @return fill color, null if color is not set */ public XSSFColor getFillBackgroundColor() { CTPatternFill ptrn = _fill.getPatternFill(); if (ptrn == null) return null; CTColor ctColor = ptrn.getBgColor(); return XSSFColor.from(ctColor, _indexedColorMap); }
public XSSFColor getFillForegroundColorColor() { if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor()) return null; return XSSFColor.from(_fill.getPatternFill().getFgColor(), _colorMap); }
public short getFillPattern() { if(!_fill.isSetPatternFill() || !_fill.getPatternFill().isSetPatternType()) return NO_FILL; return (short)(_fill.getPatternFill().getPatternType().intValue() - 1); }
public XSSFColor getFillBackgroundColorColor() { if(!_fill.isSetPatternFill()) return null; return XSSFColor.from(_fill.getPatternFill().getBgColor(), _colorMap); } public XSSFColor getFillForegroundColorColor() {
private void setFillForegroundColor(CTColor color) { CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if (color == null) { ptrn.unsetFgColor(); } else { ptrn.setFgColor(color); } }
private void setFillBackgroundColor(CTColor color) { CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if (color == null) { ptrn.unsetBgColor(); } else { ptrn.setBgColor(color); } }
public void setFillPattern(short fp){ CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if(fp == NO_FILL) ptrn.unsetPatternType(); else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1)); } }
/** * Set the foreground fill color represented as a {@link XSSFColor} value. * <br> * <i>Note: Ensure Foreground color is set prior to background color.</i> * @param color the color to use * @see #setFillBackgroundColor(org.apache.poi.xssf.usermodel.XSSFColor) ) */ public void setFillForegroundColor(XSSFColor color) { CTFill ct = getCTFill(); CTPatternFill ptrn = ct.getPatternFill(); if(color == null) { if(ptrn != null && ptrn.isSetFgColor()) ptrn.unsetFgColor(); } else { if(ptrn == null) ptrn = ct.addNewPatternFill(); ptrn.setFgColor(color.getCTColor()); } addFill(ct); }
CTPatternFill ptrn = ct.getPatternFill(); if(color == null) { if(ptrn != null && ptrn.isSetBgColor()) ptrn.unsetBgColor();
/** * This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern), * foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element. * * @param pattern the fill pattern to use * @see #setFillBackgroundColor(XSSFColor) * @see #setFillForegroundColor(XSSFColor) * @see org.apache.poi.ss.usermodel.FillPatternType */ @Override public void setFillPattern(FillPatternType pattern) { CTFill ct = getCTFill(); CTPatternFill ctptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill(); if (pattern == FillPatternType.NO_FILL && ctptrn.isSetPatternType()) { ctptrn.unsetPatternType(); } else { ctptrn.setPatternType(STPatternType.Enum.forInt(pattern.getCode() + 1)); } addFill(ct); }
/** * get the fill pattern * * @return fill pattern type. null if fill pattern is not set */ public STPatternType.Enum getPatternType() { CTPatternFill ptrn = _fill.getPatternFill(); return ptrn == null ? null : ptrn.getPatternType(); }
public XSSFColor getFillForegroundColorColor() { if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor()) return null; return XSSFColor.from(_fill.getPatternFill().getFgColor(), _colorMap); }
public short getFillForegroundColor(){ if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor()) return 0; return (short)_fill.getPatternFill().getFgColor().getIndexed(); }
public XSSFColor getFillBackgroundColorColor() { if(!_fill.isSetPatternFill()) return null; return XSSFColor.from(_fill.getPatternFill().getBgColor(), _colorMap); } public XSSFColor getFillForegroundColorColor() {
private void setFillBackgroundColor(CTColor color) { CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if (color == null) { ptrn.unsetBgColor(); } else { ptrn.setBgColor(color); } }
public void setFillPattern(short fp){ CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if(fp == NO_FILL) ptrn.unsetPatternType(); else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1)); } }
public void setFillForegroundColor(short fg){ CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); CTColor fgColor = CTColor.Factory.newInstance(); fgColor.setIndexed(fg); ptrn.setFgColor(fgColor); }