public BorderInfo(RPLElementStyle style, int width, int height, bool slant, bool omitBorderTop, bool omitBorderBottom, bool defaultLine, IExcelGenerator excel)
 {
     this.m_omitBorderTop    = omitBorderTop;
     this.m_omitBorderBottom = omitBorderBottom;
     if (height == 0)
     {
         if (defaultLine)
         {
             this.m_topBorder = new BorderProperties(ExcelBorderPart.Top);
             this.FillBorderProperties(excel, this.m_topBorder, style[5], style[10], style[0]);
         }
         else
         {
             this.m_bottomBorder = new BorderProperties(ExcelBorderPart.Bottom);
             this.FillBorderProperties(excel, this.m_bottomBorder, style[5], style[10], style[0]);
         }
     }
     else if (width == 0)
     {
         this.m_leftBorder = new BorderProperties(ExcelBorderPart.Left);
         this.FillBorderProperties(excel, this.m_leftBorder, style[5], style[10], style[0]);
     }
     else if (slant)
     {
         this.m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalUp);
         this.FillBorderProperties(excel, this.m_diagonal, style[5], style[10], style[0]);
     }
     else
     {
         this.m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalDown);
         this.FillBorderProperties(excel, this.m_diagonal, style[5], style[10], style[0]);
     }
 }
        private static BorderProperties FillBorderProperties(IExcelGenerator excel, BorderProperties currBorder, BorderProperties border, ExcelBorderPart part, object style, object width, object color)
        {
            BorderProperties borderProperties = currBorder;

            if (style != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
            }
            if (width != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Width = LayoutConvert.ToPoints((string)width);
            }
            if (color != null && !color.Equals("Transparent"))
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Color = excel.AddColor((string)color);
            }
            return(borderProperties);
        }
示例#3
0
 public BorderProperties(BorderProperties borderProps, ExcelBorderPart part)
 {
     if (borderProps != null)
     {
         this.m_color = borderProps.Color;
         this.m_style = borderProps.Style;
         this.m_width = borderProps.Width;
     }
     this.m_part = part;
 }
        private static void FillBottomBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties bottomBorder)
        {
            BorderProperties currBorder = BorderInfo.FillBorderProperties(excel, null, bottomBorder, ExcelBorderPart.Bottom, style[5], style[10], style[0]);

            currBorder = BorderInfo.FillBorderProperties(excel, currBorder, bottomBorder, ExcelBorderPart.Bottom, style[9], style[14], style[4]);
            if (currBorder != null)
            {
                bottomBorder = currBorder;
            }
        }
        private static void FillTopBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties topBorder)
        {
            BorderProperties currBorder = BorderInfo.FillBorderProperties(excel, null, topBorder, ExcelBorderPart.Top, style[5], style[10], style[0]);

            currBorder = BorderInfo.FillBorderProperties(excel, currBorder, topBorder, ExcelBorderPart.Top, style[8], style[13], style[3]);
            if (currBorder != null)
            {
                topBorder = currBorder;
            }
        }
        private static void FillRightBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties rightBorder)
        {
            BorderProperties currBorder = BorderInfo.FillBorderProperties(excel, null, rightBorder, ExcelBorderPart.Right, style[5], style[10], style[0]);

            currBorder = BorderInfo.FillBorderProperties(excel, currBorder, rightBorder, ExcelBorderPart.Right, style[7], style[12], style[2]);
            if (currBorder != null)
            {
                rightBorder = currBorder;
            }
        }
        private static void FillLeftBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties leftBorder)
        {
            BorderProperties currBorder = BorderInfo.FillBorderProperties(excel, null, leftBorder, ExcelBorderPart.Left, style[5], style[10], style[0]);

            currBorder = BorderInfo.FillBorderProperties(excel, currBorder, leftBorder, ExcelBorderPart.Left, style[6], style[11], style[1]);
            if (currBorder != null)
            {
                leftBorder = currBorder;
            }
        }
 public static void FillAllBorders(RPLStyleProps style, ref BorderProperties leftBorder, ref BorderProperties rightBorder, ref BorderProperties topBorder, ref BorderProperties bottomBorder, ref IColor backgroundColor, IExcelGenerator excel)
 {
     if (style[34] != null && !style[34].Equals("Transparent"))
     {
         backgroundColor = excel.AddColor((string)style[34]);
     }
     BorderInfo.FillLeftBorderProperties(style, excel, ref leftBorder);
     BorderInfo.FillRightBorderProperties(style, excel, ref rightBorder);
     BorderInfo.FillTopBorderProperties(style, excel, ref topBorder);
     BorderInfo.FillBottomBorderProperties(style, excel, ref bottomBorder);
 }
 private void FillBorderProperties(IExcelGenerator excel, BorderProperties border, object style, object width, object color)
 {
     if (style != null)
     {
         border.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
     }
     if (width != null)
     {
         border.Width = LayoutConvert.ToPoints((string)width);
     }
     if (color != null && !color.Equals("Transparent"))
     {
         border.Color = excel.AddColor((string)color);
     }
 }