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 SLDataBar2010 Clone()
        {
            var db = new SLDataBar2010();

            db.Cfvo1                                = Cfvo1.Clone();
            db.Cfvo2                                = Cfvo2.Clone();
            db.FillColor                            = FillColor.Clone();
            db.BorderColor                          = BorderColor.Clone();
            db.NegativeFillColor                    = NegativeFillColor.Clone();
            db.NegativeBorderColor                  = NegativeBorderColor.Clone();
            db.AxisColor                            = AxisColor.Clone();
            db.MinLength                            = MinLength;
            db.MaxLength                            = MaxLength;
            db.ShowValue                            = ShowValue;
            db.Border                               = Border;
            db.Gradient                             = Gradient;
            db.Direction                            = Direction;
            db.NegativeBarColorSameAsPositive       = NegativeBarColorSameAsPositive;
            db.NegativeBarBorderColorSameAsPositive = NegativeBarBorderColorSameAsPositive;
            db.AxisPosition                         = AxisPosition;

            return(db);
        }
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;
                    }
                }
            }
        }