Exemplo n.º 1
0
        public SheetRange SetInsideBorder(BorderEdge style)
        {
            for (var row = Range.Cell1.Row; row <= Range.Cell2.Row; row++)
            {
                for (var col = Range.Cell1.Col; col <= Range.Cell2.Col; col++)
                {
                    if (col > Range.Cell1.Col)
                    {
                        Sheet[row, col].Style.Border.Left = style;
                    }

                    if (col < Range.Cell2.Col)
                    {
                        Sheet[row, col].Style.Border.Right = style;
                    }

                    if (row > Range.Cell1.Row)
                    {
                        Sheet[row, col].Style.Border.Top = style;
                    }

                    if (row < Range.Cell2.Row)
                    {
                        Sheet[row, col].Style.Border.Bottom = style;
                    }
                }
            }

            return(this);
        }
Exemplo n.º 2
0
        public SheetRange SetOutsideBorder(BorderEdge style)
        {
            for (var row = Range.Cell1.Row; row <= Range.Cell2.Row; row++)
            {
                Sheet[row, Range.Cell1.Col].Style.Border.Left  = style;
                Sheet[row, Range.Cell2.Col].Style.Border.Right = style;
            }

            for (var col = Range.Cell1.Col; col <= Range.Cell2.Col; col++)
            {
                Sheet[Range.Cell1.Row, col].Style.Border.Top    = style;
                Sheet[Range.Cell2.Row, col].Style.Border.Bottom = style;
            }

            return(this);
        }
Exemplo n.º 3
0
        public SheetRange SetBorder(BorderEdge style)
        {
            for (var row = Range.Cell1.Row; row <= Range.Cell2.Row; row++)
            {
                var rowRange = Sheet[row];
                for (var col = Range.Cell1.Col; col <= Range.Cell2.Col; col++)
                {
                    var border = rowRange[col].Style.Border;
                    border.Left   = style;
                    border.Right  = style;
                    border.Top    = style;
                    border.Bottom = style;
                }
            }

            return(this);
        }
Exemplo n.º 4
0
 public static BorderEdge ToBorderEdge(this BorderEdgeStyle style)
 {
     var res = new BorderEdge { Style = GetBorderStyle(style) };
     if (style.Color != null)
         res.Color = style.Color.ToColor();
     return res;
 }
Exemplo n.º 5
0
 public void SetBorder(BorderEdge style)
 {
     for (var row = Range.Cell1.Row; row <= Range.Cell2.Row; row++)
     {
         var rowRange = Sheet[row];
         for (var col = Range.Cell1.Col; col <= Range.Cell2.Col; col++)
         {
             var border = rowRange[col].Style.Border;
             border.Left = style;
             border.Right = style;
             border.Top = style;
             border.Bottom = style;
         }
     }
 }
Exemplo n.º 6
0
        public void SetOutsideBorder(BorderEdge style)
        {
            for (var row = Range.Cell1.Row; row <= Range.Cell2.Row; row++)
            {
                Sheet[row, Range.Cell1.Col].Style.Border.Left = style;
                Sheet[row, Range.Cell2.Col].Style.Border.Right = style;
            }

            for (var col = Range.Cell1.Col; col <= Range.Cell2.Col; col++)
            {
                Sheet[Range.Cell1.Row, col].Style.Border.Top = style;
                Sheet[Range.Cell2.Row, col].Style.Border.Bottom = style;
            }
        }