/** * Set the foreground fill color as a indexed color value * * @param index - the color to use */ public void SetFillForegroundColor(int index) { CT_PatternFill ptrn = EnsureCTPatternFill(); CT_Color CT_Color = ptrn.IsSetFgColor() ? ptrn.fgColor : ptrn.AddNewFgColor(); CT_Color.indexed = (uint)index; }
public XMLFillModel DeepClone() { CT_Fill cT_Fill = new CT_Fill(); if (this._fill.PatternFill != null) { CT_PatternFill patternFill = this._fill.PatternFill; CT_PatternFill cT_PatternFill2 = cT_Fill.PatternFill = new CT_PatternFill(); if (patternFill.BgColor != null) { cT_PatternFill2.BgColor = this._palette.GetColorFromCT(patternFill.BgColor).Clone().Data; } if (patternFill.FgColor != null) { cT_PatternFill2.FgColor = this._palette.GetColorFromCT(patternFill.FgColor).Clone().Data; } cT_PatternFill2.PatternType_Attr = patternFill.PatternType_Attr; } cT_Fill.Choice_0 = this._fill.Choice_0; XMLFillModel xMLFillModel = new XMLFillModel(cT_Fill, this._palette); if (this._background != null) { xMLFillModel._background = this._background.Clone(); } if (this._foreground != null) { xMLFillModel._foreground = this._foreground.Clone(); } return(xMLFillModel); }
/** * Set the foreground fill color represented as a {@link XSSFColor} value. * <br/> * <i>Note: Ensure Foreground color is Set prior to background color.</i> * @param color the color to use * @see #setFillBackgroundColor(Npoi.Core.xssf.usermodel.XSSFColor) ) */ public void SetFillForegroundColor(XSSFColor color) { CT_Fill ct = GetCTFill(); CT_PatternFill ptrn = ct.GetPatternFill(); if (color == null) { if (ptrn != null) { ptrn.UnsetFgColor(); } } else { if (ptrn == null) { ptrn = ct.AddNewPatternFill(); } ptrn.fgColor = (color.GetCTColor()); } int idx = _stylesSource.PutFill(new XSSFCellFill(ct)); _cellXf.fillId = (uint)idx; _cellXf.applyFill = (true); }
/** * Set the background fill color represented as a indexed color value. * * @param index */ public void SetFillBackgroundColor(int index) { CT_PatternFill ptrn = EnsureCTPatternFill(); CT_Color ctColor = ptrn.IsSetBgColor() ? ptrn.bgColor : ptrn.AddNewBgColor(); ctColor.indexed = (uint)index; ctColor.indexedSpecified = true; }
public void SetFillBackgroundColor(int index) { CT_PatternFill ctPatternFill = this.EnsureCTPatternFill(); CT_Color ctColor = ctPatternFill.IsSetBgColor() ? ctPatternFill.bgColor : ctPatternFill.AddNewBgColor(); ctColor.indexed = (uint)index; ctColor.indexedSpecified = true; }
public void SetFillForegroundColor(XSSFColor color) { CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.GetPatternFill() : _fill.AddNewPatternFill(); CT_Color bgColor = color.GetCTColor(); ptrn.fgColor = (bgColor); }
public void TestGetSetPatternType() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); ctPatternFill.patternType = (ST_PatternType.solid); Assert.AreEqual(ST_PatternType.solid, cellFill.GetPatternType()); }
public void TestGetNotModifies() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); ctPatternFill.patternType = (ST_PatternType.darkDown); Assert.AreEqual(ST_PatternType.darkDown, cellFill.GetPatternType()); }
private CT_PatternFill EnsureCTPatternFill() { CT_PatternFill patternFill = _fill.GetPatternFill(); if (patternFill == null) { patternFill = _fill.AddNewPatternFill(); } return(patternFill); }
public ST_PatternType GetPatternType() { CT_PatternFill patternFill = this._fill.GetPatternFill(); if (patternFill != null) { return(patternFill.patternType); } return(ST_PatternType.none); }
public void TestGetFillForegroundColor() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); CT_Color fgColor = ctPatternFill.AddNewFgColor(); Assert.IsNotNull(cellFill.GetFillForegroundColor()); fgColor.indexed = 8; fgColor.indexedSpecified = true; Assert.AreEqual(8, cellFill.GetFillForegroundColor().Indexed); }
/** * Get the background fill color. * * @return fill color, null if color is not set */ public XSSFColor GetFillBackgroundColor() { CT_PatternFill ptrn = _fill.GetPatternFill(); if (ptrn == null) { return(null); } CT_Color CT_Color = ptrn.bgColor; return(CT_Color == null ? null : new XSSFColor(CT_Color)); }
private void SetFillForegroundColor(CT_Color color) { CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.GetPatternFill() : _fill.AddNewPatternFill(); if (color == null) { ptrn.UnsetFgColor(); } else { ptrn.fgColor = (color); } }
private void SetFillBackgroundColor(CT_Color color) { CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.patternFill : _fill.AddNewPatternFill(); if (color == null) { ptrn.UnsetBgColor(); } else { ptrn.bgColor = (color); } }
/** * Get the foreground fill color. * * @return XSSFColor - foreground color. null if color is not set */ public XSSFColor GetFillForegroundColor() { CT_PatternFill ptrn = _fill.GetPatternFill(); if (ptrn == null) { return(null); } CT_Color ctColor = ptrn.fgColor; return(ctColor == null ? null : new XSSFColor(ctColor)); }
public XSSFColor GetFillForegroundColor() { CT_PatternFill patternFill = this._fill.GetPatternFill(); if (patternFill == null) { return((XSSFColor)null); } CT_Color fgColor = patternFill.fgColor; if (fgColor != null) { return(new XSSFColor(fgColor)); } return((XSSFColor)null); }
public XSSFColor GetFillBackgroundColor() { CT_PatternFill patternFill = this._fill.GetPatternFill(); if (patternFill == null) { return((XSSFColor)null); } CT_Color bgColor = patternFill.bgColor; if (bgColor != null) { return(new XSSFColor(bgColor)); } return((XSSFColor)null); }
public void SetFillForegroundColor(XSSFColor color) { CT_Fill ctFill = this.GetCTFill(); CT_PatternFill ctPatternFill = ctFill.GetPatternFill(); if (color == null) { ctPatternFill?.unsetFgColor(); } else { if (ctPatternFill == null) { ctPatternFill = ctFill.AddNewPatternFill(); } ctPatternFill.fgColor = color.GetCTColor(); } this._cellXf.fillId = (uint)this._stylesSource.PutFill(new XSSFCellFill(ctFill)); this._cellXf.applyFill = true; }
/** * get the fill pattern * * @return fill pattern type. null if fill pattern is not set */ public ST_PatternType GetPatternType() { CT_PatternFill ptrn = _fill.GetPatternFill(); return(ptrn == null ? ST_PatternType.none : (ST_PatternType)ptrn.patternType); }
public void SetFillForegroundColor(int index) { CT_PatternFill ctPatternFill = this.EnsureCTPatternFill(); (ctPatternFill.IsSetFgColor() ? ctPatternFill.fgColor : ctPatternFill.AddNewFgColor()).indexed = (uint)index; }
/** * Set the foreground fill color represented as a {@link XSSFColor} value. * * @param color - the color to use */ public void SetFillForegroundColor(XSSFColor color) { CT_PatternFill ptrn = EnsureCTPatternFill(); ptrn.fgColor = color.GetCTColor(); }
/** * set the fill pattern * * @param patternType fill pattern to use */ public void SetPatternType(ST_PatternType patternType) { CT_PatternFill ptrn = EnsureCTPatternFill(); ptrn.patternType = patternType; }
/** * Set the background fill color represented as a {@link XSSFColor} value. * * @param color */ public void SetFillBackgroundColor(XSSFColor color) { CT_PatternFill ptrn = EnsureCTPatternFill(); ptrn.bgColor = (color.GetCTColor()); }