コード例 #1
0
        /// <summary>
        /// Set a custom 4-icon set.
        /// </summary>
        /// <param name="Options">4-icon set options.</param>
        public void SetCustomIconSet(SLFourIconSetOptions Options)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.IconSet;
            cfr.IconSet.Reverse = Options.ReverseIconOrder;
            cfr.IconSet.ShowValue = !Options.ShowIconOnly;

            switch (Options.IconSetType)
            {
                case SLFourIconSetValues.FourArrows:
                    cfr.IconSet.IconSetType = SLIconSetValues.FourArrows;
                    break;
                case SLFourIconSetValues.FourArrowsGray:
                    cfr.IconSet.IconSetType = SLIconSetValues.FourArrowsGray;
                    break;
                case SLFourIconSetValues.FourRating:
                    cfr.IconSet.IconSetType = SLIconSetValues.FourRating;
                    break;
                case SLFourIconSetValues.FourRedToBlack:
                    cfr.IconSet.IconSetType = SLIconSetValues.FourRedToBlack;
                    break;
                case SLFourIconSetValues.FourTrafficLights:
                    cfr.IconSet.IconSetType = SLIconSetValues.FourTrafficLights;
                    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 });

                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);

            cfr.HasIconSet = true;

            this.AppendRule(cfr);
        }
コード例 #2
0
        /// <summary>
        /// Set a custom 4-icon set.
        /// </summary>
        /// <param name="IconSetType">The type of 4-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>
        public void SetCustomIconSet(SLFourIconSetValues IconSetType, bool ReverseIconOrder, bool ShowIconOnly,
            bool GreaterThanOrEqual2, string Value2, SLConditionalFormatRangeValues Type2,
            bool GreaterThanOrEqual3, string Value3, SLConditionalFormatRangeValues Type3,
            bool GreaterThanOrEqual4, string Value4, SLConditionalFormatRangeValues Type4)
        {
            SLFourIconSetOptions Options = new SLFourIconSetOptions(IconSetType);
            Options.ReverseIconOrder = ReverseIconOrder;
            Options.ShowIconOnly = ShowIconOnly;

            Options.GreaterThanOrEqual2 = GreaterThanOrEqual2;
            Options.Value2 = Value2;
            Options.Type2 = Type2;

            Options.GreaterThanOrEqual3 = GreaterThanOrEqual3;
            Options.Value3 = Value3;
            Options.Type3 = Type3;

            Options.GreaterThanOrEqual4 = GreaterThanOrEqual4;
            Options.Value4 = Value4;
            Options.Type4 = Type4;

            this.SetCustomIconSet(Options);
        }