Example #1
0
        public void CreateBorder(BorderType type, Borderstyles borderStyle = Borderstyles.Thin, EWColor color = null)
        {
            if (color == null)
            {
                color = new EWColor(System.Drawing.Color.Black);
            }

            if (type.HasFlag(BorderType.Left))
            {
                AddBorder <LeftBorder>(borderStyle, color);
            }

            if (type.HasFlag(BorderType.Right))
            {
                AddBorder <RightBorder>(borderStyle, color);
            }

            if (type.HasFlag(BorderType.Top))
            {
                AddBorder <TopBorder>(borderStyle, color);
            }

            if (type.HasFlag(BorderType.Bottom))
            {
                AddBorder <BottomBorder>(borderStyle, color);
            }
        }
Example #2
0
        private void AddBorder <T>(Borderstyles borderStyle, EWColor color)
        {
            var border = Activator.CreateInstance <T>() as BorderPropertiesType;

            border.Style = borderStyle.As <BorderStyleValues>();
            border.Append(new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = color.HexString
                }
            });
            _borders.Add(border);
        }