Class: OoxmlParser::XlsxAlignment
- Inherits:
-
Object
- Object
- OoxmlParser::XlsxAlignment
- Defined in:
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb
Instance Attribute Summary collapse
-
#horizontal ⇒ Object
Returns the value of attribute horizontal.
-
#text_rotation ⇒ Object
Returns the value of attribute text_rotation.
-
#vertical ⇒ Object
Returns the value of attribute vertical.
-
#wrap_text ⇒ Object
Returns the value of attribute wrap_text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(horizontal = :left, vertical = :bottom, wrap_text = false) ⇒ XlsxAlignment
constructor
A new instance of XlsxAlignment.
Constructor Details
#initialize(horizontal = :left, vertical = :bottom, wrap_text = false) ⇒ XlsxAlignment
Returns a new instance of XlsxAlignment.
6 7 8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 6 def initialize(horizontal = :left, vertical = :bottom, wrap_text = false) @horizontal = horizontal @vertical = vertical @wrap_text = wrap_text end |
Instance Attribute Details
#horizontal ⇒ Object
Returns the value of attribute horizontal.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 4 def horizontal @horizontal end |
#text_rotation ⇒ Object
Returns the value of attribute text_rotation.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 4 def text_rotation @text_rotation end |
#vertical ⇒ Object
Returns the value of attribute vertical.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 4 def vertical @vertical end |
#wrap_text ⇒ Object
Returns the value of attribute wrap_text.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 4 def wrap_text @wrap_text end |
Class Method Details
.parse(alignment_node) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb', line 12 def self.parse(alignment_node) alignment = XlsxAlignment.new alignment_node.attributes.each do |key, value| case key when 'horizontal' alignment.horizontal = value.value.to_sym alignment.wrap_text = true if alignment.horizontal == :justify when 'vertical' alignment.vertical = value.value.to_sym when 'wrapText' alignment.wrap_text = value.value.to_s == '1' when 'textRotation' alignment.text_rotation = value.value.to_i end end alignment end |