lib/roo/openoffice.rb in roo-0.9.2 vs lib/roo/openoffice.rb in roo-0.9.3

- old
+ new

@@ -26,21 +26,24 @@ # self.create_openoffice(filename) #end @cells_read = Hash.new #TODO: @cells_read[:default] = false @filename = filename - unless File.file?(@filename) - raise IOError, "file #{@filename} does not exist" + begin + unless File.file?(@filename) + raise IOError, "file #{@filename} does not exist" + end + @@nr += 1 + @file_nr = @@nr + extract_content + file = File.new(File.join(@tmpdir, @file_nr.to_s+"_roo_content.xml")) + @doc = REXML::Document.new file + file.close + ensure + #if ENV["roo_local"] != "thomas-p" + FileUtils::rm_r(@tmpdir) + #end end - @@nr += 1 - @file_nr = @@nr - extract_content - file = File.new(File.join(@tmpdir, @file_nr.to_s+"_roo_content.xml")) - @doc = REXML::Document.new file - file.close - #if ENV["roo_local"] != "thomas-p" - FileUtils::rm_r(@tmpdir) - #end @default_sheet = nil # no need to set default_sheet if there is only one sheet in the document if self.sheets.size == 1 @default_sheet = self.sheets.first end