roo 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +0 -0
  3. data/Manifest.txt +0 -0
  4. data/README.txt +0 -0
  5. data/Rakefile +0 -0
  6. data/base64include.rb +0 -0
  7. data/examples/roo_soap_client.rb +0 -0
  8. data/examples/roo_soap_server.rb +0 -0
  9. data/examples/write_me.rb +0 -0
  10. data/lib/roo.rb +0 -0
  11. data/lib/roo/excel.rb +2 -0
  12. data/lib/roo/generic_spreadsheet.rb +29 -0
  13. data/lib/roo/google.rb +0 -0
  14. data/lib/roo/openoffice.rb +0 -0
  15. data/lib/roo/roo_rails_helper.rb +0 -0
  16. data/lib/roo/version.rb +1 -1
  17. data/scripts/txt2html +0 -0
  18. data/setup.rb +0 -0
  19. data/test/Bibelbund.csv +0 -0
  20. data/test/Bibelbund.ods +0 -0
  21. data/test/Bibelbund.xls +0 -0
  22. data/test/Bibelbund1.ods +0 -0
  23. data/test/bbu.ods +0 -0
  24. data/test/bbu.xls +0 -0
  25. data/test/bode-v1.ods.zip +0 -0
  26. data/test/bode-v1.xls.zip +0 -0
  27. data/test/borders.ods +0 -0
  28. data/test/borders.xls +0 -0
  29. data/test/false_encoding.xls +0 -0
  30. data/test/formula.ods +0 -0
  31. data/test/formula.xls +0 -0
  32. data/test/no_spreadsheet_file.txt +0 -0
  33. data/test/numbers1.csv +0 -0
  34. data/test/numbers1.ods +0 -0
  35. data/test/numbers1.xls +0 -0
  36. data/test/numbers1_excel.csv +0 -0
  37. data/test/only_one_sheet.ods +0 -0
  38. data/test/only_one_sheet.xls +0 -0
  39. data/test/ric.ods +0 -0
  40. data/test/simple_spreadsheet.ods +0 -0
  41. data/test/simple_spreadsheet.xls +0 -0
  42. data/test/simple_spreadsheet_from_italo.ods +0 -0
  43. data/test/simple_spreadsheet_from_italo.xls +0 -0
  44. data/test/test_helper.rb +0 -0
  45. data/test/test_roo.rb +102 -3
  46. data/test/time-test.csv +0 -0
  47. data/test/time-test.ods +0 -0
  48. data/test/time-test.xls +0 -0
  49. data/website/index.html +1 -1
  50. data/website/index.txt +0 -0
  51. data/website/javascripts/rounded_corners_lite.inc.js +0 -0
  52. data/website/stylesheets/screen.css +0 -0
  53. data/website/template.rhtml +0 -0
  54. metadata +3 -3
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.9.4 2008-04-22
2
+ * 1 bugfix
3
+ * fixed a bug with excel-spreadsheet character conversion under Solaris
1
4
  == 0.9.3 2008-03-25
2
5
  * 1 bugfix
3
6
  * no more tmp directories if an invalid spreadsheet file was openend
data/License.txt CHANGED
File without changes
data/Manifest.txt CHANGED
File without changes
data/README.txt CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/base64include.rb CHANGED
File without changes
File without changes
File without changes
data/examples/write_me.rb CHANGED
File without changes
data/lib/roo.rb CHANGED
File without changes
data/lib/roo/excel.rb CHANGED
@@ -345,6 +345,8 @@ class Excel < GenericSpreadsheet
345
345
  case RUBY_PLATFORM.downcase
346
346
  when /darwin/
347
347
  result = Iconv.new('utf-8','utf-8').iconv(value)
348
+ when /solaris/
349
+ result = Iconv.new('utf-8','utf-8').iconv(value)
348
350
  when /mswin32/
349
351
  result = Iconv.new('utf-8','iso-8859-1').iconv(value)
350
352
  else
@@ -1,3 +1,6 @@
1
+ require 'rubygems'
2
+ require 'builder'
3
+
1
4
  # Base class for all other types of spreadsheets
2
5
  class GenericSpreadsheet
3
6
 
@@ -378,6 +381,32 @@ class GenericSpreadsheet
378
381
  result
379
382
  end
380
383
 
384
+ def to_xml
385
+ xml_document = ''
386
+ xml = Builder::XmlMarkup.new(:target => xml_document, :indent => 2)
387
+ xml.instruct! :xml, :version =>"1.0", :encoding => "utf-8"
388
+
389
+ xml.spreadsheet {
390
+ self.sheets.each do |sheet|
391
+ self.default_sheet = sheet
392
+ xml.sheet(:name => sheet) { |x|
393
+ first_row.upto(last_row) do |row|
394
+ first_column.upto(last_column) do |col|
395
+ unless empty?(row,col)
396
+ x.cell(cell(row,col),
397
+ :row =>row,
398
+ :column => col,
399
+ :type => celltype(row,col))
400
+ end
401
+ end
402
+ end
403
+ }
404
+ end
405
+ }
406
+
407
+ xml_document
408
+ end
409
+
381
410
  protected
382
411
 
383
412
  def unzip(filename)
data/lib/roo/google.rb CHANGED
File without changes
File without changes
File without changes
data/lib/roo/version.rb CHANGED
@@ -2,7 +2,7 @@ module Roo #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/scripts/txt2html CHANGED
File without changes
data/setup.rb CHANGED
File without changes
data/test/Bibelbund.csv CHANGED
File without changes
data/test/Bibelbund.ods CHANGED
File without changes
data/test/Bibelbund.xls CHANGED
File without changes
data/test/Bibelbund1.ods CHANGED
File without changes
data/test/bbu.ods CHANGED
File without changes
data/test/bbu.xls CHANGED
File without changes
data/test/bode-v1.ods.zip CHANGED
File without changes
data/test/bode-v1.xls.zip CHANGED
File without changes
data/test/borders.ods CHANGED
File without changes
data/test/borders.xls CHANGED
File without changes
File without changes
data/test/formula.ods CHANGED
File without changes
data/test/formula.xls CHANGED
File without changes
File without changes
data/test/numbers1.csv CHANGED
File without changes
data/test/numbers1.ods CHANGED
File without changes
data/test/numbers1.xls CHANGED
File without changes
File without changes
File without changes
File without changes
data/test/ric.ods CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
data/test/test_helper.rb CHANGED
File without changes
data/test/test_roo.rb CHANGED
@@ -20,7 +20,7 @@ def local_only
20
20
  end
21
21
 
22
22
  DISPLAY_LOG = false
23
- DB_LOG = true
23
+ DB_LOG = false
24
24
 
25
25
  if DB_LOG
26
26
  # gem 'activerecord', '< 2.0.0'
@@ -117,7 +117,7 @@ class TestRoo < Test::Unit::TestCase
117
117
 
118
118
  OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
119
119
  EXCEL = true # do Excel Tests?
120
- GOOGLE = true # do Google-Spreadsheet Tests?
120
+ GOOGLE = false # do Google-Spreadsheet Tests?
121
121
  GNUMERIC_ODS = false # do gnumeric with ods files Tests?
122
122
 
123
123
  OPENOFFICEWRITE = false # experimental: write access with OO-Documents
@@ -2918,7 +2918,7 @@ Sheet 3:
2918
2918
 
2919
2919
  def test_date_time_to_csv_excel
2920
2920
  if EXCEL
2921
- after Date.new(2008,3,30) do
2921
+ after Date.new(2008,4,30) do
2922
2922
  #ueberfluessige leere Zeilen werden am Ende noch angehaengt
2923
2923
  # last_row fehlerhaft?
2924
2924
  File.delete_if_exist("/tmp/time-test.csv")
@@ -3002,4 +3002,103 @@ Sheet 3:
3002
3002
  end
3003
3003
  end
3004
3004
 
3005
+ def emit_cell(row,col,type,value)
3006
+ " <cell "+
3007
+ "row=\"#{row}\" "+
3008
+ "type=\"#{type}\" "+
3009
+ "column=\"#{col}\""+
3010
+ ">#{value}</cell>\n"
3011
+ end
3012
+
3013
+ def test_to_xml_openoffice
3014
+ if OPENOFFICE
3015
+ oo = Openoffice.new(File.join('test','numbers1.ods'))
3016
+ expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"+
3017
+ "<sheet name=\"Tabelle1\">\n"+
3018
+ emit_cell(1,1,"float","1.0")+
3019
+ emit_cell(1,2,'float','2.0')+
3020
+ emit_cell(1,3,'float','3.0')+
3021
+ emit_cell(1,4,'float','4.0')+
3022
+ emit_cell(1,5,'formula','10.0')+
3023
+ emit_cell(2,1,'float','5.0')+
3024
+ emit_cell(2,2,'float','6.0')+
3025
+ emit_cell(2,3,'float','7.0')+
3026
+ emit_cell(2,4,'float','8.0')+
3027
+ emit_cell(2,5,'float','9.0')+
3028
+ emit_cell(2,6,'string','test')+
3029
+ emit_cell(2,7,'float','11.0')+
3030
+ emit_cell(4, 1, "float", "10.0")+
3031
+ emit_cell(4, 2, "float", "11.0")+
3032
+ emit_cell(4, 3, "float", "12.0")+
3033
+ emit_cell(4, 4, "float", "13.0")+
3034
+ emit_cell(4, 5, "float", "14.0")+
3035
+ emit_cell(5, 1, "date", "1961-11-21")+
3036
+ emit_cell(6, 1, "string", "tata")+
3037
+ emit_cell(8, 3, "string", "thisisc8")+
3038
+ emit_cell(9,4, "string", "thisisd9")+
3039
+ emit_cell(11, 1, "string", "thisisa11")+
3040
+ emit_cell(12, 1, "float", "41.0")+
3041
+ emit_cell(12, 2, "float", "42.0")+
3042
+ emit_cell(12, 3, "float", "43.0")+
3043
+ emit_cell(12, 4, "float", "44.0")+
3044
+ emit_cell(12, 5, "float", "45.0")+
3045
+ emit_cell(15, 1, "float", "41.0")+
3046
+ emit_cell(15, 2, "float", "42.0")+
3047
+ emit_cell(15, 3, "float", "43.0")+
3048
+ emit_cell(15, 4, "float", "44.0")+
3049
+ emit_cell(15, 5, "float", "45.0")+
3050
+ emit_cell(16, 1, "string", "einundvierzig")+
3051
+ emit_cell(16, 2, "string", "zweiundvierzig")+
3052
+ emit_cell(16, 3, "string", "dreiundvierzig")+
3053
+ emit_cell(16, 4, "string", "vierundvierzig")+
3054
+ emit_cell(16, 5, "string", "fuenfundvierzig")+
3055
+ emit_cell(18, 1, "date", "2007-05-31")+
3056
+ emit_cell(18, 2, "string", "dies hier als Date-Objekt")+
3057
+ "</sheet>\n"+
3058
+ "<sheet name=\"Name of Sheet 2\">\n"+
3059
+ emit_cell(5, 3, "string", "I am sheet 2")+
3060
+ emit_cell(7, 2, "float", "3.0")+
3061
+ emit_cell(10, 5, "float", "7.0")+
3062
+ emit_cell(14, 4, "float", "9.0")+
3063
+ "</sheet>\n"+
3064
+ "<sheet name=\"Sheet3\">\n"+
3065
+ emit_cell(1, 1, "string", "ganz weit rechts geht&#8217;s weiter")+
3066
+ emit_cell(1, GenericSpreadsheet.letter_to_number('AA'), "string", "i am AA")+
3067
+ emit_cell(1, GenericSpreadsheet.letter_to_number('AB'), "string", "i am AB")+
3068
+ emit_cell(1, GenericSpreadsheet.letter_to_number('BA'), "string", "i am BA")+
3069
+ "</sheet>\n"+
3070
+ "<sheet name=\"Sheet4\">\n"+
3071
+ emit_cell(1, 1, "date", "2007-06-16")+
3072
+ emit_cell(1, 2, "float", "10.0")+
3073
+ emit_cell(1, 3, "float", "10.0")+
3074
+ emit_cell(1, 4, "float", "10.0")+
3075
+ emit_cell(1, 5, "float", "10.0")+
3076
+ "</sheet>\n"+
3077
+ "<sheet name=\"Sheet5\">\n"+
3078
+ emit_cell(1, 1, "float", "1.0")+
3079
+ emit_cell(1, 2, "float", "5.0")+
3080
+ emit_cell(1, 3, "float", "5.0")+
3081
+ emit_cell(2, 1, "float", "2.0")+
3082
+ emit_cell(3, 1, "float", "3.0")+
3083
+ emit_cell(4, 1, "date", "2007-11-21")+
3084
+ emit_cell(4, 2, "date", "2007-11-21")+
3085
+ emit_cell(4, 3, "date", "2007-11-21")+
3086
+ emit_cell(4, 4, "date", "2007-11-21")+
3087
+ emit_cell(4, 5, "date", "2007-11-21")+
3088
+ emit_cell(5, 1, "float", "42.0")+
3089
+ emit_cell(5, 2, "float", "42.0")+
3090
+ emit_cell(5, 3, "float", "42.0")+
3091
+ emit_cell(5, 4, "float", "42.0")+
3092
+ emit_cell(5, 5, "float", "42.0")+
3093
+ emit_cell(6, 1, "string", "ABC")+
3094
+ emit_cell(6, 2, "string", "ABC")+
3095
+ emit_cell(6, 3, "string", "ABC")+
3096
+ emit_cell(6, 4, "string", "ABC")+
3097
+ emit_cell(6, 5, "string", "ABC")+
3098
+ "</sheet>\n"+
3099
+ ""
3100
+ # oo.default_sheet = oo.sheets.first
3101
+ assert_equal expected, oo.to_xml
3102
+ end
3103
+ end
3005
3104
  end # class
data/test/time-test.csv CHANGED
File without changes
data/test/time-test.ods CHANGED
File without changes
data/test/time-test.xls CHANGED
File without changes
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>roo</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/roo"; return false'>
35
35
  Get Version
36
- <a href="http://rubyforge.org/projects/roo" class="numbers">0.9.3</a>
36
+ <a href="http://rubyforge.org/projects/roo" class="numbers">0.9.4</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
data/website/index.txt CHANGED
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Preymesser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-25 00:00:00 +01:00
12
+ date: 2008-04-22 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements: []
139
139
 
140
140
  rubyforge_project: roo
141
- rubygems_version: 1.0.1
141
+ rubygems_version: 1.1.1
142
142
  signing_key:
143
143
  specification_version: 2
144
144
  summary: roo can access the contents of OpenOffice-, Excel- or Google-Spreadsheets