Sha256: d540c9d60fe7a6e99aff7a4070ebd24a02d209c9b4de60dcfef4a1b4825b8126

Contents?: true

Size: 1.15 KB

Versions: 40

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require_relative 'cell/cell'
require_relative 'row/table_row_properties'
module OoxmlParser
  # Class for data of TableRow
  class TableRow < OOXMLDocumentObject
    attr_accessor :height, :cells, :table_row_properties

    def initialize(cells = [], parent: nil)
      @cells = cells
      super(parent: parent)
    end

    alias table_row_height height

    # Parse TableRow object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [TableRow] result of parsing
    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
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ooxml_parser-0.21.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.11.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.10.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.9.1 lib/ooxml_parser/common_parser/common_data/table/row/row.rb
ooxml_parser-0.9.0 lib/ooxml_parser/common_parser/common_data/table/row/row.rb