/// <summary>
        /// Applies border on top of this border.<br/>
        /// Where the frame thickness is 0, the underlying border is not updated,<br/>
        /// otherwise it is over-written with a new border, using the applied colour.
        /// </summary>
        /// <param name="rowHeight"></param>
        public static void UpdateBorder(this ExcelCellBorderInfo borderToUpdate, StyleBase styleToApply)
        {
            // Anything to apply?
            if (styleToApply == null || styleToApply.HasAnyBorder() == false)
            {
                return;
            }

            // Apply updates to the thickness (ie. any non-zero values)
            if (styleToApply.HasLeftBorder())
            {
                borderToUpdate.WidthLeft  = styleToApply.BorderThickness.Value.Left;
                borderToUpdate.ColourLeft = styleToApply.BorderColour;
            }

            if (styleToApply.HasTopBorder())
            {
                borderToUpdate.WidthTop  = styleToApply.BorderThickness.Value.Top;
                borderToUpdate.ColourTop = styleToApply.BorderColour;
            }

            if (styleToApply.HasRightBorder())
            {
                borderToUpdate.WidthRight  = styleToApply.BorderThickness.Value.Right;
                borderToUpdate.ColourRight = styleToApply.BorderColour;
            }

            if (styleToApply.HasBottomBorder())
            {
                borderToUpdate.WidthBottom  = styleToApply.BorderThickness.Value.Bottom;
                borderToUpdate.ColourBottom = styleToApply.BorderColour;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Compares and updates border thickness for the cell
 /// </summary>
 /// <param name="rowHeight"></param>
 private void UpdateBorderInfo(StyleBase mapStyle)
 {
     // Anything to apply?
     if (mapStyle != null && mapStyle.HasAnyBorder())
     {
         if (this.borderInfo == null)
         {
             // Clone the border and apply to the cell
             this.borderInfo  = CreateBorderInfo(mapStyle);
             this.hasCellInfo = true;
         }
         else
         {
             // Update the border with layered information
             this.borderInfo.UpdateBorder(mapStyle);
         }
     }
 }