lib/roo/openoffice.rb in roo-0.0.2 vs lib/roo/openoffice.rb in roo-0.0.3

- old
+ new

@@ -1,9 +1,9 @@ require 'rubygems' require 'rexml/document' -require 'matrix' +# require 'matrix' require 'fileutils' require 'zip/zipfilesystem' class Openoffice @@ -98,9 +98,26 @@ end def to_s @cell.inspect end + + # returns all values in this row as an array + # row numbers are 1,2,3,... like in the spreadsheet + def row(rownumber) + read_cells unless @cells_read + result = [] + @cell.each_pair {|key,value| + y,x = key.split(',') + x = x.to_i + y = y.to_i + if y == rownumber + result[x-1,rownumber] = value + end + } + result + end + private # read all cells in the selected sheet def read_cells oo_document_count = 0