lib/roo/openoffice.rb in roo-0.1.2 vs lib/roo/openoffice.rb in roo-0.2.0
- old
+ new
@@ -25,11 +25,11 @@
extract_content
file = File.new(@tmpdir+"/"+"roo_content.xml") # TODO:
@doc = REXML::Document.new file
@cell = Hash.new
@cell_type = Hash.new
- if DateTime.now < Date.new(2007,6,1)
+ if DateTime.now > Date.new(2007,5,31)
FileUtils::rm_r(@tmpdir)
end
@default_sheet = nil
end
@@ -184,14 +184,20 @@
def as_letter(n)
number_to_letter(last_row)
end
-private
-
def number_to_letter(n)
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[n-1,1]
- end
+ letters=""
+ while n > 0
+ num = n%26
+ letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num-1,1] + letters
+ n = n.div(26)
+ end
+ letters
+ end
+
+private
# read all cells in the selected sheet
def read_cells
oo_document_count = 0
@doc.each_element do |oo_document|