/** * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors. */ @Override public short getIndex() { return (short)ctColor.getIndexed(); } /**
/** * @return font color index */ @Override public short getFontColorIndex(){ if(_font.sizeOfColorArray() == 0) return -1; int idx = 0; CTColor color = _font.getColorArray(0); if(color.isSetIndexed()) idx = (int)color.getIndexed(); return (short)idx; }
/** * get the indexed color value for the font * References a color defined in IndexedColors. * * @return short - indexed color to use * @see IndexedColors */ public short getColor() { CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0); if (color == null) return IndexedColors.BLACK.getIndex(); long index = color.getIndexed(); if (index == XSSFFont.DEFAULT_FONT_COLOR) { return IndexedColors.BLACK.getIndex(); } else if (index == IndexedColors.RED.getIndex()) { return IndexedColors.RED.getIndex(); } else { return (short)index; } }
clr.setVal(xlsColor.getRgb()); } else if (xlsColor.isSetIndexed()) { HSSFColor indexed = HSSFColor.getIndexHash().get((int) xlsColor.getIndexed()); if (indexed != null) { byte[] rgb = new byte[3];
/** * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors. */ @Override public short getIndex() { return (short)ctColor.getIndexed(); } /**
/** * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors. */ public short getIndexed() { return (short)ctColor.getIndexed(); }
/** * Copy font attributes from CTFont bean into CTRPrElt bean */ private void setRunAttributes(CTFont ctFont, CTRPrElt pr){ if(ctFont.sizeOfBArray() > 0) pr.addNewB().setVal(ctFont.getBArray(0).getVal()); if(ctFont.sizeOfUArray() > 0) pr.addNewU().setVal(ctFont.getUArray(0).getVal()); if(ctFont.sizeOfIArray() > 0) pr.addNewI().setVal(ctFont.getIArray(0).getVal()); if(ctFont.sizeOfColorArray() > 0) { CTColor c1 = ctFont.getColorArray(0); CTColor c2 = pr.addNewColor(); if(c1.isSetAuto()) c2.setAuto(c1.getAuto()); if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed()); if(c1.isSetRgb()) c2.setRgb(c1.getRgb()); if(c1.isSetTheme()) c2.setTheme(c1.getTheme()); if(c1.isSetTint()) c2.setTint(c1.getTint()); } if(ctFont.sizeOfSzArray() > 0) pr.addNewSz().setVal(ctFont.getSzArray(0).getVal()); if(ctFont.sizeOfNameArray() > 0) pr.addNewRFont().setVal(ctFont.getNameArray(0).getVal()); if(ctFont.sizeOfFamilyArray() > 0) pr.addNewFamily().setVal(ctFont.getFamilyArray(0).getVal()); if(ctFont.sizeOfSchemeArray() > 0) pr.addNewScheme().setVal(ctFont.getSchemeArray(0).getVal()); if(ctFont.sizeOfCharsetArray() > 0) pr.addNewCharset().setVal(ctFont.getCharsetArray(0).getVal()); if(ctFont.sizeOfCondenseArray() > 0) pr.addNewCondense().setVal(ctFont.getCondenseArray(0).getVal()); if(ctFont.sizeOfExtendArray() > 0) pr.addNewExtend().setVal(ctFont.getExtendArray(0).getVal()); if(ctFont.sizeOfVertAlignArray() > 0) pr.addNewVertAlign().setVal(ctFont.getVertAlignArray(0).getVal()); if(ctFont.sizeOfOutlineArray() > 0) pr.addNewOutline().setVal(ctFont.getOutlineArray(0).getVal()); if(ctFont.sizeOfShadowArray() > 0) pr.addNewShadow().setVal(ctFont.getShadowArray(0).getVal()); if(ctFont.sizeOfStrikeArray() > 0) pr.addNewStrike().setVal(ctFont.getStrikeArray(0).getVal()); }
CTColor c2 = ctFont.addNewColor(); if(c1.isSetAuto()) c2.setAuto(c1.getAuto()); if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed()); if(c1.isSetRgb()) c2.setRgb(c1.getRgb()); if(c1.isSetTheme()) c2.setTheme(c1.getTheme());
public short getTopBorderColor(){ if(!_border.isSetTop()) return 0; CTBorderPr pr = _border.getTop(); return (short)pr.getColor().getIndexed(); }
/** * @return font color index */ @Override public short getFontColorIndex(){ if(_font.sizeOfColorArray() == 0) return -1; int idx = 0; CTColor color = _font.getColorArray(0); if(color.isSetIndexed()) idx = (int)color.getIndexed(); return (short)idx; }
public short getDiagonalBorderColor(){ if(!_border.isSetDiagonal()) return 0; CTBorderPr pr = _border.getDiagonal(); return (short)pr.getColor().getIndexed(); }
public short getLeftBorderColor(){ if(!_border.isSetLeft()) return 0; CTBorderPr pr = _border.getLeft(); return (short)pr.getColor().getIndexed(); }
public short getRightBorderColor(){ if(!_border.isSetRight()) return 0; CTBorderPr pr = _border.getRight(); return (short)pr.getColor().getIndexed(); }
/** * @return font color index */ public short getFontColorIndex(){ if(_font.sizeOfColorArray() == 0) return -1; int idx = 0; CTColor color = _font.getColorArray(0); if(color.isSetIndexed()) idx = (int)color.getIndexed(); return (short)idx; }
public short getBottomBorderColor(){ if(!_border.isSetBottom()) return 0; CTBorderPr pr = _border.getBottom(); return (short)pr.getColor().getIndexed(); }
public short getFillBackgroundColor(){ if(!_fill.isSetPatternFill()) return 0; return (short)_fill.getPatternFill().getBgColor().getIndexed(); }
private byte[] getRGBOrARGB() { byte[] rgb = null; if (ctColor.isSetIndexed() && ctColor.getIndexed() > 0) { HSSFColor indexed = HSSFColor.getIndexHash().get((int) ctColor.getIndexed()); if (indexed != null) { rgb = new byte[3]; rgb[0] = (byte) indexed.getTriplet()[0]; rgb[1] = (byte) indexed.getTriplet()[1]; rgb[2] = (byte) indexed.getTriplet()[2]; return rgb; } } if (!ctColor.isSetRgb()) { // No colour is available, sorry return null; } // Grab the colour rgb = ctColor.getRgb(); // Correct it as needed, and return return correctRGB(rgb); }
public short getFillForegroundColor(){ if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor()) return 0; return (short)_fill.getPatternFill().getFgColor().getIndexed(); }
/** * get the indexed color value for the font * References a color defined in IndexedColors. * * @return short - indexed color to use * @see IndexedColors */ public short getColor() { CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0); if (color == null) return IndexedColors.BLACK.getIndex(); long index = color.getIndexed(); if (index == XSSFFont.DEFAULT_FONT_COLOR) { return IndexedColors.BLACK.getIndex(); } else if (index == IndexedColors.RED.getIndex()) { return IndexedColors.RED.getIndex(); } else { return (short)index; } }
/** * get the indexed color value for the font * References a color defined in IndexedColors. * * @return short - indexed color to use * @see IndexedColors */ public short getColor() { CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0); if (color == null) return IndexedColors.BLACK.getIndex(); long index = color.getIndexed(); if (index == XSSFFont.DEFAULT_FONT_COLOR) { return IndexedColors.BLACK.getIndex(); } else if (index == IndexedColors.RED.getIndex()) { return IndexedColors.RED.getIndex(); } else { return (short)index; } }