class OoxmlParser::XlsxRow

Single Row of XLSX

Attributes

cells[RW]
custom_height[RW]

@return [True, False] true if the row height has been manually set.

height[RW]
hidden[RW]
index[RW]

@return [Integer] Indicates to which row in the sheet this <row> definition corresponds.

style[RW]

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb, line 13
def initialize(parent: nil)
  @cells = []
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse XlsxRow object @param node [Nokogiri::XML:Element] node to parse @return [XlsxRow] result of parsing

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb, line 21
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'customHeight'
      @custom_height = option_enabled?(node, 'customHeight')
    when 'ht'
      @height = OoxmlSize.new(value.value.to_f, :point)
    when 'hidden'
      @hidden = option_enabled?(node, 'hidden')
    when 'r'
      @index = value.value.to_i
    end
  end
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'c'
      @cells[Coordinates.parse_coordinates_from_string(node_child.attribute('r').value.to_s).column_number.to_i - 1] = XlsxCell.new(parent: self).parse(node_child)
    end
  end
  self
end