Method: Writeexcel::Format#set_border

Defined in:
lib/writeexcel/format.rb

#set_border(style) ⇒ Object

Set cells borders to the same style

Also applies to:    set_bottom()
                    set_top()
                    set_left()
                    set_right()

Default state:      Border is off
Default action:     Set border type 1
Valid args:         0-13, See below.

A cell border is comprised of a border on the bottom, top, left and right. These can be set to the same value using set_border() or individually using the relevant method calls shown above.

The following shows the border styles sorted by WriteExcel index number:

Index   Name            Weight   Style
=====   =============   ======   ===========
0       None            0
1       Continuous      1        -----------
2       Continuous      2        -----------
3       Dash            1        - - - - - -
4       Dot             1        . . . . . .
5       Continuous      3        -----------
6       Double          3        ===========
7       Continuous      0        -----------
8       Dash            2        - - - - - -
9       Dash Dot        1        - . - . - .
10      Dash Dot        2        - . - . - .
11      Dash Dot Dot    1        - . . - . .
12      Dash Dot Dot    2        - . . - . .
13      SlantDash Dot   2        / - . / - .

The following shows the borders sorted by style:

Name            Weight   Style         Index
=============   ======   ===========   =====
Continuous      0        -----------   7
Continuous      1        -----------   1
Continuous      2        -----------   2
Continuous      3        -----------   5
Dash            1        - - - - - -   3
Dash            2        - - - - - -   8
Dash Dot        1        - . - . - .   9
Dash Dot        2        - . - . - .   10
Dash Dot Dot    1        - . . - . .   11
Dash Dot Dot    2        - . . - . .   12
Dot             1        . . . . . .   4
Double          3        ===========   6
None            0                      0
SlantDash Dot   2        / - . / - .   13

The following shows the borders in the order shown in the Excel Dialog.

Index   Style             Index   Style
=====   =====             =====   =====
0       None              12      - . . - . .
7       -----------       13      / - . / - .
4       . . . . . .       10      - . - . - .
11      - . . - . .       8       - - - - - -
9       - . - . - .       2       -----------
3       - - - - - -       5       -----------
1       -----------       6       ===========

Examples of the available border styles are shown in the ‘Borders’ worksheet created by formats.rb.



1107
1108
1109
1110
1111
1112
# File 'lib/writeexcel/format.rb', line 1107

def set_border(style)
  set_bottom(style)
  set_top(style)
  set_left(style)
  set_right(style)
end