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

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



public class TestXSSFCellFill extends TestCase {

    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


        bgColor.setIndexed(2);
        assertEquals(2, cellFill.getFillBackgroundColor().getIndexed());
    }

    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

        fgColor.setIndexed(8);
        assertEquals(8, cellFill.getFillForegroundColor().getIndexed());
    }

    public void testGetSetPatternType() {
        CTFill ctFill = CTFill.Factory.newInstance();
        XSSFCellFill cellFill = new XSSFCellFill(ctFill);
        CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
        ctPatternFill.setPatternType(STPatternType.SOLID);
        //assertEquals(FillPatternType.SOLID_FOREGROUND.ordinal(), cellFill.getPatternType().ordinal());
    }
View Full Code Here

        ctPatternFill.setPatternType(STPatternType.SOLID);
        //assertEquals(FillPatternType.SOLID_FOREGROUND.ordinal(), cellFill.getPatternType().ordinal());
    }

    public void testGetNotModifies() {
        CTFill ctFill = CTFill.Factory.newInstance();
        XSSFCellFill cellFill = new XSSFCellFill(ctFill);
        CTPatternFill ctPatternFill = ctFill.addNewPatternFill();
        ctPatternFill.setPatternType(STPatternType.DARK_DOWN);
        assertEquals(8, cellFill.getPatternType().intValue());
    }
View Full Code Here

  private void initialize() {
    //CTFont ctFont = createDefaultFont();
    XSSFFont xssfFont = createDefaultFont();
      fonts.add(xssfFont.getCTFont());
     
      CTFill ctFill = createDefaultFill();
      fills.add(ctFill);
     
      CTBorder ctBorder = createDefaultBorder();
      borders.add(ctBorder);
     
View Full Code Here

      ctBorder.addNewDiagonal();
    return ctBorder;
  }
 
  private CTFill createDefaultFill() {
    CTFill ctFill = CTFill.Factory.newInstance();
      ctFill.addNewPatternFill().setPatternType(STPatternType.NONE);
    return ctFill;
  }
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

                for (CTNumFmt nfmt : ctfmts.getNumFmtArray()) {
                    numberFormats.put((int)nfmt.getNumFmtId(), nfmt.getFormatCode());
                }
            }

            CTFonts ctfonts = styleSheet.getFonts();
            if(ctfonts != null){
        int idx = 0;
        for (CTFont font : ctfonts.getFontArray()) {
           // Create the font and save it. Themes Table supplied later
          XSSFFont f = new XSSFFont(font, idx);
          fonts.add(f);
          idx++;
        }
View Full Code Here

TOP

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

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.