Class: Axlsx::Border
- Inherits:
-
Object
- Object
- Axlsx::Border
- Defined in:
- lib/axlsx/stylesheet/border.rb
Overview
This class details a border used in Office Open XML spreadsheet styles.
Instance Attribute Summary (collapse)
-
- (Boolean) diagonalDown
The diagonal down property for the border that indicates if the border should include a diagonal line from the top left to the top right of the cell.
-
- (Boolean) diagonalUp
The diagonal up property for the border that indicates if the border should include a diagonal line from the bottom left to the top right of the cell.
-
- (Boolean) outline
The outline property for the border indicating that top, left, right and bottom borders should only be applied to the outside border of a range of cells.
-
- (SimpleTypedList) prs
readonly
A list of BorderPr objects for this border.
Instance Method Summary (collapse)
-
- (Border) initialize(options = {})
constructor
Creates a new Border object.
-
- (Object) to_xml(xml)
Serializes the border element.
Constructor Details
- (Border) initialize(options = {})
Creates a new Border object
31 32 33 34 35 36 |
# File 'lib/axlsx/stylesheet/border.rb', line 31 def initialize(={}) @prs = SimpleTypedList.new BorderPr .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
- (Boolean) diagonalDown
The diagonal down property for the border that indicates if the border should include a diagonal line from the top left to the top right of the cell.
9 10 11 |
# File 'lib/axlsx/stylesheet/border.rb', line 9 def diagonalDown @diagonalDown end |
- (Boolean) diagonalUp
The diagonal up property for the border that indicates if the border should include a diagonal line from the bottom left to the top right of the cell.
6 7 8 |
# File 'lib/axlsx/stylesheet/border.rb', line 6 def diagonalUp @diagonalUp end |
- (Boolean) outline
The outline property for the border indicating that top, left, right and bottom borders should only be applied to the outside border of a range of cells.
12 13 14 |
# File 'lib/axlsx/stylesheet/border.rb', line 12 def outline @outline end |
- (SimpleTypedList) prs (readonly)
A list of BorderPr objects for this border.
15 16 17 |
# File 'lib/axlsx/stylesheet/border.rb', line 15 def prs @prs end |
Instance Method Details
- (Object) to_xml(xml)
Serializes the border element
44 45 46 47 48 49 50 |
# File 'lib/axlsx/stylesheet/border.rb', line 44 def to_xml(xml) xml.border(self.instance_values.select{ |k,v| [:diagonalUp, :diagonalDown, :outline].include? k }) { [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal].each do |k| @prs.select { |pr| pr.name == k }.each { |pr| pr.to_xml(xml) } end } end |