public XSSFColor[] getColors() { CTColor[] ctcols = _scale.getColorArray(); XSSFColor[] c = new XSSFColor[ctcols.length]; for (int i=0; i<ctcols.length; i++) { c[i] = XSSFColor.from(ctcols[i], _indexedColorMap); } return c; } public void setColors(Color[] colors) {
/** * @return color from scale */ public XSSFColor createColor() { return XSSFColor.from(_scale.addNewColor(), _indexedColorMap); } public XSSFConditionalFormattingThreshold createThreshold() {
public XSSFColor getColor() { return XSSFColor.from(_databar.getColor(), _colorMap); } public void setColor(Color color) {
private XSSFColor getColor(CTBorderPr pr) { return pr == null ? null : XSSFColor.from(pr.getColor(), _colorMap); } }
/** * 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); }
@Override public XSSFColor getFontColor() { if(_font.sizeOfColorArray() == 0) return null; return XSSFColor.from(_font.getColorArray(0), _colorMap); }
@Override public XSSFColor createExtendedColor() { return XSSFColor.from(CTColor.Factory.newInstance(), workbook.getStylesSource().getIndexedColors()); }
public XSSFColor getFillBackgroundColorColor() { if(!_fill.isSetPatternFill()) return null; return XSSFColor.from(_fill.getPatternFill().getBgColor(), _colorMap); } public XSSFColor getFillForegroundColorColor() {
/** * get the color value for the font * References a color defined as Standard Alpha Red Green Blue color value (ARGB). * * @return XSSFColor - rgb color to use */ public XSSFColor getXSSFColor() { CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0); if(ctColor != null) { XSSFColor color = XSSFColor.from(ctColor, _indexedColorMap); if(_themes != null) { _themes.inheritFromThemeAsRequired(color); } return color; } else { return null; } }
/** * Set the foreground fill color as a indexed color value * <br> * <i>Note: Ensure Foreground color is set prior to background color.</i> * @param fg the color to use * @see org.apache.poi.ss.usermodel.IndexedColors */ @Override public void setFillForegroundColor(short fg) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(fg); setFillForegroundColor(clr); }
/** * Set the color to use for the bottom border * @param color the index of the color definition * @see org.apache.poi.ss.usermodel.IndexedColors */ @Override public void setBottomBorderColor(short color) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(color); setBottomBorderColor(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 */ @Override public void setLeftBorderColor(short color) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); 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 */ @Override public void setTopBorderColor(short color) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(color); setTopBorderColor(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 */ @Override public void setRightBorderColor(short color) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(color); setRightBorderColor(clr); }
public XSSFColor getFillForegroundColorColor() { if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor()) return null; return XSSFColor.from(_fill.getPatternFill().getFgColor(), _colorMap); }
/** * Get the color to use for the selected border * * @param side - where to apply the color definition * @return color - color to use as XSSFColor. null if color is not set */ public XSSFColor getBorderColor(BorderSide side) { CTBorderPr borderPr = getBorder(side); if(borderPr != null && borderPr.isSetColor()) { XSSFColor clr = XSSFColor.from(borderPr.getColor(), _indexedColorMap); if(_theme != null) { _theme.inheritFromThemeAsRequired(clr); } return clr; } else { // No border set return null; } }
XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(bg); setFillBackgroundColor(clr);
/** * Get background color of the sheet tab. * Returns <tt>null</tt> if no sheet tab color is set. * * @return the background color of the sheet tab */ public XSSFColor getTabColor() { CTSheetPr pr = worksheet.getSheetPr(); if(pr == null) { pr = worksheet.addNewSheetPr(); } if (!pr.isSetTabColor()) { return null; } return XSSFColor.from(pr.getTabColor(), getWorkbook().getStylesSource().getIndexedColors()); }
/** * 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 */ @Override public void setLeftBorderColor(short color) { XSSFColor clr = XSSFColor.from(CTColor.Factory.newInstance(), _stylesSource.getIndexedColors()); clr.setIndexed(color); setLeftBorderColor(clr); }