Class: RubyDocx::Elements::TableColumn

Inherits:
Element
  • Object
show all
Defined in:
lib/ruby_docx/elements/table_column.rb

Instance Attribute Summary

Attributes inherited from Element

#doc, #grid, #node, #style

Instance Method Summary collapse

Methods inherited from Element

#elements, #initialize, #inspect, #to_s, #to_xml

Constructor Details

This class inherits a constructor from RubyDocx::Elements::Element

Instance Method Details

#col_numObject



4
5
6
# File 'lib/ruby_docx/elements/table_column.rb', line 4

def col_num
  self.node.children.size
end

#width_of(num) ⇒ Object



19
20
21
# File 'lib/ruby_docx/elements/table_column.rb', line 19

def width_of(num)
  self.widths[num].to_i
end

#widthsObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby_docx/elements/table_column.rb', line 8

def widths
  a = []
  self.node.xpath(".//w:gridCol").map do |elem|
    w = elem.attributes["w"].value.to_i

    a << w
  end

  a
end