internal void FromConditionalFormatting(X14.ConditionalFormatting cf)
        {
            SetAllNull();

            if (cf.Pivot != null)
            {
                Pivot = cf.Pivot.Value;
            }

            using (var oxr = OpenXmlReader.Create(cf))
            {
                while (oxr.Read())
                {
                    SLConditionalFormattingRule2010 cfr;
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingRule))
                    {
                        cfr = new SLConditionalFormattingRule2010();
                        cfr.FromConditionalFormattingRule((X14.ConditionalFormattingRule)oxr.LoadCurrentElement());
                        Rules.Add(cfr);
                    }
                    else if (oxr.ElementType == typeof(ReferenceSequence))
                    {
                        var refseq = (ReferenceSequence)oxr.LoadCurrentElement();
                        ReferenceSequence = SLTool.TranslateRefSeqToCellPointRange(refseq);
                    }
                }
            }
        }
Exemple #2
0
        internal SLConditionalFormattingRule2010 Clone()
        {
            var cfr = new SLConditionalFormattingRule2010();

            cfr.Formulas = new List <Formula>();
            for (var i = 0; i < Formulas.Count; ++i)
            {
                cfr.Formulas.Add((Formula)Formulas[i].CloneNode(true));
            }

            cfr.HasColorScale       = HasColorScale;
            cfr.ColorScale          = ColorScale.Clone();
            cfr.HasDataBar          = HasDataBar;
            cfr.DataBar             = DataBar.Clone();
            cfr.HasIconSet          = HasIconSet;
            cfr.IconSet             = IconSet.Clone();
            cfr.HasDifferentialType = HasDifferentialType;
            cfr.DifferentialType    = DifferentialType.Clone();

            cfr.Type              = Type;
            cfr.Priority          = Priority;
            cfr.StopIfTrue        = StopIfTrue;
            cfr.AboveAverage      = AboveAverage;
            cfr.Percent           = Percent;
            cfr.Bottom            = Bottom;
            cfr.HasOperator       = HasOperator;
            cfr.Operator          = Operator;
            cfr.Text              = Text;
            cfr.HasTimePeriod     = HasTimePeriod;
            cfr.TimePeriod        = TimePeriod;
            cfr.Rank              = Rank;
            cfr.StandardDeviation = StandardDeviation;
            cfr.EqualAverage      = EqualAverage;
            cfr.ActivePresent     = ActivePresent;
            cfr.Id = Id;

            return(cfr);
        }