Package org.openxmlformats.schemas.drawingml.x2006.main

Examples of org.openxmlformats.schemas.drawingml.x2006.main.CTColor


    assertEquals((short)4, cellStyle.getBottomBorderColor());
    assertEquals(new String("1234".getBytes()), new String(cellStyle.getBorderColor(BorderSide.BOTTOM).getRgb()));
  }
 
  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


    assertEquals((short)7, cellStyle.getTopBorderColor());
    assertEquals(new String("abcd".getBytes()), new String(cellStyle.getBorderColor(BorderSide.TOP).getRgb()));
  }
 
  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

    assertEquals((short)4, cellStyle.getLeftBorderColor());
    assertEquals(new String("1234".getBytes()), new String(cellStyle.getBorderColor(BorderSide.LEFT).getRgb()));
  }
 
  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

    assertEquals(new String("af67".getBytes()), new String(cellStyle.getBorderColor(BorderSide.RIGHT).getRgb()));
  }
 
  public void testGetFillBackgroundColor() {
    CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
    CTColor ctBgColor = ctPatternFill.addNewBgColor();
    ctBgColor.setIndexed(4);
    assertEquals(4, cellStyle.getFillBackgroundColor());
  }
View Full Code Here

    assertEquals(4, cellStyle.getFillBackgroundColor());
  }
 
  public void testGetFillForegroundColor() {
    CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
    CTColor ctFgColor = ctPatternFill.addNewFgColor();
    ctFgColor.setIndexed(5);
    assertEquals(5, cellStyle.getFillForegroundColor());
  }
View Full Code Here

     *
     * @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 {
View Full Code Here

     * 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);
        return ctColor == null ? null : new XSSFColor(ctColor);
    }
View Full Code Here

     * References a color defined in theme.
     *
     * @return short - theme defined to use
     */
    public short getThemeColor() {
        CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
        long index = color == null ? 0 : color.getTheme();
        return (short) index;
    }
View Full Code Here

     * @param color - color to use
     * @see #DEFAULT_FONT_COLOR - Note: default font color
     * @see IndexedColors
     */
    public void setColor(short color) {
        CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
        switch (color) {
            case Font.COLOR_NORMAL: {
                ctColor.setIndexed(XSSFFont.DEFAULT_FONT_COLOR);
                break;
            }
            case Font.COLOR_RED: {
                ctColor.setIndexed(IndexedColors.RED.getIndex());
                break;
            }
            default:
                ctColor.setIndexed(color);
        }
    }
View Full Code Here

     * @param color - color to use
     */
    public void setColor(XSSFColor color) {
        if(color == null) _ctFont.setColorArray(null);
        else {
            CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
            ctColor.setRgb(color.getRgb());
        }
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.drawingml.x2006.main.CTColor

Copyright © 2018 www.massapicom. 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.