CTPatternFill ptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill(); if(fp == NO_FILL && ptrn.isSetPatternType()) ptrn.unsetPatternType(); else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1));
/** * This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern), * foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element. * * @param pattern the fill pattern to use * @see #setFillBackgroundColor(XSSFColor) * @see #setFillForegroundColor(XSSFColor) * @see org.apache.poi.ss.usermodel.FillPatternType */ @Override public void setFillPattern(FillPatternType pattern) { CTFill ct = getCTFill(); CTPatternFill ctptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill(); if (pattern == FillPatternType.NO_FILL && ctptrn.isSetPatternType()) { ctptrn.unsetPatternType(); } else { ctptrn.setPatternType(STPatternType.Enum.forInt(pattern.getCode() + 1)); } addFill(ct); }
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)); } }
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)); } }
/** * This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern), * foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element. * * @param pattern the fill pattern to use * @see #setFillBackgroundColor(XSSFColor) * @see #setFillForegroundColor(XSSFColor) * @see org.apache.poi.ss.usermodel.FillPatternType */ @Override public void setFillPattern(FillPatternType pattern) { CTFill ct = getCTFill(); CTPatternFill ctptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill(); if (pattern == FillPatternType.NO_FILL && ctptrn.isSetPatternType()) { ctptrn.unsetPatternType(); } else { ctptrn.setPatternType(STPatternType.Enum.forInt(pattern.getCode() + 1)); } addFill(ct); }
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)); } }