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

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


    xssfFont.setFontName("Courier");
    assertEquals("Courier",ctFont.getNameArray(0).getVal());
  }

  public void testItalic() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTBooleanProperty bool=ctFont.addNewI();
    bool.setVal(false);
    ctFont.setIArray(0,bool);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getItalic());

    xssfFont.setItalic(true);
    assertEquals(ctFont.getIArray().length,1);
    assertEquals(true, ctFont.getIArray(0).getVal());
    assertEquals(true,ctFont.getIArray(0).getVal());
  }
View Full Code Here


    assertEquals(true, ctFont.getIArray(0).getVal());
    assertEquals(true,ctFont.getIArray(0).getVal());
  }

  public void testStrikeout() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTBooleanProperty bool=ctFont.addNewStrike();
    bool.setVal(false);
    ctFont.setStrikeArray(0,bool);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getStrikeout());

    xssfFont.setStrikeout(true);
    assertEquals(ctFont.getStrikeArray().length,1);
    assertEquals(true, ctFont.getStrikeArray(0).getVal());
    assertEquals(true,ctFont.getStrikeArray(0).getVal());
  }
View Full Code Here

    assertEquals(true, ctFont.getStrikeArray(0).getVal());
    assertEquals(true,ctFont.getStrikeArray(0).getVal());
  }

  public void testFontHeight() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTFontSize size=ctFont.addNewSz();
    size.setVal(11);
    ctFont.setSzArray(0,size);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(11,xssfFont.getFontHeight());

    xssfFont.setFontHeight((short)20);
    assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
  }
View Full Code Here

    xssfFont.setFontHeight((short)20);
    assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
  }

  public void testFontHeightInPoint() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTFontSize size=ctFont.addNewSz();
    size.setVal(14);
    ctFont.setSzArray(0,size);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(14,xssfFont.getFontHeightInPoints());

    xssfFont.setFontHeightInPoints((short)20);
    assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
  }
View Full Code Here

    xssfFont.setFontHeightInPoints((short)20);
    assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
  }

  public void testUnderline() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTUnderlineProperty underlinePropr=ctFont.addNewU();
    underlinePropr.setVal(STUnderlineValues.SINGLE);
    ctFont.setUArray(0,underlinePropr);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(Font.U_SINGLE, xssfFont.getUnderline());

    xssfFont.setUnderline(Font.U_DOUBLE);
    assertEquals(ctFont.getUArray().length,1);
    assertEquals(STUnderlineValues.DOUBLE,ctFont.getUArray(0).getVal());
   
    xssfFont.setUnderline(FontUnderline.DOUBLE_ACCOUNTING);
    assertEquals(ctFont.getUArray().length,1);
    assertEquals(STUnderlineValues.DOUBLE_ACCOUNTING,ctFont.getUArray(0).getVal());
  }
View Full Code Here

    assertEquals(ctFont.getUArray().length,1);
    assertEquals(STUnderlineValues.DOUBLE_ACCOUNTING,ctFont.getUArray(0).getVal());
  }

  public void testColor() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTColor color=ctFont.addNewColor();
    color.setIndexed(XSSFFont.DEFAULT_FONT_COLOR);
    ctFont.setColorArray(0,color);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(IndexedColors.BLACK.getIndex(),xssfFont.getColor());

    xssfFont.setColor(IndexedColors.RED.getIndex());
    assertEquals(IndexedColors.RED.getIndex(), ctFont.getColorArray(0).getIndexed());
  }
View Full Code Here

    xssfFont.setColor(IndexedColors.RED.getIndex());
    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

    xssfFont.setColor(newColor);
    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());

    xssfFont.setThemeColor(IndexedColors.RED.getIndex());
    assertEquals(IndexedColors.RED.getIndex(),ctFont.getColorArray(0).getTheme());
  }
View Full Code Here

    xssfFont.setThemeColor(IndexedColors.RED.getIndex());
    assertEquals(IndexedColors.RED.getIndex(),ctFont.getColorArray(0).getTheme());
  }

  public void testFamily() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTIntProperty family=ctFont.addNewFamily();
    family.setVal(FontFamily.MODERN.getValue());
    ctFont.setFamilyArray(0,family);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(FontFamily.MODERN.getValue(),xssfFont.getFamily());
  }
View Full Code Here

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(FontFamily.MODERN.getValue(),xssfFont.getFamily());
  }

  public void testScheme() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTFontScheme scheme=ctFont.addNewScheme();
    scheme.setVal(STFontScheme.MAJOR);
    ctFont.setSchemeArray(0,scheme);

    XSSFFont font=new XSSFFont(ctFont);
    assertEquals(FontScheme.MAJOR,font.getScheme());

    font.setScheme(FontScheme.NONE);
    assertEquals(STFontScheme.NONE,ctFont.getSchemeArray(0).getVal());
  }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont

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.