Class: OoxmlParser::XlsxAlignment
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::XlsxAlignment
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb
Overview
Character Alignment in XLSX
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.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ XlsxAlignment
constructor
A new instance of XlsxAlignment.
-
#parse(node) ⇒ XlsxAlignment
Parse XlsxAlignment object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(params = {}) ⇒ XlsxAlignment
Returns a new instance of XlsxAlignment.
8 9 10 11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 8 def initialize(params = {}) @horizontal = params.fetch(:horizontal, :left) @vertical = params.fetch(:vertical, :bottom) @wrap_text = params.fetch(:wrap_text, false) super(parent: params[:parent]) end |
Instance Attribute Details
#horizontal ⇒ Object
Returns the value of attribute horizontal.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 6 def horizontal @horizontal end |
#text_rotation ⇒ Object
Returns the value of attribute text_rotation.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 6 def text_rotation @text_rotation end |
#vertical ⇒ Object
Returns the value of attribute vertical.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 6 def vertical @vertical end |
#wrap_text ⇒ Object
Returns the value of attribute wrap_text.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 6 def wrap_text @wrap_text end |
Instance Method Details
#parse(node) ⇒ XlsxAlignment
Parse XlsxAlignment object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/alignment.rb', line 18 def parse(node) node.attributes.each do |key, value| case key when 'horizontal' @horizontal = value.value.to_sym @wrap_text = true if @horizontal == :justify when 'vertical' @vertical = value.value.to_sym when 'wrapText' @wrap_text = value.value.to_s == '1' when 'textRotation' @text_rotation = value.value.to_i end end self end |