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

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


    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

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

  public void testTypeOffset() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTVerticalAlignFontProperty valign=ctFont.addNewVertAlign();
    valign.setVal(STVerticalAlignRun.BASELINE);
    ctFont.setVertAlignArray(0,valign);

    XSSFFont font=new XSSFFont(ctFont);
    assertEquals(Font.SS_NONE,font.getTypeOffset());

    font.setTypeOffset(XSSFFont.SS_SUPER);
    assertEquals(STVerticalAlignRun.SUPERSCRIPT,ctFont.getVertAlignArray(0).getVal());
  }
View Full Code Here

    ctFill[1].addNewPatternFill().setPatternType(STPatternType.DARK_GRAY);
    return ctFill;
  }

  private static XSSFFont createDefaultFont() {
    CTFont ctFont = CTFont.Factory.newInstance();
    XSSFFont xssfFont=new XSSFFont(ctFont, 0);
    xssfFont.setFontHeightInPoints(XSSFFont.DEFAULT_FONT_SIZE);
    xssfFont.setColor(XSSFFont.DEFAULT_FONT_COLOR);//setTheme
    xssfFont.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    xssfFont.setFamily(FontFamily.SWISS);
View Full Code Here

    ctFill[1].addNewPatternFill().setPatternType(STPatternType.DARK_GRAY);
    return ctFill;
  }

  private static XSSFFont createDefaultFont() {
    CTFont ctFont = CTFont.Factory.newInstance();
    XSSFFont xssfFont=new XSSFFont(ctFont, 0);
    xssfFont.setFontHeightInPoints(XSSFFont.DEFAULT_FONT_SIZE);
    xssfFont.setColor(XSSFFont.DEFAULT_FONT_COLOR);//setTheme
    xssfFont.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    xssfFont.setFamily(FontFamily.SWISS);
View Full Code Here

    XSSFFont xssfFont=new XSSFFont();
    assertNotNull(xssfFont.getCTFont());
  }

  public void testBoldweight() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTBooleanProperty bool=ctFont.addNewB();
    bool.setVal(false);
    ctFont.setBArray(0,bool);
    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getBold());


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

    assertEquals(ctFont.getBArray().length,1);
    assertEquals(true, ctFont.getBArray(0).getVal());
  }

  public void testCharSet() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTIntProperty prop=ctFont.addNewCharset();
    prop.setVal(FontCharset.ANSI.getValue());

    ctFont.setCharsetArray(0,prop);
    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals(Font.ANSI_CHARSET,xssfFont.getCharSet());

    xssfFont.setCharSet(FontCharset.DEFAULT);
    assertEquals(FontCharset.DEFAULT.getValue(),ctFont.getCharsetArray(0).getVal());
   
   
    // Now try with a few sample files
   
    // Normal charset
View Full Code Here

            workbook.getSheetAt(0).getRow(0).getCell(0).getCellStyle().getFont().getCharSet()
      );
  }

  public void testFontName() {
    CTFont ctFont=CTFont.Factory.newInstance();
    CTFontName fname=ctFont.addNewName();
    fname.setVal("Arial");
    ctFont.setNameArray(0,fname);

    XSSFFont xssfFont=new XSSFFont(ctFont);
    assertEquals("Arial", xssfFont.getFontName());

    xssfFont.setFontName("Courier");
    assertEquals("Courier",ctFont.getNameArray(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.