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

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


    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


                     (new XSSFDataFormat(_stylesSource)).getFormat(fmt)
               );
              
               // Copy the font
               try {
                  CTFont ctFont = CTFont.Factory.parse(
                        src.getFont().getCTFont().toString()
                  );
                  XSSFFont font = new XSSFFont(ctFont);
                  font.registerTo(_stylesSource);
                  setFont(font);
View Full Code Here

    /**
     *
     * CTRPrElt --> CTFont adapter
     */
    protected static CTFont toCTFont(CTRPrElt pr){
        CTFont ctFont =  CTFont.Factory.newInstance();

        if(pr.sizeOfBArray() > 0) ctFont.addNewB().setVal(pr.getBArray(0).getVal());
        if(pr.sizeOfUArray() > 0) ctFont.addNewU().setVal(pr.getUArray(0).getVal());
        if(pr.sizeOfIArray() > 0) ctFont.addNewI().setVal(pr.getIArray(0).getVal());
        if(pr.sizeOfColorArray() > 0) {
            CTColor c1 = pr.getColorArray(0);
            CTColor c2 = ctFont.addNewColor();
            if(c1.isSetAuto()) c2.setAuto(c1.getAuto());
            if(c1.isSetIndexed()) c2.setIndexed(c1.getIndexed());
            if(c1.isSetRgb()) c2.setRgb(c1.getRgb());
            if(c1.isSetTheme()) c2.setTheme(c1.getTheme());
            if(c1.isSetTint()) c2.setTint(c1.getTint());
        }
        if(pr.sizeOfSzArray() > 0) ctFont.addNewSz().setVal(pr.getSzArray(0).getVal());
        if(pr.sizeOfRFontArray() > 0) ctFont.addNewName().setVal(pr.getRFontArray(0).getVal());
        if(pr.sizeOfFamilyArray() > 0) ctFont.addNewFamily().setVal(pr.getFamilyArray(0).getVal());
        if(pr.sizeOfSchemeArray() > 0) ctFont.addNewScheme().setVal(pr.getSchemeArray(0).getVal());
        if(pr.sizeOfCharsetArray() > 0) ctFont.addNewCharset().setVal(pr.getCharsetArray(0).getVal());
        if(pr.sizeOfCondenseArray() > 0) ctFont.addNewCondense().setVal(pr.getCondenseArray(0).getVal());
        if(pr.sizeOfExtendArray() > 0) ctFont.addNewExtend().setVal(pr.getExtendArray(0).getVal());
        if(pr.sizeOfVertAlignArray() > 0) ctFont.addNewVertAlign().setVal(pr.getVertAlignArray(0).getVal());
        if(pr.sizeOfOutlineArray() > 0) ctFont.addNewOutline().setVal(pr.getOutlineArray(0).getVal());
        if(pr.sizeOfShadowArray() > 0) ctFont.addNewShadow().setVal(pr.getShadowArray(0).getVal());
        if(pr.sizeOfStrikeArray() > 0) ctFont.addNewStrike().setVal(pr.getStrikeArray(0).getVal());

        return ctFont;
    }
View Full Code Here

                     (new XSSFDataFormat(_stylesSource)).getFormat(fmt)
               );
              
               // Copy the font
               try {
                  CTFont ctFont = CTFont.Factory.parse(
                        src.getFont().getCTFont().toString()
                  );
                  XSSFFont font = new XSSFFont(ctFont);
                  font.registerTo(_stylesSource);
                  setFont(font);
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());
  }
View Full Code Here

    xssfFont.setCharSet(FontCharset.DEFAULT);
    assertEquals(FontCharset.DEFAULT.getValue(),ctFont.getCharsetArray(0).getVal());
  }

  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

    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

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.