Example #1
0
        internal X14.ConditionalFormattingRule ToConditionalFormattingRule()
        {
            var cfr = new X14.ConditionalFormattingRule();

            if (Type != null)
            {
                cfr.Type = Type.Value;
            }
            if (Priority != null)
            {
                cfr.Priority = Priority.Value;
            }
            if (StopIfTrue)
            {
                cfr.StopIfTrue = StopIfTrue;
            }
            if (!AboveAverage)
            {
                cfr.AboveAverage = AboveAverage;
            }
            if (Percent)
            {
                cfr.Percent = Percent;
            }
            if (Bottom)
            {
                cfr.Bottom = Bottom;
            }
            if (HasOperator)
            {
                cfr.Operator = Operator;
            }
            if ((Text != null) && (Text.Length > 0))
            {
                cfr.Text = Text;
            }
            if (HasTimePeriod)
            {
                cfr.TimePeriod = TimePeriod;
            }
            if (Rank != null)
            {
                cfr.Rank = Rank.Value;
            }
            if (StandardDeviation != null)
            {
                cfr.StandardDeviation = StandardDeviation.Value;
            }
            if (EqualAverage)
            {
                cfr.EqualAverage = EqualAverage;
            }
            if (ActivePresent)
            {
                cfr.ActivePresent = ActivePresent;
            }
            if (Id != null)
            {
                cfr.Id = Id;
            }

            foreach (var f in Formulas)
            {
                cfr.Append((Formula)f.CloneNode(true));
            }
            if (HasColorScale)
            {
                cfr.Append(ColorScale.ToColorScale());
            }
            if (HasDataBar)
            {
                cfr.Append(DataBar.ToDataBar(Priority != null));
            }
            if (HasIconSet)
            {
                cfr.Append(IconSet.ToIconSet());
            }
            if (HasDifferentialType)
            {
                cfr.Append(DifferentialType.ToDifferentialType());
            }

            return(cfr);
        }
        internal ConditionalFormattingRule ToConditionalFormattingRule()
        {
            var cfr = new ConditionalFormattingRule();

            cfr.Type = Type;
            if (FormatId != null)
            {
                cfr.FormatId = FormatId.Value;
            }
            cfr.Priority = Priority;
            if (StopIfTrue)
            {
                cfr.StopIfTrue = StopIfTrue;
            }
            if (!AboveAverage)
            {
                cfr.AboveAverage = AboveAverage;
            }
            if (Percent)
            {
                cfr.Percent = Percent;
            }
            if (Bottom)
            {
                cfr.Bottom = Bottom;
            }
            if (HasOperator)
            {
                cfr.Operator = Operator;
            }
            if ((Text != null) && (Text.Length > 0))
            {
                cfr.Text = Text;
            }
            if (HasTimePeriod)
            {
                cfr.TimePeriod = TimePeriod;
            }
            if (Rank != null)
            {
                cfr.Rank = Rank.Value;
            }
            if (StdDev != null)
            {
                cfr.StdDev = StdDev.Value;
            }
            if (EqualAverage)
            {
                cfr.EqualAverage = EqualAverage;
            }

            foreach (var f in Formulas)
            {
                cfr.Append((Formula)f.CloneNode(true));
            }
            if (HasColorScale)
            {
                cfr.Append(ColorScale.ToColorScale());
            }
            if (HasDataBar)
            {
                cfr.Append(DataBar.ToDataBar());
            }
            if (HasIconSet)
            {
                cfr.Append(IconSet.ToIconSet());
            }

            if (Extensions.Count > 0)
            {
                var extlist = new ConditionalFormattingRuleExtensionList();
                foreach (var ext in Extensions)
                {
                    extlist.Append((ConditionalFormattingRuleExtension)ext.CloneNode(true));
                }
                cfr.Append(extlist);
            }

            return(cfr);
        }