コード例 #1
0
        /**
         * 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;
        }
コード例 #2
0
        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);
        }
コード例 #3
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);
        }
コード例 #4
0
        /**
         * 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;
        }
コード例 #5
0
ファイル: XSSFCellFill.cs プロジェクト: thachgiasoft/shuijin
        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;
        }
コード例 #6
0
        public void SetFillForegroundColor(XSSFColor color)
        {
            CT_PatternFill ptrn =
                _fill.IsSetPatternFill() ? _fill.GetPatternFill() : _fill.AddNewPatternFill();
            CT_Color bgColor = color.GetCTColor();

            ptrn.fgColor = (bgColor);
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        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());
        }
コード例 #9
0
        private CT_PatternFill EnsureCTPatternFill()
        {
            CT_PatternFill patternFill = _fill.GetPatternFill();

            if (patternFill == null)
            {
                patternFill = _fill.AddNewPatternFill();
            }
            return(patternFill);
        }
コード例 #10
0
ファイル: XSSFCellFill.cs プロジェクト: thachgiasoft/shuijin
        public ST_PatternType GetPatternType()
        {
            CT_PatternFill patternFill = this._fill.GetPatternFill();

            if (patternFill != null)
            {
                return(patternFill.patternType);
            }
            return(ST_PatternType.none);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        /**
         * 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));
        }
コード例 #13
0
ファイル: XSSFPatternFormatting.cs プロジェクト: founshi/npoi
        private void SetFillForegroundColor(CT_Color color)
        {
            CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.GetPatternFill() : _fill.AddNewPatternFill();

            if (color == null)
            {
                ptrn.UnsetFgColor();
            }
            else
            {
                ptrn.fgColor = (color);
            }
        }
コード例 #14
0
ファイル: XSSFPatternFormatting.cs プロジェクト: founshi/npoi
        private void SetFillBackgroundColor(CT_Color color)
        {
            CT_PatternFill ptrn = _fill.IsSetPatternFill() ? _fill.patternFill : _fill.AddNewPatternFill();

            if (color == null)
            {
                ptrn.UnsetBgColor();
            }
            else
            {
                ptrn.bgColor = (color);
            }
        }
コード例 #15
0
        /**
         * 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));
        }
コード例 #16
0
ファイル: XSSFCellFill.cs プロジェクト: thachgiasoft/shuijin
        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);
        }
コード例 #17
0
ファイル: XSSFCellFill.cs プロジェクト: thachgiasoft/shuijin
        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);
        }
コード例 #18
0
        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;
        }
コード例 #19
0
        /**
         * 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);
        }
コード例 #20
0
ファイル: XSSFCellFill.cs プロジェクト: thachgiasoft/shuijin
        public void SetFillForegroundColor(int index)
        {
            CT_PatternFill ctPatternFill = this.EnsureCTPatternFill();

            (ctPatternFill.IsSetFgColor() ? ctPatternFill.fgColor : ctPatternFill.AddNewFgColor()).indexed = (uint)index;
        }
コード例 #21
0
        /**
         * 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();
        }
コード例 #22
0
        /**
         * set the fill pattern
         *
         * @param patternType fill pattern to use
         */
        public void SetPatternType(ST_PatternType patternType)
        {
            CT_PatternFill ptrn = EnsureCTPatternFill();

            ptrn.patternType = patternType;
        }
コード例 #23
0
        /**
         * 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());
        }