/** * @param index * @return RGB bytes from HSSF default color by index */ public static byte[] getDefaultRGB(int index) { HSSFColor hssfColor = HSSFColor.getIndexHash().get(index); if (hssfColor == null) return null; short[] rgbShort = hssfColor.getTriplet(); return new byte[] {(byte) rgbShort[0], (byte) rgbShort[1], (byte) rgbShort[2]}; }
protected byte[] getIndexedRGB() { if (isIndexed() && getIndex() > 0) { int indexNum = getIndex(); HSSFColor indexed = HSSFColor.getIndexHash().get(indexNum); if (indexed != null) { byte[] rgb = new byte[3]; rgb[0] = (byte) indexed.getTriplet()[0]; rgb[1] = (byte) indexed.getTriplet()[1]; rgb[2] = (byte) indexed.getTriplet()[2]; return rgb; } } // else return null; } }
clr.setVal(xlsColor.getRgb()); } else if (xlsColor.isSetIndexed()) { HSSFColor indexed = HSSFColor.getIndexHash().get((int) xlsColor.getIndexed()); if (indexed != null) { byte[] rgb = new byte[3];
/** * @param index * @return RGB bytes from HSSF default color by index */ public static byte[] getDefaultRGB(int index) { HSSFColor hssfColor = HSSFColor.getIndexHash().get(index); if (hssfColor == null) return null; short[] rgbShort = hssfColor.getTriplet(); return new byte[] {(byte) rgbShort[0], (byte) rgbShort[1], (byte) rgbShort[2]}; }
protected byte[] getIndexedRGB() { if (isIndexed() && getIndex() > 0) { int indexNum = getIndex(); HSSFColor indexed = HSSFColor.getIndexHash().get(indexNum); if (indexed != null) { byte[] rgb = new byte[3]; rgb[0] = (byte) indexed.getTriplet()[0]; rgb[1] = (byte) indexed.getTriplet()[1]; rgb[2] = (byte) indexed.getTriplet()[2]; return rgb; } } // else return null; } }
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); }
HSSFColor color = HSSFColor.getIndexHash().get(colorIndex); if (color != null) { int rbg = POIUtil.getRGB(color);
HSSFColor indexed = HSSFColor.getIndexHash().get((int) xlsColor.getIndexed()); if (indexed != null) { byte[] rgb = new byte[3];
clr.setVal(xlsColor.getRgb()); } else if (xlsColor.isSetIndexed()) { HSSFColor indexed = HSSFColor.getIndexHash().get((int) xlsColor.getIndexed()); if (indexed != null) { byte[] rgb = new byte[3];