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

            SLConditionalFormatValueObject cfvo;
            SLColor clr;
            using (OpenXmlReader oxr = OpenXmlReader.Create(cs))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        cfvo = new SLConditionalFormatValueObject();
                        cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(Color))
                    {
                        clr = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
                        clr.FromSpreadsheetColor((Color)oxr.LoadCurrentElement());
                        this.Colors.Add(clr);
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal void FromColorScale(ColorScale cs)
        {
            this.SetAllNull();

            SLConditionalFormatValueObject cfvo;
            SLColor clr;

            using (OpenXmlReader oxr = OpenXmlReader.Create(cs))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        cfvo = new SLConditionalFormatValueObject();
                        cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(Color))
                    {
                        clr = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
                        clr.FromSpreadsheetColor((Color)oxr.LoadCurrentElement());
                        this.Colors.Add(clr);
                    }
                }
            }
        }
Exemplo n.º 3
0
        internal void FromIconSet(IconSet ics)
        {
            this.SetAllNull();

            if (ics.IconSetValue != null)
            {
                this.IconSetType = SLIconSet.TranslateIconSetToInternalSet(ics.IconSetValue.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))
            {
                SLConditionalFormatValueObject cfvo;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        cfvo = new SLConditionalFormatValueObject();
                        cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                }
            }
        }
        internal SLConditionalFormatValueObject Clone()
        {
            SLConditionalFormatValueObject cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.Type;
            cfvo.Val = this.Val;
            cfvo.GreaterThanOrEqual = this.GreaterThanOrEqual;

            return cfvo;
        }
Exemplo n.º 5
0
        internal SLConditionalFormatValueObject Clone()
        {
            SLConditionalFormatValueObject cfvo = new SLConditionalFormatValueObject();

            cfvo.Type = this.Type;
            cfvo.Val  = this.Val;
            cfvo.GreaterThanOrEqual = this.GreaterThanOrEqual;

            return(cfvo);
        }
Exemplo n.º 6
0
        internal void FromDataBar(DataBar db)
        {
            this.SetAllNull();

            using (OpenXmlReader oxr = OpenXmlReader.Create(db))
            {
                int i = 0;
                SLConditionalFormatValueObject cfvo;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        if (i == 0)
                        {
                            cfvo = new SLConditionalFormatValueObject();
                            cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                            this.MinimumType  = this.TranslateToAutoMinMaxValues(cfvo.Type);
                            this.MinimumValue = cfvo.Val;
                            ++i;
                        }
                        else if (i == 1)
                        {
                            cfvo = new SLConditionalFormatValueObject();
                            cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                            this.MaximumType  = this.TranslateToAutoMinMaxValues(cfvo.Type);
                            this.MaximumValue = cfvo.Val;
                            ++i;
                        }
                    }
                    else if (oxr.ElementType == typeof(Color))
                    {
                        this.Color.FromSpreadsheetColor((Color)oxr.LoadCurrentElement());
                    }
                }
            }

            if (db.MinLength != null)
            {
                this.MinLength = db.MinLength.Value;
            }
            if (db.MaxLength != null)
            {
                this.MaxLength = db.MaxLength.Value;
            }
            if (db.ShowValue != null)
            {
                this.ShowValue = db.ShowValue.Value;
            }
        }
Exemplo n.º 7
0
        internal void FromIconSet(IconSet ics)
        {
            this.SetAllNull();

            if (ics.IconSetValue != null) this.IconSetValue = ics.IconSetValue.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))
            {
                SLConditionalFormatValueObject cfvo;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        cfvo = new SLConditionalFormatValueObject();
                        cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                }
            }
        }
Exemplo n.º 8
0
        internal DataBar ToDataBar()
        {
            DataBar db = new DataBar();
            if (this.MinLength != 10) db.MinLength = this.MinLength;
            if (this.MaxLength != 90) db.MaxLength = this.MaxLength;
            if (!this.ShowValue) db.ShowValue = this.ShowValue;

            SLConditionalFormatValueObject cfvo;

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Min;
            switch (this.MinimumType)
            {
                case SLConditionalFormatAutoMinMaxValues.Automatic:
                    cfvo.Type = ConditionalFormatValueObjectValues.Min;
                    cfvo.Val = string.Empty;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Formula:
                    cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                    cfvo.Val = this.MinimumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Number:
                    cfvo.Type = ConditionalFormatValueObjectValues.Number;
                    cfvo.Val = this.MinimumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Percent:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                    cfvo.Val = this.MinimumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Percentile:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                    cfvo.Val = this.MinimumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Value:
                    cfvo.Type = ConditionalFormatValueObjectValues.Min;
                    cfvo.Val = string.Empty;
                    break;
            }
            db.Append(cfvo.ToConditionalFormatValueObject());

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Max;
            switch (this.MaximumType)
            {
                case SLConditionalFormatAutoMinMaxValues.Automatic:
                    cfvo.Type = ConditionalFormatValueObjectValues.Max;
                    cfvo.Val = string.Empty;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Formula:
                    cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                    cfvo.Val = this.MaximumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Number:
                    cfvo.Type = ConditionalFormatValueObjectValues.Number;
                    cfvo.Val = this.MaximumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Percent:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                    cfvo.Val = this.MaximumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Percentile:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                    cfvo.Val = this.MaximumValue;
                    break;
                case SLConditionalFormatAutoMinMaxValues.Value:
                    cfvo.Type = ConditionalFormatValueObjectValues.Max;
                    cfvo.Val = string.Empty;
                    break;
            }
            db.Append(cfvo.ToConditionalFormatValueObject());

            db.Append(this.Color.ToSpreadsheetColor());

            return db;
        }
Exemplo n.º 9
0
        internal void FromDataBar(DataBar db)
        {
            this.SetAllNull();

            using (OpenXmlReader oxr = OpenXmlReader.Create(db))
            {
                int i = 0;
                SLConditionalFormatValueObject cfvo;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        if (i == 0)
                        {
                            cfvo = new SLConditionalFormatValueObject();
                            cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                            this.MinimumType = this.TranslateToAutoMinMaxValues(cfvo.Type);
                            this.MinimumValue = cfvo.Val;
                            ++i;
                        }
                        else if (i == 1)
                        {
                            cfvo = new SLConditionalFormatValueObject();
                            cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                            this.MaximumType = this.TranslateToAutoMinMaxValues(cfvo.Type);
                            this.MaximumValue = cfvo.Val;
                            ++i;
                        }
                    }
                    else if (oxr.ElementType == typeof(Color))
                    {
                        this.Color.FromSpreadsheetColor((Color)oxr.LoadCurrentElement());
                    }
                }
            }

            if (db.MinLength != null) this.MinLength = db.MinLength.Value;
            if (db.MaxLength != null) this.MaxLength = db.MaxLength.Value;
            if (db.ShowValue != null) this.ShowValue = db.ShowValue.Value;
        }
        private void SetCustomColorScale(SLConditionalFormatMinMaxValues MinType, string MinValue, SLColor MinColor,
            bool HasMidPoint, SLConditionalFormatRangeValues MidPointType, string MidPointValue, SLColor MidPointColor,
            SLConditionalFormatMinMaxValues MaxType, string MaxValue, SLColor MaxColor)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.ColorScale;

            SLConditionalFormatValueObject cfvo;

            cfvo = new SLConditionalFormatValueObject();
            switch (MinType)
            {
                case SLConditionalFormatMinMaxValues.Value:
                    cfvo.Type = ConditionalFormatValueObjectValues.Min;
                    break;
                case SLConditionalFormatMinMaxValues.Number:
                    cfvo.Type = ConditionalFormatValueObjectValues.Number;
                    break;
                case SLConditionalFormatMinMaxValues.Percent:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                    break;
                case SLConditionalFormatMinMaxValues.Formula:
                    cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                    break;
                case SLConditionalFormatMinMaxValues.Percentile:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                    break;
            }
            cfvo.Val = MinValue;
            cfr.ColorScale.Cfvos.Add(cfvo);
            cfr.ColorScale.Colors.Add(MinColor.Clone());

            if (HasMidPoint)
            {
                cfvo = new SLConditionalFormatValueObject();
                switch (MidPointType)
                {
                    case SLConditionalFormatRangeValues.Number:
                        cfvo.Type = ConditionalFormatValueObjectValues.Number;
                        break;
                    case SLConditionalFormatRangeValues.Percent:
                        cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                        break;
                    case SLConditionalFormatRangeValues.Formula:
                        cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                        break;
                    case SLConditionalFormatRangeValues.Percentile:
                        cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                        break;
                }
                cfvo.Val = MidPointValue;
                cfr.ColorScale.Cfvos.Add(cfvo);
                cfr.ColorScale.Colors.Add(MidPointColor.Clone());
            }

            cfvo = new SLConditionalFormatValueObject();
            switch (MaxType)
            {
                case SLConditionalFormatMinMaxValues.Value:
                    cfvo.Type = ConditionalFormatValueObjectValues.Max;
                    break;
                case SLConditionalFormatMinMaxValues.Number:
                    cfvo.Type = ConditionalFormatValueObjectValues.Number;
                    break;
                case SLConditionalFormatMinMaxValues.Percent:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                    break;
                case SLConditionalFormatMinMaxValues.Formula:
                    cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                    break;
                case SLConditionalFormatMinMaxValues.Percentile:
                    cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                    break;
            }
            cfvo.Val = MaxValue;
            cfr.ColorScale.Cfvos.Add(cfvo);
            cfr.ColorScale.Colors.Add(MaxColor.Clone());

            cfr.HasColorScale = true;

            this.AppendRule(cfr);
        }
        /// <summary>
        /// Set a custom 5-icon set.
        /// </summary>
        /// <param name="Options">5-icon set options.</param>
        public void SetCustomIconSet(SLFiveIconSetOptions Options)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.IconSet;
            cfr.IconSet.Reverse = Options.ReverseIconOrder;
            cfr.IconSet.ShowValue = !Options.ShowIconOnly;

            switch (Options.IconSetType)
            {
                case SLFiveIconSetValues.FiveArrows:
                    cfr.IconSet.IconSetType = SLIconSetValues.FiveArrows;
                    break;
                case SLFiveIconSetValues.FiveArrowsGray:
                    cfr.IconSet.IconSetType = SLIconSetValues.FiveArrowsGray;
                    break;
                case SLFiveIconSetValues.FiveBoxes:
                    cfr.IconSet.IconSetType = SLIconSetValues.FiveBoxes;
                    break;
                case SLFiveIconSetValues.FiveQuarters:
                    cfr.IconSet.IconSetType = SLIconSetValues.FiveQuarters;
                    break;
                case SLFiveIconSetValues.FiveRating:
                    cfr.IconSet.IconSetType = SLIconSetValues.FiveRating;
                    break;
            }

            cfr.IconSet.Is2010 = SLIconSet.Is2010IconSet(cfr.IconSet.IconSetType);

            if (Options.IsCustomIcon)
            {
                X14.IconSetTypeValues istv = X14.IconSetTypeValues.ThreeTrafficLights1;
                uint iIconId = 0;

                SLIconSet.TranslateCustomIcon(Options.Icon1, out istv, out iIconId);
                cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId });

                SLIconSet.TranslateCustomIcon(Options.Icon2, out istv, out iIconId);
                cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId });

                SLIconSet.TranslateCustomIcon(Options.Icon3, out istv, out iIconId);
                cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId });

                SLIconSet.TranslateCustomIcon(Options.Icon4, out istv, out iIconId);
                cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId });

                SLIconSet.TranslateCustomIcon(Options.Icon5, out istv, out iIconId);
                cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId });

                cfr.IconSet.Is2010 = true;
            }

            SLConditionalFormatValueObject cfvo;

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Percent;
            cfvo.Val = "0";
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Options.Type2);
            cfvo.Val = Options.Value2;
            cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual2;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Options.Type3);
            cfvo.Val = Options.Value3;
            cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual3;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Options.Type4);
            cfvo.Val = Options.Value4;
            cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual4;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Options.Type5);
            cfvo.Val = Options.Value5;
            cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual5;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfr.HasIconSet = true;

            this.AppendRule(cfr);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Set a custom 5-icon set.
        /// </summary>
        /// <param name="IconSetType">The type of 3-icon set.</param>
        /// <param name="ReverseIconOrder">True to reverse the order of the icons. False to use the default order.</param>
        /// <param name="ShowIconOnly">True to show only icons. False to show both icon and value.</param>
        /// <param name="GreaterThanOrEqual2">True if values are to be greater than or equal to the 2nd range value. False if values are to be strictly greater than.</param>
        /// <param name="Value2">The 2nd range value.</param>
        /// <param name="Type2">The conditional format type for the 2nd range value.</param>
        /// <param name="GreaterThanOrEqual3">True if values are to be greater than or equal to the 3rd range value. False if values are to be strictly greater than.</param>
        /// <param name="Value3">The 3rd range value.</param>
        /// <param name="Type3">The conditional format type for the 3rd range value.</param>
        /// <param name="GreaterThanOrEqual4">True if values are to be greater than or equal to the 4th range value. False if values are to be strictly greater than.</param>
        /// <param name="Value4">The 4th range value.</param>
        /// <param name="Type4">The conditional format type for the 4th range value.</param>
        /// <param name="GreaterThanOrEqual5">True if values are to be greater than or equal to the 5th range value. False if values are to be strictly greater than.</param>
        /// <param name="Value5">The 5th range value.</param>
        /// <param name="Type5">The conditional format type for the 5th range value.</param>
        public void SetCustomIconSet(SLFiveIconSetValues IconSetType, bool ReverseIconOrder, bool ShowIconOnly,
            bool GreaterThanOrEqual2, string Value2, SLConditionalFormatRangeValues Type2,
            bool GreaterThanOrEqual3, string Value3, SLConditionalFormatRangeValues Type3,
            bool GreaterThanOrEqual4, string Value4, SLConditionalFormatRangeValues Type4,
            bool GreaterThanOrEqual5, string Value5, SLConditionalFormatRangeValues Type5)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.IconSet;
            cfr.IconSet.Reverse = ReverseIconOrder;
            cfr.IconSet.ShowValue = !ShowIconOnly;

            switch (IconSetType)
            {
                case SLFiveIconSetValues.FiveArrows:
                    cfr.IconSet.IconSetValue = IconSetValues.FiveArrows;
                    break;
                case SLFiveIconSetValues.FiveArrowsGray:
                    cfr.IconSet.IconSetValue = IconSetValues.FiveArrowsGray;
                    break;
                case SLFiveIconSetValues.FiveQuarters:
                    cfr.IconSet.IconSetValue = IconSetValues.FiveQuarters;
                    break;
                case SLFiveIconSetValues.FiveRating:
                    cfr.IconSet.IconSetValue = IconSetValues.FiveRating;
                    break;
            }

            SLConditionalFormatValueObject cfvo;

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Percent;
            cfvo.Val = "0";
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type2);
            cfvo.Val = Value2;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual2;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type3);
            cfvo.Val = Value3;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual3;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type4);
            cfvo.Val = Value4;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual4;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type5);
            cfvo.Val = Value5;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual5;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfr.HasIconSet = true;

            this.AppendRule(cfr);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Set a custom 3-icon set.
        /// </summary>
        /// <param name="IconSetType">The type of 3-icon set.</param>
        /// <param name="ReverseIconOrder">True to reverse the order of the icons. False to use the default order.</param>
        /// <param name="ShowIconOnly">True to show only icons. False to show both icon and value.</param>
        /// <param name="GreaterThanOrEqual2">True if values are to be greater than or equal to the 2nd range value. False if values are to be strictly greater than.</param>
        /// <param name="Value2">The 2nd range value.</param>
        /// <param name="Type2">The conditional format type for the 2nd range value.</param>
        /// <param name="GreaterThanOrEqual3">True if values are to be greater than or equal to the 3rd range value. False if values are to be strictly greater than.</param>
        /// <param name="Value3">The 3rd range value.</param>
        /// <param name="Type3">The conditional format type for the 3rd range value.</param>
        public void SetCustomIconSet(SLThreeIconSetValues IconSetType, bool ReverseIconOrder, bool ShowIconOnly,
            bool GreaterThanOrEqual2, string Value2, SLConditionalFormatRangeValues Type2,
            bool GreaterThanOrEqual3, string Value3, SLConditionalFormatRangeValues Type3)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.IconSet;
            cfr.IconSet.Reverse = ReverseIconOrder;
            cfr.IconSet.ShowValue = !ShowIconOnly;

            switch (IconSetType)
            {
                case SLThreeIconSetValues.ThreeArrows:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeArrows;
                    break;
                case SLThreeIconSetValues.ThreeArrowsGray:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeArrowsGray;
                    break;
                case SLThreeIconSetValues.ThreeFlags:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeFlags;
                    break;
                case SLThreeIconSetValues.ThreeSigns:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeSigns;
                    break;
                case SLThreeIconSetValues.ThreeSymbols:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeSymbols;
                    break;
                case SLThreeIconSetValues.ThreeSymbols2:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeSymbols2;
                    break;
                case SLThreeIconSetValues.ThreeTrafficLights1:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeTrafficLights1;
                    break;
                case SLThreeIconSetValues.ThreeTrafficLights2:
                    cfr.IconSet.IconSetValue = IconSetValues.ThreeTrafficLights2;
                    break;
            }

            SLConditionalFormatValueObject cfvo;

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Percent;
            cfvo.Val = "0";
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type2);
            cfvo.Val = Value2;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual2;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfvo = new SLConditionalFormatValueObject();
            cfvo.Type = this.TranslateRangeValues(Type3);
            cfvo.Val = Value3;
            cfvo.GreaterThanOrEqual = GreaterThanOrEqual3;
            cfr.IconSet.Cfvos.Add(cfvo);

            cfr.HasIconSet = true;

            this.AppendRule(cfr);
        }
Exemplo n.º 14
0
        internal DataBar ToDataBar()
        {
            DataBar db = new DataBar();

            if (this.MinLength != 10)
            {
                db.MinLength = this.MinLength;
            }
            if (this.MaxLength != 90)
            {
                db.MaxLength = this.MaxLength;
            }
            if (!this.ShowValue)
            {
                db.ShowValue = this.ShowValue;
            }

            SLConditionalFormatValueObject cfvo;

            cfvo      = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Min;
            switch (this.MinimumType)
            {
            case SLConditionalFormatAutoMinMaxValues.Automatic:
                cfvo.Type = ConditionalFormatValueObjectValues.Min;
                cfvo.Val  = string.Empty;
                break;

            case SLConditionalFormatAutoMinMaxValues.Formula:
                cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                cfvo.Val  = this.MinimumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Number:
                cfvo.Type = ConditionalFormatValueObjectValues.Number;
                cfvo.Val  = this.MinimumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Percent:
                cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                cfvo.Val  = this.MinimumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Percentile:
                cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                cfvo.Val  = this.MinimumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Value:
                cfvo.Type = ConditionalFormatValueObjectValues.Min;
                cfvo.Val  = string.Empty;
                break;
            }
            db.Append(cfvo.ToConditionalFormatValueObject());

            cfvo      = new SLConditionalFormatValueObject();
            cfvo.Type = ConditionalFormatValueObjectValues.Max;
            switch (this.MaximumType)
            {
            case SLConditionalFormatAutoMinMaxValues.Automatic:
                cfvo.Type = ConditionalFormatValueObjectValues.Max;
                cfvo.Val  = string.Empty;
                break;

            case SLConditionalFormatAutoMinMaxValues.Formula:
                cfvo.Type = ConditionalFormatValueObjectValues.Formula;
                cfvo.Val  = this.MaximumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Number:
                cfvo.Type = ConditionalFormatValueObjectValues.Number;
                cfvo.Val  = this.MaximumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Percent:
                cfvo.Type = ConditionalFormatValueObjectValues.Percent;
                cfvo.Val  = this.MaximumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Percentile:
                cfvo.Type = ConditionalFormatValueObjectValues.Percentile;
                cfvo.Val  = this.MaximumValue;
                break;

            case SLConditionalFormatAutoMinMaxValues.Value:
                cfvo.Type = ConditionalFormatValueObjectValues.Max;
                cfvo.Val  = string.Empty;
                break;
            }
            db.Append(cfvo.ToConditionalFormatValueObject());

            db.Append(this.Color.ToSpreadsheetColor());

            return(db);
        }