Ejemplo n.º 1
0
        internal void FromColorScale(X14.ColorScale cs)
        {
            this.SetAllNull();

            SLConditionalFormattingValueObject2010 cfvo;
            SLColor clr;
            using (OpenXmlReader oxr = OpenXmlReader.Create(cs))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingValueObject))
                    {
                        cfvo = new SLConditionalFormattingValueObject2010();
                        cfvo.FromConditionalFormattingValueObject((X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(X14.Color))
                    {
                        clr = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
                        clr.FromExcel2010Color((X14.Color)oxr.LoadCurrentElement());
                        this.Colors.Add(clr);
                    }
                }
            }
        }
        internal SLConditionalFormattingValueObject2010 ToSLConditionalFormattingValueObject2010()
        {
            SLConditionalFormattingValueObject2010 cfvo2010 = new SLConditionalFormattingValueObject2010();
            cfvo2010.Formula = this.Val;

            switch (this.Type)
            {
                case ConditionalFormatValueObjectValues.Formula:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Formula;
                    break;
                case ConditionalFormatValueObjectValues.Max:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Max;
                    break;
                case ConditionalFormatValueObjectValues.Min:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Min;
                    break;
                case ConditionalFormatValueObjectValues.Number:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Numeric;
                    break;
                case ConditionalFormatValueObjectValues.Percent:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Percent;
                    break;
                case ConditionalFormatValueObjectValues.Percentile:
                    cfvo2010.Type = X14.ConditionalFormattingValueObjectTypeValues.Percentile;
                    break;
            }

            cfvo2010.GreaterThanOrEqual = this.GreaterThanOrEqual;

            return cfvo2010;
        }
        internal SLConditionalFormattingValueObject2010 Clone()
        {
            SLConditionalFormattingValueObject2010 cfvo = new SLConditionalFormattingValueObject2010();
            cfvo.Formula = this.Formula;
            cfvo.Type = this.Type;
            cfvo.GreaterThanOrEqual = this.GreaterThanOrEqual;

            return cfvo;
        }
Ejemplo n.º 4
0
        internal void FromIconSet(X14.IconSet ics)
        {
            this.SetAllNull();

            if (ics.IconSetTypes != null) this.IconSetType = ics.IconSetTypes.Value;
            if (ics.ShowValue != null) this.ShowValue = ics.ShowValue.Value;
            if (ics.Percent != null) this.Percent = ics.Percent.Value;
            if (ics.Reverse != null) this.Reverse = ics.Reverse.Value;

            using (OpenXmlReader oxr = OpenXmlReader.Create(ics))
            {
                SLConditionalFormattingValueObject2010 cfvo;
                SLConditionalFormattingIcon2010 cfi;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingValueObject))
                    {
                        cfvo = new SLConditionalFormattingValueObject2010();
                        cfvo.FromConditionalFormattingValueObject((X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(X14.ConditionalFormattingIcon))
                    {
                        cfi = new SLConditionalFormattingIcon2010();
                        cfi.FromConditionalFormattingIcon((X14.ConditionalFormattingIcon)oxr.LoadCurrentElement());
                        this.CustomIcons.Add(cfi);
                    }
                }
            }
        }