lib/roo/google.rb in roo-0.8.1 vs lib/roo/google.rb in roo-0.8.2
- old
+ new
@@ -321,24 +321,24 @@
@first_row[sheet], @last_row[sheet], @first_column[sheet], @last_column[sheet] = @gs.oben_unten_links_rechts(sheet_no)
end
return @last_column[sheet]
end
- # write the current spreadsheet to stdout or into a file
- #--
- #TODO: refactoring --> GenericSpreadsheet
- def to_csv(filename=nil,sheet=nil)
- sheet = @default_sheet unless sheet
- if filename
- file = File.open(filename,"w") # do |file|
- write_csv_content(file,sheet)
- file.close
- else
- write_csv_content(STDOUT,sheet)
- end
- true
- end
+# # write the current spreadsheet to stdout or into a file
+# #--
+# #TODO: refactoring --> GenericSpreadsheet
+# def to_csv(filename=nil,sheet=nil)
+# sheet = @default_sheet unless sheet
+# if filename
+# file = File.open(filename,"w") # do |file|
+# write_csv_content(file,sheet)
+# file.close
+# else
+# write_csv_content(STDOUT,sheet)
+# end
+# true
+# end
# find a row either by row number or a condition
# Caution: this works only within the default sheet -> set default_sheet before you call this method
# (experimental. see examples in the test_roo.rb file)
@@ -502,69 +502,69 @@
else
return nil
end
end
- #TODO: refactoring to GenericSpreadsheet?
- def write_csv_content(file=nil,sheet=nil)
- file = STDOUT unless file
- if first_row # sheet is not empty
- first_row(sheet).upto(last_row(sheet)) do |row|
- 1.upto(last_column(sheet)) do |col|
- file.print(",") if col > 1
- onecell = cell(row,col,sheet)
- onecelltype = celltype(row,col,sheet)
- file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
- end
- file.print("\n")
- end # sheet not empty
- end
- end
+# #TODO: refactoring to GenericSpreadsheet?
+# def write_csv_content(file=nil,sheet=nil)
+# file = STDOUT unless file
+# if first_row # sheet is not empty
+# first_row(sheet).upto(last_row(sheet)) do |row|
+# 1.upto(last_column(sheet)) do |col|
+# file.print(",") if col > 1
+# onecell = cell(row,col,sheet)
+# onecelltype = celltype(row,col,sheet)
+# file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
+# end
+# file.print("\n")
+# end # sheet not empty
+# end
+# end
- #TODO: refactor to Generic....
- def one_cell_output(onecelltype,onecell,empty)
- str = ""
- if empty
- str += ''
- else
- case onecelltype
- when :string
- if onecell == ""
- str << ''
- else
- onecell.gsub!(/"/,'""')
- str << ('"'+onecell+'"')
- end
- when :float,:percentage
- if onecell == onecell.to_i
- str << onecell.to_i.to_s
- else
- str << onecell.to_s
- end
- when :formula
- if onecell.class == String
- if onecell == ""
- str << ''
- else
- onecell.gsub!(/"/,'""')
- str << '"'+onecell+'"'
- end
- elsif onecell.class == Float
- if onecell == onecell.to_i
- str << onecell.to_i.to_s
- else
- str << onecell.to_s
- end
- else
- raise "unhandled onecell-class "+onecell.class.to_s
- end
- when :date
- str << '"'+onecell.to_s+'"'
- else
- raise "unhandled celltype "+onecelltype.to_s
- end
- end
- #cells << onecell
- str
- end
+# #TODO: refactor to Generic....
+# def one_cell_output(onecelltype,onecell,empty)
+# str = ""
+# if empty
+# str += ''
+# else
+# case onecelltype
+# when :string
+# if onecell == ""
+# str << ''
+# else
+# onecell.gsub!(/"/,'""')
+# str << ('"'+onecell+'"')
+# end
+# when :float,:percentage
+# if onecell == onecell.to_i
+# str << onecell.to_i.to_s
+# else
+# str << onecell.to_s
+# end
+# when :formula
+# if onecell.class == String
+# if onecell == ""
+# str << ''
+# else
+# onecell.gsub!(/"/,'""')
+# str << '"'+onecell+'"'
+# end
+# elsif onecell.class == Float
+# if onecell == onecell.to_i
+# str << onecell.to_i.to_s
+# else
+# str << onecell.to_s
+# end
+# else
+# raise "unhandled onecell-class "+onecell.class.to_s
+# end
+# when :date
+# str << '"'+onecell.to_s+'"'
+# else
+# raise "unhandled celltype "+onecelltype.to_s
+# end
+# end
+# #cells << onecell
+# str
+# end
end # class