Esempio n. 1
0
        private void SetAllNull()
        {
            Formulas            = new List <Formula>();
            ColorScale          = new SLColorScale2010();
            HasColorScale       = false;
            DataBar             = new SLDataBar2010();
            HasDataBar          = false;
            IconSet             = new SLIconSet2010();
            HasIconSet          = false;
            DifferentialType    = new SLDifferentialFormat();
            HasDifferentialType = false;

            Type = null;

            Priority          = null;
            StopIfTrue        = false;
            AboveAverage      = true;
            Percent           = false;
            Bottom            = false;
            Operator          = ConditionalFormattingOperatorValues.Equal;
            HasOperator       = false;
            Text              = null;
            TimePeriod        = TimePeriodValues.Today;
            HasTimePeriod     = false;
            Rank              = null;
            StandardDeviation = null;
            EqualAverage      = false;
            ActivePresent     = false;
            Id = null;
        }
        internal SLIconSet2010 Clone()
        {
            var ics = new SLIconSet2010();

            int i;

            ics.Cfvos = new List <SLConditionalFormattingValueObject2010>();
            for (i = 0; i < Cfvos.Count; ++i)
            {
                ics.Cfvos.Add(Cfvos[i].Clone());
            }

            ics.CustomIcons = new List <SLConditionalFormattingIcon2010>();
            for (i = 0; i < CustomIcons.Count; ++i)
            {
                ics.CustomIcons.Add(CustomIcons[i].Clone());
            }

            ics.IconSetType = IconSetType;
            ics.ShowValue   = ShowValue;
            ics.Percent     = Percent;
            ics.Reverse     = Reverse;

            return(ics);
        }
Esempio n. 3
0
        internal void FromConditionalFormattingRule(X14.ConditionalFormattingRule cfr)
        {
            SetAllNull();

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

            using (var oxr = OpenXmlReader.Create(cfr))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Formula))
                    {
                        Formulas.Add((Formula)oxr.LoadCurrentElement().CloneNode(true));
                    }
                    else if (oxr.ElementType == typeof(X14.ColorScale))
                    {
                        ColorScale = new SLColorScale2010();
                        ColorScale.FromColorScale((X14.ColorScale)oxr.LoadCurrentElement());
                        HasColorScale = true;
                    }
                    else if (oxr.ElementType == typeof(X14.DataBar))
                    {
                        DataBar = new SLDataBar2010();
                        DataBar.FromDataBar((X14.DataBar)oxr.LoadCurrentElement());
                        HasDataBar = true;
                    }
                    else if (oxr.ElementType == typeof(X14.IconSet))
                    {
                        IconSet = new SLIconSet2010();
                        IconSet.FromIconSet((X14.IconSet)oxr.LoadCurrentElement());
                        HasIconSet = true;
                    }
                    else if (oxr.ElementType == typeof(X14.DifferentialType))
                    {
                        DifferentialType = new SLDifferentialFormat();
                        DifferentialType.FromDifferentialType((X14.DifferentialType)oxr.LoadCurrentElement());
                        HasDifferentialType = true;
                    }
                }
            }
        }