Examples of XSSFColor


Examples of org.apache.poi.xssf.usermodel.extensions.XSSFColor

  }
 
  public void testGetSetRightBorderColor() {
    CTColor ctColor = ctBorderA.addNewRight().addNewColor();
    ctColor.setIndexed(8);
    XSSFColor color = new XSSFColor(ctColor);
    assertEquals((short)8, cellStyle.getRightBorderColor());
    CTColor anotherCtColor = CTColor.Factory.newInstance();
    anotherCtColor.setIndexed(14);
    anotherCtColor.setTheme(3);
    anotherCtColor.setRgb("af67".getBytes());
    XSSFColor anotherColor = new XSSFColor(anotherCtColor);
    cellStyle.setBorderColor(BorderSide.RIGHT, anotherColor);
    assertEquals((short)14, cellStyle.getRightBorderColor());
    assertEquals(new String("af67".getBytes()), new String(cellStyle.getBorderColor(BorderSide.RIGHT).getRgb()));
  }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.extensions.XSSFColor

    }

    public void testGetSetBottomBorderColor() {
        CTColor ctColor = ctBorderA.addNewBottom().addNewColor();
        ctColor.setIndexed(2);
        XSSFColor color = new XSSFColor(ctColor);
        assertEquals((short)2, cellStyle.getBottomBorderColor());
        CTColor anotherCtColor = CTColor.Factory.newInstance();
        anotherCtColor.setIndexed(4);
        anotherCtColor.setTheme(3);
        anotherCtColor.setRgb("1234".getBytes());
        XSSFColor anotherColor = new XSSFColor(anotherCtColor);
        cellStyle.setBorderColor(BorderSide.BOTTOM, anotherColor);
        assertEquals((short)4, cellStyle.getBottomBorderColor());
        assertEquals(new String("1234".getBytes()), new String(cellStyle.getBorderColor(BorderSide.BOTTOM).getRgb()));
    }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.extensions.XSSFColor

    }

    public void testGetSetTopBorderColor() {
        CTColor ctColor = ctBorderA.addNewTop().addNewColor();
        ctColor.setIndexed(5);
        XSSFColor color = new XSSFColor(ctColor);
        assertEquals((short)5, cellStyle.getTopBorderColor());
        CTColor anotherCtColor = CTColor.Factory.newInstance();
        anotherCtColor.setIndexed(7);
        anotherCtColor.setTheme(3);
        anotherCtColor.setRgb("abcd".getBytes());
        XSSFColor anotherColor = new XSSFColor(anotherCtColor);
        cellStyle.setBorderColor(BorderSide.TOP, anotherColor);
        assertEquals((short)7, cellStyle.getTopBorderColor());
        assertEquals(new String("abcd".getBytes()), new String(cellStyle.getBorderColor(BorderSide.TOP).getRgb()));
    }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.extensions.XSSFColor

    }

    public void testGetSetLeftBorderColor() {
        CTColor ctColor = ctBorderA.addNewLeft().addNewColor();
        ctColor.setIndexed(2);
        XSSFColor color = new XSSFColor(ctColor);
        assertEquals((short)2, cellStyle.getLeftBorderColor());
        CTColor anotherCtColor = CTColor.Factory.newInstance();
        anotherCtColor.setIndexed(4);
        anotherCtColor.setTheme(3);
        anotherCtColor.setRgb("1234".getBytes());
        XSSFColor anotherColor = new XSSFColor(anotherCtColor);
        cellStyle.setBorderColor(BorderSide.LEFT, anotherColor);
        assertEquals((short)4, cellStyle.getLeftBorderColor());
        assertEquals(new String("1234".getBytes()), new String(cellStyle.getBorderColor(BorderSide.LEFT).getRgb()));
    }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.extensions.XSSFColor

    }

    public void testGetSetRightBorderColor() {
        CTColor ctColor = ctBorderA.addNewRight().addNewColor();
        ctColor.setIndexed(8);
        XSSFColor color = new XSSFColor(ctColor);
        assertEquals((short)8, cellStyle.getRightBorderColor());
        CTColor anotherCtColor = CTColor.Factory.newInstance();
        anotherCtColor.setIndexed(14);
        anotherCtColor.setTheme(3);
        anotherCtColor.setRgb("af67".getBytes());
        XSSFColor anotherColor = new XSSFColor(anotherCtColor);
        cellStyle.setBorderColor(BorderSide.RIGHT, anotherColor);
        assertEquals((short)14, cellStyle.getRightBorderColor());
        assertEquals(new String("af67".getBytes()), new String(cellStyle.getBorderColor(BorderSide.RIGHT).getRgb()));
    }
View Full Code Here

Examples of org.zkoss.poi.xssf.usermodel.XSSFColor

  /**
   * Finds a font that matches the one with the supplied attributes
   */
  public XSSFFont findFont(short boldWeight, Color color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
    for (XSSFFont font : getStylesSource().getFonts()) {
      final XSSFColor fontColor = font.getXSSFColor();
      if (  (font.getBoldweight() == boldWeight)
          && (color == fontColor || color != null && color.equals(fontColor))
          && font.getFontHeight() == fontHeight
          && font.getFontName().equals(name)
          && font.getItalic() == italic
View Full Code Here

Examples of org.zkoss.poi.xssf.usermodel.XSSFColor

  //TODO see if we can remove this function to use getFontHTMLColor(Cell, Font);
  public static String getFontHTMLColor(Book book, Font font) {
    if (font instanceof XSSFFont) {
      final XSSFFont f = (XSSFFont) font;
      final XSSFColor color = f.getXSSFColor();
      return BookHelper.colorToHTML(book, color);
    } else {
      return indexToHSSFRGB((HSSFWorkbook)book, font.getColor());
    }
  }
View Full Code Here

Examples of org.zkoss.poi.xssf.usermodel.XSSFColor

  }

  public static String getFontHTMLColor(Cell cell, Font font) {
    if (font instanceof XSSFFont) {
      final XSSFFont f = (XSSFFont) font;
      final XSSFColor color = f.getXSSFColor();
      return BookHelper.colorToHTML(cell.getSheet().getWorkbook(), color);
    } else {
      return getHSSFRGBString((HSSFCell)cell, font.getColor());
    }
  }
View Full Code Here

Examples of org.zkoss.poi.xssf.usermodel.XSSFColor

          "#"+ toHex(argb[0])+ toHex(argb[1])+ toHex(argb[2]);
      }
      if (ctcolor.isSetTheme()) {
          ThemesTable theme = book.getTheme();
          if (theme != null) {
            XSSFColor themecolor = theme.getThemeColor(color.getTheme());
            if (themecolor != null) {
              if (ctcolor.isSetTint()) {
                themecolor.setTint(ctcolor.getTint());
              }
              return XSSFColorToHTML(book, themecolor); //recursive
            }
          }
      }
View Full Code Here

Examples of org.zkoss.poi.xssf.usermodel.XSSFColor

    byte[] triplet = HTMLToTriplet(color);
    byte a = (byte) 0xff;
    byte r = triplet[0];
    byte g = triplet[1];
    byte b = triplet[2];
    return  new XSSFColor(new byte[] {a, r, g, b});
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.