/// <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); }
/// <summary> /// Set a custom 5-icon set. /// </summary> /// <param name="IconSetType">The type of 5-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) { SLFiveIconSetOptions Options = new SLFiveIconSetOptions(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; Options.GreaterThanOrEqual5 = GreaterThanOrEqual5; Options.Value5 = Value5; Options.Type5 = Type5; this.SetCustomIconSet(Options); }