class OoxmlParser::Table

Class for Table data

Attributes

grid[RW]
number[RW]
properties[RW]
rows[RW]
table_properties[RW]

Public Class Methods

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

Public Instance Methods

inspect() click to toggle source

@return [String] inspect of object for debug means

# File lib/ooxml_parser/common_parser/common_data/table.rb, line 26
def inspect
  to_s
end
parse(node, number = 0, default_table_properties = TableProperties.new) click to toggle source

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

# File lib/ooxml_parser/common_parser/common_data/table.rb, line 33
def parse(node,
          number = 0,
          default_table_properties = TableProperties.new)
  table_properties = default_table_properties.dup
  table_properties.jc = :left
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'tblGrid'
      @grid = TableGrid.new(parent: self).parse(node_child)
    when 'tr'
      @rows << TableRow.new(parent: self).parse(node_child)
    when 'tblPr'
      @properties = TableProperties.new(parent: self).parse(node_child)
    end
  end
  @number = number
  self
end
to_s() click to toggle source

@return [String] result of convert of object to string

# File lib/ooxml_parser/common_parser/common_data/table.rb, line 21
def to_s
  "Rows: #{@rows.join(',')}"
end