class OoxmlParser::TableRow

Class for data of TableRow

Attributes

cells[RW]
height[RW]
table_row_height[RW]
table_row_properties[RW]

Public Class Methods

new(cells = [], parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/table/row/row.rb, line 10
def initialize(cells = [], parent: nil)
  @cells = cells
  super(parent: parent)
end

Public Instance Methods

parse(node) click to toggle source

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

# File lib/ooxml_parser/common_parser/common_data/table/row/row.rb, line 20
def parse(node)
  root_object.default_font_style = FontStyle.new(true) # TODO: Add correct parsing of TableStyle.xml file and use it
  node.attributes.each do |key, value|
    case key
    when 'h'
      @height = OoxmlSize.new(value.value.to_f, :emu)
    end
  end
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'trPr'
      @table_row_properties = TableRowProperties.new(parent: self).parse(node_child)
    when 'tc'
      @cells << TableCell.new(parent: self).parse(node_child)
    end
  end
  root_object.default_font_style = FontStyle.new
  self
end