/// <summary>
 /// Set a data bar formatting with built-in types.
 /// </summary>
 /// <param name="DataBar">A built-in data bar type.</param>
 public void SetDataBar(SLConditionalFormatDataBarValues DataBar)
 {
     SLDataBarOptions dbo = new SLDataBarOptions(DataBar, false);
     this.SetCustomDataBar(dbo);
 }
Пример #2
0
 /// <summary>
 /// Initializes an instance of SLDataBarOptions.
 /// </summary>
 /// <param name="DataBar">Built-in data bar type.</param>
 /// <param name="Is2010Default">True if Excel 2010 specific data bar is to be used. False otherwise.</param>
 public SLDataBarOptions(SLConditionalFormatDataBarValues DataBar, bool Is2010Default)
 {
     this.InitialiseDataBarOptions(DataBar, Is2010Default);
 }
Пример #3
0
        private void InitialiseDataBarOptions(SLConditionalFormatDataBarValues DataBar, bool Is2010Default)
        {
            this.Is2010 = Is2010Default;

            this.FillColor           = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
            this.BorderColor         = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
            this.NegativeFillColor   = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
            this.NegativeBorderColor = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
            this.AxisColor           = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());

            switch (DataBar)
            {
            case SLConditionalFormatDataBarValues.Blue:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0x63, 0x8E, 0xC6);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0x8E, 0xC6);
                break;

            case SLConditionalFormatDataBarValues.Green:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0x63, 0xC3, 0x84);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0xC3, 0x84);
                break;

            case SLConditionalFormatDataBarValues.Red:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x55, 0x5A);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x55, 0x5A);
                break;

            case SLConditionalFormatDataBarValues.Orange:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xB6, 0x28);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xB6, 0x28);
                break;

            case SLConditionalFormatDataBarValues.LightBlue:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x8A, 0xEF);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x8A, 0xEF);
                break;

            case SLConditionalFormatDataBarValues.Purple:
                this.FillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0xD6, 0x00, 0x7B);
                this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xD6, 0x00, 0x7B);
                break;
            }

            this.NegativeFillColor.Color   = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
            this.NegativeBorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
            this.AxisColor.Color           = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00, 0x00);

            if (Is2010Default)
            {
                this.vMinimumType = SLConditionalFormatAutoMinMaxValues.Automatic;
                this.MinimumValue = string.Empty;
                this.vMaximumType = SLConditionalFormatAutoMinMaxValues.Automatic;
                this.MaximumValue = string.Empty;
                this.MinLength    = 0;
                this.MaxLength    = 100;
            }
            else
            {
                this.vMinimumType = SLConditionalFormatAutoMinMaxValues.Value;
                this.MinimumValue = string.Empty;
                this.vMaximumType = SLConditionalFormatAutoMinMaxValues.Value;
                this.MaximumValue = string.Empty;
                this.MinLength    = 10;
                this.MaxLength    = 90;
            }

            this.ShowBarOnly = false;
            this.bBorder     = false;
            this.bGradient   = false;
            this.vDirection  = X14.DataBarDirectionValues.Context;
            this.bNegativeBarColorSameAsPositive       = false;
            this.bNegativeBarBorderColorSameAsPositive = true;
            this.vAxisPosition = X14.DataBarAxisPositionValues.Automatic;
        }
Пример #4
0
 /// <summary>
 /// Initializes an instance of SLDataBarOptions.
 /// </summary>
 /// <param name="DataBar">Built-in data bar type.</param>
 public SLDataBarOptions(SLConditionalFormatDataBarValues DataBar)
 {
     this.InitialiseDataBarOptions(DataBar, true);
 }
 /// <summary>
 /// Initializes an instance of SLDataBarOptions.
 /// </summary>
 /// <param name="DataBar">Built-in data bar type.</param>
 /// <param name="Is2010Default">True if Excel 2010 specific data bar is to be used. False otherwise.</param>
 public SLDataBarOptions(SLConditionalFormatDataBarValues DataBar, bool Is2010Default)
 {
     this.InitialiseDataBarOptions(DataBar, Is2010Default);
 }
 /// <summary>
 /// Initializes an instance of SLDataBarOptions.
 /// </summary>
 /// <param name="DataBar">Built-in data bar type.</param>
 public SLDataBarOptions(SLConditionalFormatDataBarValues DataBar)
 {
     this.InitialiseDataBarOptions(DataBar, true);
 }
        private void InitialiseDataBarOptions(SLConditionalFormatDataBarValues DataBar, bool Is2010Default)
        {
            this.Is2010 = Is2010Default;

            this.FillColor = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
            this.BorderColor = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
            this.NegativeFillColor = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
            this.NegativeBorderColor = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());
            this.AxisColor = new SLColor(new List<System.Drawing.Color>(), new List<System.Drawing.Color>());

            switch (DataBar)
            {
                case SLConditionalFormatDataBarValues.Blue:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0x8E, 0xC6);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0x8E, 0xC6);
                    break;
                case SLConditionalFormatDataBarValues.Green:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0xC3, 0x84);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0xC3, 0x84);
                    break;
                case SLConditionalFormatDataBarValues.Red:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x55, 0x5A);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x55, 0x5A);
                    break;
                case SLConditionalFormatDataBarValues.Orange:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xB6, 0x28);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xB6, 0x28);
                    break;
                case SLConditionalFormatDataBarValues.LightBlue:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x8A, 0xEF);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x8A, 0xEF);
                    break;
                case SLConditionalFormatDataBarValues.Purple:
                    this.FillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xD6, 0x00, 0x7B);
                    this.BorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xD6, 0x00, 0x7B);
                    break;
            }

            this.NegativeFillColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
            this.NegativeBorderColor.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
            this.AxisColor.Color = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00, 0x00);

            if (Is2010Default)
            {
                this.vMinimumType = SLConditionalFormatAutoMinMaxValues.Automatic;
                this.MinimumValue = string.Empty;
                this.vMaximumType = SLConditionalFormatAutoMinMaxValues.Automatic;
                this.MaximumValue = string.Empty;
                this.MinLength = 0;
                this.MaxLength = 100;
            }
            else
            {
                this.vMinimumType = SLConditionalFormatAutoMinMaxValues.Value;
                this.MinimumValue = string.Empty;
                this.vMaximumType = SLConditionalFormatAutoMinMaxValues.Value;
                this.MaximumValue = string.Empty;
                this.MinLength = 10;
                this.MaxLength = 90;
            }

            this.ShowBarOnly = false;
            this.bBorder = false;
            this.bGradient = false;
            this.vDirection = X14.DataBarDirectionValues.Context;
            this.bNegativeBarColorSameAsPositive = false;
            this.bNegativeBarBorderColorSameAsPositive = true;
            this.vAxisPosition = X14.DataBarAxisPositionValues.Automatic;
        }
        /// <summary>
        /// Set a data bar formatting with built-in types.
        /// </summary>
        /// <param name="DataBar">A built-in data bar type.</param>
        public void SetDataBar(SLConditionalFormatDataBarValues DataBar)
        {
            SLConditionalFormattingRule cfr = new SLConditionalFormattingRule();
            cfr.Type = ConditionalFormatValues.DataBar;
            cfr.DataBar.Cfvo1.Type = ConditionalFormatValueObjectValues.Min;
            cfr.DataBar.Cfvo1.Val = "0";
            cfr.DataBar.Cfvo2.Type = ConditionalFormatValueObjectValues.Max;
            cfr.DataBar.Cfvo2.Val = "0";

            switch (DataBar)
            {
                case SLConditionalFormatDataBarValues.Blue:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0x8E, 0xC6);
                    break;
                case SLConditionalFormatDataBarValues.Green:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0x63, 0xC3, 0x84);
                    break;
                case SLConditionalFormatDataBarValues.Red:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x55, 0x5A);
                    break;
                case SLConditionalFormatDataBarValues.Orange:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xB6, 0x28);
                    break;
                case SLConditionalFormatDataBarValues.LightBlue:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0x00, 0x8A, 0xEF);
                    break;
                case SLConditionalFormatDataBarValues.Purple:
                    cfr.DataBar.Color.Color = System.Drawing.Color.FromArgb(0xFF, 0xD6, 0x00, 0x7B);
                    break;
            }

            cfr.HasDataBar = true;

            this.AppendRule(cfr);
        }