示例#1
0
        public void TwoInstancesOfCellStyleAreEqual()
        {
            Assert.AreEqualAndHaveSameHash(new CellStyle(), new CellStyle());

            Assert.AreEqualAndHaveSameHash(new BorderEdge() { Style = BorderStyle.DashDot }, new BorderEdge() { Style = BorderStyle.DashDot });
            Assert.AreEqualAndHaveSameHash(new Color(1, 2, 3, 4), new Color(1, 2, 3, 4));
            Assert.AreEqualAndHaveSameHash(new CellFont { Name = "T", Size = 10 }, new CellFont { Name = "T", Size = 10 });

            var c1 = new CellStyle
            {
                Alignment = new CellAlignment { HAlign = HorizontalAlignment.Center, Indent = 2 },
                Border = new CellBorder { Bottom = new BorderEdge { Color = new Color(1, 2, 3, 4), Style = BorderStyle.DashDot } },
                Fill = new CellFill { Background = new Color(2, 3, 4, 5), Pattern = FillPattern.Solid },
                Font = new CellFont { Bold = true, Name = "Tahoma" },
                Format = "{0}"
            };

            var c2 = new CellStyle
            {
                Alignment = new CellAlignment { HAlign = HorizontalAlignment.Center, Indent = 2 },
                Border = new CellBorder { Bottom = new BorderEdge { Color = new Color(1, 2, 3, 4), Style = BorderStyle.DashDot } },
                Fill = new CellFill { Background = new Color(2, 3, 4, 5), Pattern = FillPattern.Solid },
                Font = new CellFont { Bold = true, Name = "Tahoma" },
                Format = "{0}"
            };
        }
示例#2
0
        public CellStyle Apply(CellStyle style)
        {
            if (style.alignment != null)
                alignment = style.alignment;

            if (style.border != null)
                border = style.border;

            if (style.fill != null)
                fill = style.fill;

            if (style.font != null)
                font = style.font;

            if (style.format != null)
                format = style.format;

            return this;
        }
        public CFRule(CFType type, CellStyle style, CFOperator @operator = CFOperator.LessThan, 
            string formula1 = "", string formula2 = "", string formula3 = "")
        {
            Type = type;
            Style = style;
            Operator = @operator;
            Formula1 = formula1;
            Formula2 = formula2;
            Formula3 = formula3;
            IsBottom = false;
            Rank = 10;
            IsPercent = false;
            StdDev = 0;
            IsAboveAverage = true;
            IsEqualAverage = false;
            IsStdDev = false;

            Text = null;
            TimePeriod = TimePeriod.Today;
        }