Exemplo n.º 1
0
        /// <summary>
        /// Try to modify the chart border settings.
        /// </summary>
        /// <param name="border">Reference to border settings to apply</param>
        /// <returns>
        /// <para>
        /// A <see cref="BooleanResult"/> reference that contains the result of the operation, to check if the operation is correct, the <b>Success</b>
        /// property will be <b>true</b> and the <b>Value</b> property will contain the value; Otherwise, the the <b>Success</b> property
        /// will be false and the <b>Errors</b> property will contain the errors associated with the operation, if they have been filled in.
        /// </para>
        /// <para>
        /// The type of the return value is <see cref="BooleanResult"/>, which contains the operation result
        /// </para>
        /// </returns>
        public IResult SetBorder(XlsxBorder border)
        {
            if (border == null)
            {
                return BooleanResult.CreateErroResult("border can not be null");
            }

            if (border.Show == YesNo.No)
            {
                return BooleanResult.SuccessResult;
            }

            try
            {
                var chartBorder = Chart.Border;
                chartBorder.Fill.Style = eFillStyle.SolidFill;
                chartBorder.Fill.Color = border.GetColor();
                chartBorder.Fill.Transparancy = border.Transparency;
                chartBorder.LineStyle = border.Style.ToEppLineStyle();
                chartBorder.Width = border.Width;

                return BooleanResult.SuccessResult;
            }
            catch (Exception e)
            {
                return BooleanResult.FromException(e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set picture border.
        /// </summary>
        /// <param name="border">Target border.</param>
        /// <param name="model">Border to draw.</param>
        public static void SetBorder(this ExcelDrawingBorder border, XlsxBorder model)
        {
            SentinelHelper.ArgumentNull(border, nameof(border));
            SentinelHelper.ArgumentNull(model, nameof(model));

            if (model.Show == YesNo.No)
            {
                return;
            }

            border.Fill.Style        = eFillStyle.SolidFill;
            border.Fill.Color        = model.GetColor();
            border.Fill.Transparancy = model.Transparency;
            border.LineStyle         = model.Style.ToEppLineStyle();
            border.Width             = model.Width;
        }