org.apache.poi.hssf.util.HSSFColor.getTriplet()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.apache.poi.hssf.util.HSSFColor.getTriplet()方法的一些代码示例,展示了HSSFColor.getTriplet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFColor.getTriplet()方法的具体详情如下:
包路径:org.apache.poi.hssf.util.HSSFColor
类名称:HSSFColor
方法名:getTriplet

HSSFColor.getTriplet介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi

  1. /**
  2. * @see HSSFColor#getTriplet()
  3. */
  4. public short [] getTriplet() {
  5. return color.getTriplet();
  6. }

代码示例来源:origin: org.apache.poi/poi-ooxml

  1. /**
  2. * @param index
  3. * @return RGB bytes from HSSF default color by index
  4. */
  5. public static byte[] getDefaultRGB(int index) {
  6. HSSFColor hssfColor = HSSFColor.getIndexHash().get(index);
  7. if (hssfColor == null) return null;
  8. short[] rgbShort = hssfColor.getTriplet();
  9. return new byte[] {(byte) rgbShort[0], (byte) rgbShort[1], (byte) rgbShort[2]};
  10. }

代码示例来源:origin: org.apache.poi/poi

  1. protected byte[] getIndexedRGB() {
  2. if (isIndexed() && getIndex() > 0) {
  3. int indexNum = getIndex();
  4. HSSFColor indexed = HSSFColor.getIndexHash().get(indexNum);
  5. if (indexed != null) {
  6. byte[] rgb = new byte[3];
  7. rgb[0] = (byte) indexed.getTriplet()[0];
  8. rgb[1] = (byte) indexed.getTriplet()[1];
  9. rgb[2] = (byte) indexed.getTriplet()[2];
  10. return rgb;
  11. }
  12. } // else
  13. return null;
  14. }
  15. }

代码示例来源:origin: org.apache.poi/poi-ooxml

  1. if (indexed != null) {
  2. byte[] rgb = new byte[3];
  3. rgb[0] = (byte) indexed.getTriplet()[0];
  4. rgb[1] = (byte) indexed.getTriplet()[1];
  5. rgb[2] = (byte) indexed.getTriplet()[2];
  6. CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr();
  7. clr.setVal(rgb);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. /**
  2. * @see HSSFColor#getTriplet()
  3. */
  4. public short [] getTriplet() {
  5. return color.getTriplet();
  6. }

代码示例来源:origin: stackoverflow.com

  1. final HSSFColor foreColor = palette.getColor(style.getFont(this.book).getColor());
  2. if (foreColor != null) {
  3. final short[] foreRGB = foreColor.getTriplet();
  4. if (foreRGB[0] != 0 || foreRGB[1] != 0 || foreRGB[2] != 0) {
  5. out.append("color: rgb(").append(foreRGB[0]).append(',').append(foreRGB[1]).append(',').append(foreRGB[2]).append(");");
  6. }
  7. }

代码示例来源:origin: org.jeecg/easypoi-base

  1. public void styleColor(Formatter out, String attr, Color color) {
  2. if (color == null) {
  3. return;
  4. }
  5. HSSFColor hSSFColor = (HSSFColor) color;
  6. short[] rgb = hSSFColor.getTriplet();
  7. out.format(" %s: #%02x%02x%02x; %n", attr, rgb[0], rgb[1], rgb[2]);
  8. }
  9. }

代码示例来源:origin: org.apache.poi/poi-contrib

  1. /**
  2. * Gets the aWTColor attribute of the SVTableUtils class
  3. *
  4. * @param clr Description of the Parameter
  5. * @return The aWTColor value
  6. */
  7. public final static Color getAWTColor(HSSFColor clr) {
  8. short[] rgb = clr.getTriplet();
  9. return new Color(rgb[0], rgb[1], rgb[2]);
  10. }
  11. }

代码示例来源:origin: org.apache.poi/poi-contrib

  1. private static final Color getAWTColor(HSSFColor clr) {
  2. short[] rgb = clr.getTriplet();
  3. return new Color(rgb[0],rgb[1],rgb[2]);
  4. }
  5. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. /**
  2. * Gets the aWTColor attribute of the SVTableUtils class
  3. *
  4. * @param clr Description of the Parameter
  5. * @return The aWTColor value
  6. */
  7. public final static Color getAWTColor(HSSFColor clr) {
  8. short[] rgb = clr.getTriplet();
  9. return new Color(rgb[0], rgb[1], rgb[2]);
  10. }
  11. }

代码示例来源:origin: cn.afterturn/easypoi-base

  1. @Override
  2. public void styleColor(Formatter out, String attr, Color color) {
  3. if (color == null) {
  4. return;
  5. }
  6. HSSFColor hSSFColor = (HSSFColor) color;
  7. short[] rgb = hSSFColor.getTriplet();
  8. out.format(" %s: #%02x%02x%02x; %n", attr, rgb[0], rgb[1], rgb[2]);
  9. }
  10. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. private static final Color getAWTColor(HSSFColor clr) {
  2. short[] rgb = clr.getTriplet();
  3. return new Color(rgb[0],rgb[1],rgb[2]);
  4. }
  5. }

代码示例来源:origin: br.com.tecsinapse/tecsinapse-data-io

  1. public static String toHexColor(HSSFColor hssfColor) {
  2. short[] rgb = hssfColor.getTriplet();
  3. return String.format("#%02X%02X%02X", rgb[0], rgb[1], rgb[2]);
  4. }
  5. }

代码示例来源:origin: zhangdaiscott/jeasypoi

  1. public void styleColor(Formatter out, String attr, Color color) {
  2. if (color == null) {
  3. return;
  4. }
  5. HSSFColor hSSFColor = (HSSFColor) color;
  6. short[] rgb = hSSFColor.getTriplet();
  7. out.format(" %s: #%02x%02x%02x; %n", attr, rgb[0], rgb[1], rgb[2]);
  8. }
  9. }

代码示例来源:origin: org.apache.poi/poi-examples

  1. /** This method retrieves the AWT Color representation from the colour hash table
  2. *
  3. */
  4. /* package */ static Color getAWTColor(int index, Color deflt) {
  5. HSSFColor clr = colors.get(index);
  6. if (clr == null) {
  7. return deflt;
  8. }
  9. short[] rgb = clr.getTriplet();
  10. return new Color(rgb[0],rgb[1],rgb[2]);
  11. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

  1. /**
  2. * @param index
  3. * @return RGB bytes from HSSF default color by index
  4. */
  5. public static byte[] getDefaultRGB(int index) {
  6. HSSFColor hssfColor = HSSFColor.getIndexHash().get(index);
  7. if (hssfColor == null) return null;
  8. short[] rgbShort = hssfColor.getTriplet();
  9. return new byte[] {(byte) rgbShort[0], (byte) rgbShort[1], (byte) rgbShort[2]};
  10. }

代码示例来源:origin: stackoverflow.com

  1. Cell cell = row.getCell(1);
  2. CellStyle cellStyle = cell.getCellStyle();
  3. System.out.println("color = " + getColorPattern(cellStyle.getFillForegroundColor()));
  4. private short[] getColorPattern(short colorIdx){
  5. short[] triplet = null;
  6. HSSFColor color = palette.getColor(colorIdx);
  7. triplet = color.getTriplet();
  8. System.out.println("color : " + triplet[0] +"," + triplet[1] + "," + triplet[2]);
  9. return triplet;
  10. }

代码示例来源:origin: cn.afterturn/easypoi-base

  1. private void styleColor(Formatter out, String attr, short index) {
  2. HSSFColor color = colors.getColor(index);
  3. if (index == hssfAuto.getIndex() || color == null) {
  4. out.format(" /* %s: index = %d */%n", attr, index);
  5. } else {
  6. short[] rgb = color.getTriplet();
  7. out.format(" %s: #%02x%02x%02x; /* index = %d */%n", attr, rgb[0], rgb[1], rgb[2],
  8. index);
  9. }
  10. }

代码示例来源:origin: org.jeecg/easypoi-base

  1. private void styleColor(Formatter out, String attr, short index) {
  2. HSSFColor color = colors.getColor(index);
  3. if (index == HSSF_AUTO.getIndex() || color == null) {
  4. out.format(" /* %s: index = %d */%n", attr, index);
  5. } else {
  6. short[] rgb = color.getTriplet();
  7. out.format(" %s: #%02x%02x%02x; /* index = %d */%n", attr, rgb[0], rgb[1], rgb[2],
  8. index);
  9. }
  10. }

代码示例来源:origin: org.apache.poi/poi-examples

  1. private void styleColor(Formatter out, String attr, short index) {
  2. HSSFColor color = colors.getColor(index);
  3. if (index == HSSF_AUTO.getIndex() || color == null) {
  4. out.format(" /* %s: index = %d */%n", attr, index);
  5. } else {
  6. short[] rgb = color.getTriplet();
  7. out.format(" %s: #%02x%02x%02x; /* index = %d */%n", attr, rgb[0],
  8. rgb[1], rgb[2], index);
  9. }
  10. }
  11. }

相关文章