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

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


     * @see #setFillBackgroundColor(short)
     * @see #setFillForegroundColor(short)
     * @param fp  fill pattern (set to {@link org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND} to fill w/foreground color)
     */
   public void setFillPattern(short fp) {
        CTFill ct = getCTFill();
        CTPatternFill ptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill();
        if(fp == NO_FILL && ptrn.isSetPatternType()) ptrn.unsetPatternType();
        else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1));

        int idx = _stylesSource.putFill(new XSSFCellFill(ct));

View Full Code Here


          XSSFFont f = new XSSFFont(font, idx);
          fonts.add(f);
          idx++;
        }
      }
            CTFills ctfills = styleSheet.getFills();
            if(ctfills != null){
                for (CTFill fill : ctfills.getFillArray()) {
                    fills.add(new XSSFCellFill(fill));
                }
            }

            CTBorders ctborders = styleSheet.getBorders();
View Full Code Here

    for(XSSFFont f : fonts) ctfnt[idx++] = f.getCTFont();
    ctFonts.setFontArray(ctfnt);
    styleSheet.setFonts(ctFonts);

    // Fills
    CTFills ctFills = CTFills.Factory.newInstance();
    ctFills.setCount(fills.size());
    CTFill[] ctf = new CTFill[fills.size()];
    idx = 0;
    for(XSSFCellFill f : fills) ctf[idx++] = f.getCTFill();
    ctFills.setFillArray(ctf);
    styleSheet.setFills(ctFills);

    // Borders
    CTBorders ctBorders = CTBorders.Factory.newInstance();
    ctBorders.setCount(borders.size());
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

                     (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

    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());
View Full Code Here

     * get the name of the font (i.e. Arial)
     *
     * @return String - a string representing the name of the font to use
     */
    public String getFontName() {
        CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0);
        return name == null ? DEFAULT_FONT_NAME : name.getVal();
    }
View Full Code Here

     *
     * @param name - value representing the name of the font to use
     * @see #DEFAULT_FONT_NAME
     */
    public void setFontName(String name) {
        CTFontName fontName = _ctFont.sizeOfNameArray() == 0 ? _ctFont.addNewName() : _ctFont.getNameArray(0);
        fontName.setVal(name == null ? DEFAULT_FONT_NAME : name);
    }
View Full Code Here

    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());
View Full Code Here

    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());
View Full Code Here

TOP

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

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.