class Docx::Elements::Containers::Table
Public Class Methods
new(node)
click to toggle source
# File lib/docx/containers/table.rb, line 16 def initialize(node) @node = node @properties_tag = 'tblGrid' end
tag()
click to toggle source
# File lib/docx/containers/table.rb, line 12 def self.tag 'tbl' end
Public Instance Methods
column_count()
click to toggle source
# File lib/docx/containers/table.rb, line 39 def column_count @node.xpath('w:tblGrid/w:gridCol').count end
columns()
click to toggle source
Array of column
# File lib/docx/containers/table.rb, line 31 def columns columns_containers = [] (0..(column_count-1)).each do |i| columns_containers[i] = Containers::TableColumn.new @node.xpath("w:tr//w:tc[#{i+1}]") end columns_containers end
each_rows() { |r| ... }
click to toggle source
Iterate over each row within a table
# File lib/docx/containers/table.rb, line 44 def each_rows rows.each { |r| yield(r) } end
row_count()
click to toggle source
# File lib/docx/containers/table.rb, line 26 def row_count @node.xpath('w:tr').count end
rows()
click to toggle source
Array of row
# File lib/docx/containers/table.rb, line 22 def rows @node.xpath('w:tr').map {|r_node| Containers::TableRow.new(r_node) } end