class Ruby::Ods::Manager::Sheet
Attributes
content[R]
Public Class Methods
new(content)
click to toggle source
# File lib/ruby/ods.rb, line 101 def initialize(content) @content = content end
Public Instance Methods
[](row, col)
click to toggle source
# File lib/ruby/ods.rb, line 113 def [](row, col) (row - rows.length).times do rows.push(Row.new(@content.add_element('table:table-row', 'table:style-name' => 'ro1'), rows.length+1)) end row = rows[row-1] col = ('A'..col.to_s).to_a.index(col.to_s) cols = row.cols (col - cols.length + 1).times do no = (cols.last) ? cols.last.no.to_s.succ : 'A' cols.push(Cell.new(row.add_element('table:table-cell', 'office:value-type' => 'string'), no)) end cols[col] end
column()
click to toggle source
# File lib/ruby/ods.rb, line 137 def column Column.new(@content.xpath('table:table-column').first) end
name()
click to toggle source
# File lib/ruby/ods.rb, line 105 def name @content.attribute('name').to_s end
name=(name)
click to toggle source
# File lib/ruby/ods.rb, line 109 def name=(name) @content.set_attribute('table:name', name) end
rows()
click to toggle source
# File lib/ruby/ods.rb, line 128 def rows return @rows if @rows @rows = [] @content.xpath('./table:table-row').each_with_index{|row, index| @rows << Row.new(row, index+1) } @rows end