class OoxmlParser::XlsxAlignment
Character Alignment in XLSX
Attributes
horizontal[RW]
text_rotation[RW]
vertical[RW]
wrap_text[RW]
Public Class Methods
new(params = {})
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/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
Public Instance Methods
parse(node)
click to toggle source
Parse XlsxAlignment
object @param node [Nokogiri::XML:Element] node to parse @return [XlsxAlignment] result of parsing
# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/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