Ejemplo n.º 1
0
        /**
         * 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);
        }
Ejemplo n.º 2
0
        private void SetFillForegroundColor(CT_Color color)
        {
            CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.GetPatternFill() : _fill.AddNewPatternFill();

            if (color == null)
            {
                ptrn.UnsetFgColor();
            }
            else
            {
                ptrn.fgColor = (color);
            }
        }