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

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


        return (short)(_fill.getPatternFill().getPatternType().intValue() - 1);
     }

    public void setFillBackgroundColor(short bg){
        CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
        CTColor bgColor = CTColor.Factory.newInstance();
        bgColor.setIndexed(bg);
        ptrn.setBgColor(bgColor);
    }
View Full Code Here


        bgColor.setIndexed(bg);
        ptrn.setBgColor(bgColor);
    }

    public void setFillForegroundColor(short fg){
        CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
        CTColor fgColor = CTColor.Factory.newInstance();
        fgColor.setIndexed(fg);
        ptrn.setFgColor(fgColor);
    }
View Full Code Here

        fgColor.setIndexed(fg);
        ptrn.setFgColor(fgColor);
    }

    public void setFillPattern(short fp){
        CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
        if(fp == NO_FILL) ptrn.unsetPatternType();
        else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1));
    }
View Full Code Here

     *
     * @param color - the color to use
     */
    public void setFillBackgroundColor(XSSFColor color) {
        CTFill ct = getCTFill();
        CTPatternFill ptrn = ct.getPatternFill();
        if(color == null) {
            if(ptrn != null) ptrn.unsetBgColor();
        } else {
            if(ptrn == null) ptrn = ct.addNewPatternFill();
            ptrn.setBgColor(color.getCTColor());
        }

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

        _cellXf.setFillId(idx);
View Full Code Here

    * @see #setFillBackgroundColor(org.apache.poi.xssf.usermodel.XSSFColor) )
    */
    public void setFillForegroundColor(XSSFColor color) {
        CTFill ct = getCTFill();

        CTPatternFill ptrn = ct.getPatternFill();
        if(color == null) {
            if(ptrn != null) ptrn.unsetFgColor();
        } else {
            if(ptrn == null) ptrn = ct.addNewPatternFill();
            ptrn.setFgColor(color.getCTColor());
        }

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

        _cellXf.setFillId(idx);
View Full Code Here

     * @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));

        _cellXf.setFillId(idx);
        _cellXf.setApplyFill(true);
View Full Code Here

     * Get the background fill color.
     *
     * @return fill color, null if color is not set
     */
    public XSSFColor getFillBackgroundColor() {
        CTPatternFill ptrn = _fill.getPatternFill();
        if (ptrn == null) return null;

        CTColor ctColor = ptrn.getBgColor();
        return ctColor == null ? null : new XSSFColor(ctColor);
    }
View Full Code Here

     * Set the background fill color represented as a indexed color value.
     *
     * @param index
     */
    public void setFillBackgroundColor(int index) {
        CTPatternFill ptrn = ensureCTPatternFill();
        CTColor ctColor = ptrn.isSetBgColor() ? ptrn.getBgColor() : ptrn.addNewBgColor();
        ctColor.setIndexed(index);
    }
View Full Code Here

     * Set the background fill color represented as a {@link XSSFColor} value.
     *
     * @param color
     */
    public void setFillBackgroundColor(XSSFColor color) {
        CTPatternFill ptrn = ensureCTPatternFill();
        ptrn.setBgColor(color.getCTColor());
    }
View Full Code Here

     * Get the foreground fill color.
     *
     * @return XSSFColor - foreground color. null if color is not set
     */
    public XSSFColor getFillForegroundColor() {
        CTPatternFill ptrn = _fill.getPatternFill();
        if (ptrn == null) return null;

        CTColor ctColor = ptrn.getFgColor();
        return ctColor == null ? null : new XSSFColor(ctColor);
    }
View Full Code Here

TOP

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

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.