Package org.openxmlformats.schemas.spreadsheetml.x2006.main

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


    assertEquals(IndexedColors.RED.getIndex(), ctFont.getColorArray(0).getIndexed());
  }

  public void testRgbColor() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTColor color=ctFont.addNewColor();

    color.setRgb(Integer.toHexString(0xFFFFFF).getBytes());
    ctFont.setColorArray(0,color);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(ctFont.getColorArray(0).getRgb()[0],xssfFont.getXSSFColor().getRgb()[0]);
    assertEquals(ctFont.getColorArray(0).getRgb()[1],xssfFont.getXSSFColor().getRgb()[1]);
    assertEquals(ctFont.getColorArray(0).getRgb()[2],xssfFont.getXSSFColor().getRgb()[2]);
    assertEquals(ctFont.getColorArray(0).getRgb()[3],xssfFont.getXSSFColor().getRgb()[3]);

    color.setRgb(Integer.toHexString(0xF1F1F1).getBytes());
    XSSFColor newColor=new XSSFColor(color);
    xssfFont.setColor(newColor);
    assertEquals(ctFont.getColorArray(0).getRgb()[2],newColor.getRgb()[2]);
  }
View Full Code Here


    assertEquals(ctFont.getColorArray(0).getRgb()[2],newColor.getRgb()[2]);
  }

  public void testThemeColor() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTColor color=ctFont.addNewColor();
    color.setTheme(1);
    ctFont.setColorArray(0,color);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(ctFont.getColorArray(0).getTheme(),xssfFont.getThemeColor());
View Full Code Here

 
  public void testGetFillBackgroundColor() {
    CTFill ctFill = CTFill.Factory.newInstance();
    XSSFCellFill cellFill = new XSSFCellFill(ctFill);
    CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
    CTColor bgColor = ctPatternFill.addNewBgColor();
    assertNotNull(cellFill.getFillBackgroundColor());
    bgColor.setIndexed(2);
    assertEquals(2, cellFill.getFillBackgroundColor().getIndexed());
  }
View Full Code Here

 
  public void testGetFillForegroundColor() {
    CTFill ctFill = CTFill.Factory.newInstance();
    XSSFCellFill cellFill = new XSSFCellFill(ctFill);
    CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
    CTColor fgColor = ctPatternFill.addNewFgColor();
    assertNotNull(cellFill.getFillForegroundColor());
    fgColor.setIndexed(8);
    assertEquals(8, cellFill.getFillForegroundColor().getIndexed());
  }
View Full Code Here

    ctBorderA.addNewTop().setStyle(STBorderStyle.HAIR);
    assertEquals("hair", cellStyle.getBorderTopAsString());
  }
 
  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

    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

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.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.