Ejemplo n.º 1
0
        /// <summary>
        /// Converter for <see cref="T:iTin.Export.Model.KnownWidthLineStyle"/> enumeration type to <see cref="T:Novacode.BorderSize"/>.
        /// </summary>
        /// <param name="width">The line width.</param>
        /// <returns>
        /// A <see cref="T:Novacode.BorderSize" /> value.
        /// </returns>
        private static BorderSize ToDocxBorderSize(this KnownWidthLineStyle width)
        {
            var size = BorderSize.two;

            switch (width)
            {
            case KnownWidthLineStyle.Hairline:
                size = BorderSize.two;
                break;

            case KnownWidthLineStyle.Thin:
                size = BorderSize.two;
                break;

            case KnownWidthLineStyle.Medium:
                size = BorderSize.three;
                break;

            case KnownWidthLineStyle.Thick:
                size = BorderSize.four;
                break;
            }

            return(size);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns index in the enum type.
        /// </summary>
        /// <param name="item">Target item.</param>
        /// <returns>
        /// Index in the enum type.
        /// </returns>
        public static int IndexOf(this KnownWidthLineStyle item)
        {
            SentinelHelper.IsEnumValid(item);

            var enumArray = (KnownWidthLineStyle[])Enum.GetValues(typeof(KnownWidthLineStyle));

            return(Array.IndexOf(enumArray, item));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converter for <see cref="T:iTin.Export.Model.KnownWidthLineStyle"/> enumeration type to integer value.
        /// </summary>
        /// <param name="borderWeight">Width line style from model.</param>
        /// <returns>
        /// An integer value than represents border width.
        /// </returns>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception>
        public static int ToEppBorderWidth(this KnownWidthLineStyle borderWeight)
        {
            SentinelHelper.IsEnumValid(borderWeight);

            switch (borderWeight)
            {
            case KnownWidthLineStyle.Medium:
                return(2);

            case KnownWidthLineStyle.Thick:
                return(4);

            default:
                return(1);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Combines this instance with reference parameter.
        /// </summary>
        public void Combine(BorderModel reference)
        {
            if (Color.Equals(DefaultColor))
            {
                Color = reference.Color;
            }

            if (LineStyle.Equals(DefaultLineStyle))
            {
                LineStyle = reference.LineStyle;
            }

            if (Weight.Equals(DefaultWidthLineStyle))
            {
                Weight = reference.Weight;
            }
        }