roo 1.13.2 → 2.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +17 -0
  3. data/.github/issue_template.md +16 -0
  4. data/.github/pull_request_template.md +14 -0
  5. data/.github/workflows/pull-request.yml +15 -0
  6. data/.github/workflows/ruby.yml +34 -0
  7. data/.gitignore +11 -0
  8. data/.rubocop.yml +186 -0
  9. data/.simplecov +4 -0
  10. data/CHANGELOG.md +702 -0
  11. data/Gemfile +18 -12
  12. data/Guardfile +23 -0
  13. data/LICENSE +5 -1
  14. data/README.md +328 -0
  15. data/Rakefile +23 -23
  16. data/examples/roo_soap_client.rb +28 -31
  17. data/examples/roo_soap_server.rb +4 -6
  18. data/examples/write_me.rb +9 -10
  19. data/lib/roo/base.rb +317 -504
  20. data/lib/roo/constants.rb +7 -0
  21. data/lib/roo/csv.rb +141 -113
  22. data/lib/roo/errors.rb +11 -0
  23. data/lib/roo/excelx/cell/base.rb +108 -0
  24. data/lib/roo/excelx/cell/boolean.rb +30 -0
  25. data/lib/roo/excelx/cell/date.rb +28 -0
  26. data/lib/roo/excelx/cell/datetime.rb +107 -0
  27. data/lib/roo/excelx/cell/empty.rb +20 -0
  28. data/lib/roo/excelx/cell/number.rb +99 -0
  29. data/lib/roo/excelx/cell/string.rb +19 -0
  30. data/lib/roo/excelx/cell/time.rb +44 -0
  31. data/lib/roo/excelx/cell.rb +110 -0
  32. data/lib/roo/excelx/comments.rb +55 -0
  33. data/lib/roo/excelx/coordinate.rb +19 -0
  34. data/lib/roo/excelx/extractor.rb +39 -0
  35. data/lib/roo/excelx/format.rb +71 -0
  36. data/lib/roo/excelx/images.rb +26 -0
  37. data/lib/roo/excelx/relationships.rb +33 -0
  38. data/lib/roo/excelx/shared.rb +39 -0
  39. data/lib/roo/excelx/shared_strings.rb +151 -0
  40. data/lib/roo/excelx/sheet.rb +151 -0
  41. data/lib/roo/excelx/sheet_doc.rb +257 -0
  42. data/lib/roo/excelx/styles.rb +64 -0
  43. data/lib/roo/excelx/workbook.rb +64 -0
  44. data/lib/roo/excelx.rb +407 -601
  45. data/lib/roo/font.rb +17 -0
  46. data/lib/roo/formatters/base.rb +15 -0
  47. data/lib/roo/formatters/csv.rb +84 -0
  48. data/lib/roo/formatters/matrix.rb +23 -0
  49. data/lib/roo/formatters/xml.rb +31 -0
  50. data/lib/roo/formatters/yaml.rb +40 -0
  51. data/lib/roo/helpers/default_attr_reader.rb +20 -0
  52. data/lib/roo/helpers/weak_instance_cache.rb +41 -0
  53. data/lib/roo/libre_office.rb +4 -0
  54. data/lib/roo/link.rb +34 -0
  55. data/lib/roo/open_office.rb +631 -0
  56. data/lib/roo/spreadsheet.rb +28 -23
  57. data/lib/roo/tempdir.rb +24 -0
  58. data/lib/roo/utils.rb +128 -0
  59. data/lib/roo/version.rb +3 -0
  60. data/lib/roo.rb +26 -24
  61. data/roo.gemspec +29 -203
  62. data/spec/helpers.rb +5 -0
  63. data/spec/lib/roo/base_spec.rb +291 -3
  64. data/spec/lib/roo/csv_spec.rb +38 -11
  65. data/spec/lib/roo/excelx/cell/time_spec.rb +15 -0
  66. data/spec/lib/roo/excelx/format_spec.rb +7 -6
  67. data/spec/lib/roo/excelx/relationships_spec.rb +43 -0
  68. data/spec/lib/roo/excelx/sheet_doc_spec.rb +11 -0
  69. data/spec/lib/roo/excelx_spec.rb +672 -11
  70. data/spec/lib/roo/libreoffice_spec.rb +16 -6
  71. data/spec/lib/roo/openoffice_spec.rb +30 -8
  72. data/spec/lib/roo/spreadsheet_spec.rb +60 -12
  73. data/spec/lib/roo/strict_spec.rb +43 -0
  74. data/spec/lib/roo/utils_spec.rb +119 -0
  75. data/spec/lib/roo/weak_instance_cache_spec.rb +92 -0
  76. data/spec/lib/roo_spec.rb +0 -0
  77. data/spec/spec_helper.rb +7 -6
  78. data/test/all_ss.rb +12 -11
  79. data/test/excelx/cell/test_attr_reader_default.rb +72 -0
  80. data/test/excelx/cell/test_base.rb +68 -0
  81. data/test/excelx/cell/test_boolean.rb +36 -0
  82. data/test/excelx/cell/test_date.rb +38 -0
  83. data/test/excelx/cell/test_datetime.rb +45 -0
  84. data/test/excelx/cell/test_empty.rb +18 -0
  85. data/test/excelx/cell/test_number.rb +90 -0
  86. data/test/excelx/cell/test_string.rb +48 -0
  87. data/test/excelx/cell/test_time.rb +30 -0
  88. data/test/excelx/test_coordinate.rb +51 -0
  89. data/test/formatters/test_csv.rb +136 -0
  90. data/test/formatters/test_matrix.rb +76 -0
  91. data/test/formatters/test_xml.rb +78 -0
  92. data/test/formatters/test_yaml.rb +20 -0
  93. data/test/helpers/test_accessing_files.rb +81 -0
  94. data/test/helpers/test_comments.rb +43 -0
  95. data/test/helpers/test_formulas.rb +9 -0
  96. data/test/helpers/test_labels.rb +103 -0
  97. data/test/helpers/test_sheets.rb +55 -0
  98. data/test/helpers/test_styles.rb +62 -0
  99. data/test/roo/test_base.rb +182 -0
  100. data/test/roo/test_csv.rb +88 -0
  101. data/test/roo/test_excelx.rb +360 -0
  102. data/test/roo/test_libre_office.rb +9 -0
  103. data/test/roo/test_open_office.rb +289 -0
  104. data/test/test_helper.rb +123 -59
  105. data/test/test_roo.rb +392 -2292
  106. metadata +153 -298
  107. data/CHANGELOG +0 -417
  108. data/Gemfile.lock +0 -78
  109. data/README.markdown +0 -126
  110. data/VERSION +0 -1
  111. data/lib/roo/excel.rb +0 -355
  112. data/lib/roo/excel2003xml.rb +0 -300
  113. data/lib/roo/google.rb +0 -292
  114. data/lib/roo/openoffice.rb +0 -496
  115. data/lib/roo/roo_rails_helper.rb +0 -83
  116. data/lib/roo/worksheet.rb +0 -18
  117. data/scripts/txt2html +0 -67
  118. data/spec/lib/roo/excel2003xml_spec.rb +0 -15
  119. data/spec/lib/roo/excel_spec.rb +0 -17
  120. data/spec/lib/roo/google_spec.rb +0 -64
  121. data/test/files/1900_base.xls +0 -0
  122. data/test/files/1900_base.xlsx +0 -0
  123. data/test/files/1904_base.xls +0 -0
  124. data/test/files/1904_base.xlsx +0 -0
  125. data/test/files/Bibelbund.csv +0 -3741
  126. data/test/files/Bibelbund.ods +0 -0
  127. data/test/files/Bibelbund.xls +0 -0
  128. data/test/files/Bibelbund.xlsx +0 -0
  129. data/test/files/Bibelbund.xml +0 -62518
  130. data/test/files/Bibelbund1.ods +0 -0
  131. data/test/files/Pfand_from_windows_phone.xlsx +0 -0
  132. data/test/files/bad_excel_date.xls +0 -0
  133. data/test/files/bbu.ods +0 -0
  134. data/test/files/bbu.xls +0 -0
  135. data/test/files/bbu.xlsx +0 -0
  136. data/test/files/bbu.xml +0 -152
  137. data/test/files/bode-v1.ods.zip +0 -0
  138. data/test/files/bode-v1.xls.zip +0 -0
  139. data/test/files/boolean.csv +0 -2
  140. data/test/files/boolean.ods +0 -0
  141. data/test/files/boolean.xls +0 -0
  142. data/test/files/boolean.xlsx +0 -0
  143. data/test/files/boolean.xml +0 -112
  144. data/test/files/borders.ods +0 -0
  145. data/test/files/borders.xls +0 -0
  146. data/test/files/borders.xlsx +0 -0
  147. data/test/files/borders.xml +0 -144
  148. data/test/files/bug-numbered-sheet-names.xlsx +0 -0
  149. data/test/files/bug-row-column-fixnum-float.xls +0 -0
  150. data/test/files/bug-row-column-fixnum-float.xml +0 -127
  151. data/test/files/comments.ods +0 -0
  152. data/test/files/comments.xls +0 -0
  153. data/test/files/comments.xlsx +0 -0
  154. data/test/files/csvtypes.csv +0 -1
  155. data/test/files/datetime.ods +0 -0
  156. data/test/files/datetime.xls +0 -0
  157. data/test/files/datetime.xlsx +0 -0
  158. data/test/files/datetime.xml +0 -142
  159. data/test/files/datetime_floatconv.xls +0 -0
  160. data/test/files/datetime_floatconv.xml +0 -148
  161. data/test/files/dreimalvier.ods +0 -0
  162. data/test/files/emptysheets.ods +0 -0
  163. data/test/files/emptysheets.xls +0 -0
  164. data/test/files/emptysheets.xlsx +0 -0
  165. data/test/files/emptysheets.xml +0 -105
  166. data/test/files/excel2003.xml +0 -21140
  167. data/test/files/false_encoding.xls +0 -0
  168. data/test/files/false_encoding.xml +0 -132
  169. data/test/files/file_item_error.xlsx +0 -0
  170. data/test/files/formula.ods +0 -0
  171. data/test/files/formula.xls +0 -0
  172. data/test/files/formula.xlsx +0 -0
  173. data/test/files/formula.xml +0 -134
  174. data/test/files/formula_parse_error.xls +0 -0
  175. data/test/files/formula_parse_error.xml +0 -1833
  176. data/test/files/formula_string_error.xlsx +0 -0
  177. data/test/files/html-escape.ods +0 -0
  178. data/test/files/link.xls +0 -0
  179. data/test/files/link.xlsx +0 -0
  180. data/test/files/matrix.ods +0 -0
  181. data/test/files/matrix.xls +0 -0
  182. data/test/files/named_cells.ods +0 -0
  183. data/test/files/named_cells.xls +0 -0
  184. data/test/files/named_cells.xlsx +0 -0
  185. data/test/files/no_spreadsheet_file.txt +0 -1
  186. data/test/files/numbers1.csv +0 -18
  187. data/test/files/numbers1.ods +0 -0
  188. data/test/files/numbers1.xls +0 -0
  189. data/test/files/numbers1.xlsx +0 -0
  190. data/test/files/numbers1.xml +0 -312
  191. data/test/files/numeric-link.xlsx +0 -0
  192. data/test/files/only_one_sheet.ods +0 -0
  193. data/test/files/only_one_sheet.xls +0 -0
  194. data/test/files/only_one_sheet.xlsx +0 -0
  195. data/test/files/only_one_sheet.xml +0 -67
  196. data/test/files/paragraph.ods +0 -0
  197. data/test/files/paragraph.xls +0 -0
  198. data/test/files/paragraph.xlsx +0 -0
  199. data/test/files/paragraph.xml +0 -127
  200. data/test/files/prova.xls +0 -0
  201. data/test/files/ric.ods +0 -0
  202. data/test/files/simple_spreadsheet.ods +0 -0
  203. data/test/files/simple_spreadsheet.xls +0 -0
  204. data/test/files/simple_spreadsheet.xlsx +0 -0
  205. data/test/files/simple_spreadsheet.xml +0 -225
  206. data/test/files/simple_spreadsheet_from_italo.ods +0 -0
  207. data/test/files/simple_spreadsheet_from_italo.xls +0 -0
  208. data/test/files/simple_spreadsheet_from_italo.xml +0 -242
  209. data/test/files/so_datetime.csv +0 -7
  210. data/test/files/style.ods +0 -0
  211. data/test/files/style.xls +0 -0
  212. data/test/files/style.xlsx +0 -0
  213. data/test/files/style.xml +0 -154
  214. data/test/files/time-test.csv +0 -2
  215. data/test/files/time-test.ods +0 -0
  216. data/test/files/time-test.xls +0 -0
  217. data/test/files/time-test.xlsx +0 -0
  218. data/test/files/time-test.xml +0 -131
  219. data/test/files/type_excel.ods +0 -0
  220. data/test/files/type_excel.xlsx +0 -0
  221. data/test/files/type_excelx.ods +0 -0
  222. data/test/files/type_excelx.xls +0 -0
  223. data/test/files/type_openoffice.xls +0 -0
  224. data/test/files/type_openoffice.xlsx +0 -0
  225. data/test/files/whitespace.ods +0 -0
  226. data/test/files/whitespace.xls +0 -0
  227. data/test/files/whitespace.xlsx +0 -0
  228. data/test/files/whitespace.xml +0 -184
  229. data/test/rm_sub_test.rb +0 -12
  230. data/test/rm_test.rb +0 -7
  231. data/test/test_generic_spreadsheet.rb +0 -259
  232. data/website/index.html +0 -385
  233. data/website/index.txt +0 -423
  234. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  235. data/website/stylesheets/screen.css +0 -130
  236. data/website/template.rhtml +0 -48
data/website/index.txt DELETED
@@ -1,423 +0,0 @@
1
- h1. roo
2
-
3
- h2. What
4
-
5
- This gem allows you to access the content of
6
-
7
- * Open-office spreadsheets (.ods)
8
- * Excel spreadsheets (.xls)
9
- * Google (online) spreadsheets
10
- * Excel's new file format .xlsx
11
-
12
- h2. Supporting this project
13
-
14
- Die Programme dieses Projekts sind kostenlos erhältlich und verwendbar.
15
- Du kannst jedoch die weitere Entwicklung dieses Projekts mit einer finanziellen
16
- Zuwendung unterstützen (ansonsten müßte ich mich verstärkt anderen Projekten
17
- widmen, die mehr finanziellen Ertrag einbringen, damit ich auch morgen noch
18
- für meine Katzen das Futter kaufen kann :-)).
19
-
20
- Am bequemsten kannst du per Paypal an die Email-Adresse thopre@gmail.com
21
- bezahlen.
22
- Falls du per Überweisung zahlen willst, frage bitte nach meiner Kontoverbindung!
23
-
24
- Ich werde, aufteilt pro Quartal, eine Liste der Spender mit Namen und Betrag,
25
- sortiert nach Spendenhöhe hier veröffenlichen. Wenn von dir nichts anderes
26
- mitgeteilt, werde ich dich nach deinem Namen, soweit aus der Email-Adresse
27
- ersichtlich, in der Liste veröffenlichen. Falls etwas anderes gewünscht wird,
28
- z. B. "Firma ABC GmbH" oder anonym, dann teile mir dies bitte mit!
29
-
30
- h3. Spender
31
-
32
- h4. Juli-September 2008
33
-
34
- table.
35
- |Betrag|Name|
36
- |-|-|
37
-
38
- h4. April-Juni 2008
39
-
40
- table.
41
- |Betrag|Name|
42
- |-|-|
43
-
44
-
45
-
46
- h2. Installing
47
-
48
- <pre syntax="ruby">[sudo] gem install roo</pre>
49
-
50
- h2. The basics
51
-
52
- Currently only read-access is implemented.
53
- Google spreadsheets can be read and written.
54
-
55
- Please note that the upper left cell of a table is numbered (1,1) or (1,'A') (not 0,0).
56
-
57
- h2. Demonstration of usage
58
-
59
- Supposed you have created this spreadsheet:
60
-
61
- <img src="Screenshot-spreadsheet3.png">
62
-
63
- which includes the amount of work you have done for a customer.
64
-
65
- You can now process this spreadsheet with the following sample code.
66
-
67
- <pre>
68
- <code>
69
- 1 require 'rubygems'
70
- 2 require 'roo'
71
- 3
72
- 4 HOURLY_RATE = 123.45
73
- 5
74
- 6 oo = OpenOffice.new("simple_spreadsheet.ods")
75
- 7 oo.default_sheet = oo.sheets.first
76
- 8 4.upto(12) do |line|
77
- 9 date = oo.cell(line,'A')
78
- 10 start_time = oo.cell(line,'B')
79
- 11 end_time = oo.cell(line,'C')
80
- 12 pause = oo.cell(line,'D')
81
- 13 sum = (end_time - start_time) - pause
82
- 14 comment = oo.cell(line,'F')
83
- 15 amount = sum * HOURLY_RATE
84
- 16 if date
85
- 17 puts "#{date}\t#{sum}\t#{amount}\t#{comment}"
86
- 18 end
87
- 19 end
88
- </code>
89
- </pre>
90
-
91
- which produces this output
92
-
93
- <pre>
94
- <code>
95
- 2007-05-07 1.0 123.45 Task 1
96
- 2007-05-07 1.75 216.0375 Task 1
97
- 2007-05-07 1.0 123.45 Task 2
98
- 2007-05-08 1.0 123.45 Task 2
99
- 2007-05-08 1.0 123.45 Task 3
100
- 2007-05-08 0.5 61.725 Task 3
101
- 2007-05-14 0.5 61.725 Task 3
102
- 2007-05-14 0.5 61.725 Task 3
103
- 2007-05-15 1.0 123.45 Task 3
104
- </code>
105
- </pre>
106
-
107
- With the methods
108
-
109
- <code>first_column</code>,
110
- <code>last_column</code>,
111
- <code>first_row</code> and
112
- <code>last_row</code>
113
-
114
- you can change line 8 from
115
-
116
- <pre>
117
- <code>
118
- 4.upto(12) do |line|
119
- </code>
120
- </pre>
121
-
122
- to
123
-
124
- <pre>
125
- <code>
126
- 4.upto(oo.last_row) do |line|
127
- </code>
128
- </pre>
129
-
130
- h3. Cell Types
131
-
132
- oo.*celltype*(row,col) returns the type of a cell. Currently these types will be
133
- returned:
134
-
135
- * :float
136
- * :string
137
- * :date
138
- * :percentage
139
- * :formula
140
- * :time
141
- * :datetime
142
-
143
- Numeric values are returned as type :float, the return value is a Ruby Float object (note: integer values like 42 are returned as 42.0 - not as a Fixnum 42 object).
144
-
145
- String values are returned as type :string and Ruby String object.
146
-
147
- Date values are returned as type :date and as a Ruby Date object.
148
-
149
- Datetime values are returned as type :datetime and as a Ruby DateTime object.
150
-
151
- Percentage are return as type :percentage and as Ruby Float object with the
152
- range from 0.0 to 1.0.
153
-
154
- Formulas are returned as type :formula - the value of the cell is the computed
155
- value of this formula. The formula itself can be retrieved with the #formula
156
- method.
157
-
158
- Time values are returned as type :time - the value of the cell are the seconds
159
- from midnight as a Fixnum object
160
-
161
- h3. Write access
162
-
163
- Cells in a google spreadsheet can be read or written.
164
-
165
- To write to a cell use the method call:
166
-
167
- <pre>
168
- <code>
169
- oo.set_value(row, col, value)
170
- </code>
171
- </pre>
172
-
173
- There is an example in the examples folder which illustrates write access.
174
-
175
- h3. Formulas
176
-
177
- Formulas in OpenOffice- and Google-Spreadsheets can be handled.
178
-
179
- oo.*celltype*(row,col) returns :formula if there is a formula in this cell.
180
-
181
- oo.*formula?*(row,col) returns true if there is a formula
182
-
183
- oo.*formula*(row,col) returns the formula in this cell in a string variable (like "=SUM([.A1:.M13])").
184
- You can do whatever you want with this expression. Please note that the syntax of
185
- formulas might vary between different sort of spreadsheets. There is no conversion
186
- of the formula syntax.
187
-
188
- If there is no formula in this cell nil is returned.
189
-
190
- oo.*cell*(row,col) returns the computed result of the formula (as it was saved in the file, no recalculation is done in this Gem).
191
-
192
- oo.*formulas* returns all formulas in the selected spreadsheet in an array like this:
193
-
194
- <pre>
195
- <code>
196
- [[1,2,"=SUM(.A1:.B1)"],
197
- [1,3,"=SIN(.C3)"],
198
- [1,4,"=COS(.D4)"]]
199
- </code>
200
- </pre>
201
-
202
- Each entry consists of the elements row, col, formula.
203
-
204
- Note: oo.*cell*(row,col) is the same for ordinary cells and formulas. So you can use the computated value of a formula. If you have to distinguish if a cell is a formula use #*formula*?
205
-
206
- Please note: formulas in Excel-Spreadsheets cannot be handled (this is another gem, see: "Thanks")
207
-
208
- h3. YAML-Output
209
-
210
- You can generate YAML-Output from your spreadsheet data. The method is called:
211
-
212
- oo.to_yaml # => produces YAML output from the entire default spreadsheet
213
- oo.to_yaml({"myattribute1" => "myvalue1", "myattribute2" => "myvalue2")
214
- # => YAML output with additional attributes
215
- oo.to_yaml({..}, 2,10, 300,10) # => only the rectangle from row 2, column 10 to row 300, column 10 will be returned
216
-
217
- If you omit one or more parameters the maximum boundaries of your spreadsheet will be used.
218
-
219
- With the YAML output you can import your data in a Ruby on Rails application in a manner that spreadsheet data can accessed in a Rails application.
220
-
221
- This is not limited to a Rails application - you can also do further evaluations with your data.
222
-
223
- h3. CSV-Output
224
-
225
- You can generate output in csv-format with
226
-
227
- <pre>
228
- <code>
229
- oo.to_csv
230
- </code>
231
- </pre>
232
-
233
- to write to the standard output or
234
-
235
- <pre>
236
- <code>
237
- oo.to_csv("somefile.txt")
238
- </code>
239
- </pre>
240
-
241
- to write to a file.
242
-
243
- h3. Using MS-Excel spreadsheets
244
-
245
- You can also access MS-Excel spreadsheat.
246
-
247
- Replace OpenOffice with
248
- <pre>
249
- <code>oo = Excel.new("simple_spreadsheet.xls").
250
-
251
- </code>
252
- </pre>
253
-
254
- or Google.new() or Excelx.new().
255
-
256
- All methode are the same for OpenOffice-, Excel- and Google-objects.
257
- <strike> The only difference
258
- is the setting of the default-worksheet. OpenOffice uses the name of the worksheet whereas Excel needs the index of the worksheet (1,2,3,..).
259
- </strike>
260
-
261
- Formulas can only be handled in OpenOffice-, Excel .XLSX files and Google-spreadsheets.
262
-
263
- Features in OpenOffice/Excel/Google:
264
-
265
- table(border:1px solid black).
266
- |feature|Open Office|Excel|Google|Excel .xlsx|
267
- |formulas|yes|no|yes|yes|
268
- |celltype|:percentage|:float|:percentage|:percentage|
269
- |access|read-only|read-only|read and write|read-only|
270
-
271
- The parseexcel-gem does not support the celltype 'percentage' but uses 'float' instead. This is not a big deal as you can also use 'float' to do calculations with these cells.
272
-
273
- Old .sxc OpenOffice files are currently not supported - please load these files and save it as an "OpenDocument Spreadsheet (.ods)".
274
-
275
- Instead of a filename the Google#new method needs the 'key' of a Google-Spreadsheet. This key can be copied from the URL when you display a google spreadsheet with your browser.
276
-
277
- If you want to use Google spreadsheets you must either have set the
278
- environment variables 'GOOGLE_MAIL' and 'GOOGLE_PASSWORD' or you pass
279
- the Google-name and -password to the Google#new method.
280
-
281
- Setting these variables can be done if you add these lines to your
282
- ~/.bashrc (or similar setup file within other shells):
283
-
284
- export GOOGLE_MAIL="yourname@gmail.com"
285
- export GOOGLE_PASSWORD="mysecretpassword"
286
-
287
- This gem does not check if you are allowed to access a specific google spreadsheet. If it's not your own spreadsheet or you are not allowed to read or write to a spreadsheet the behaviour is not defined (but it will not work ;-) ).
288
-
289
- The default behavior at opening a spreadsheet with a certain extension has been
290
- changed.
291
- Say you're trying to open a spreadsheet file with the extension .xls, which is normally
292
- an Excel file
293
- with the OpenOffice.new() call. This cannot work, if the file is really an excel file - instead
294
- you have to open it with the Excel.new() call.
295
-
296
- Now you're getting an exception raised. Before it was was only a warning and the
297
- access to this file failed.
298
-
299
- Theorectically you can have a file with the extension .xls which is in fact an OpenOffice spreadsheet file.
300
-
301
- It's possible to open such a file with the OpenOffice class, but you have have to
302
- override the parameter 'file_warning' in the new method:
303
- 'OpenOffice.new('myfile.xls', false, :warning)' or
304
- 'OpenOffice.new('myfile.xls', false, :ignore)'.
305
-
306
- If you set it to :warning you get a warning if you try to use a spreadsheet file with
307
- the 'false' extension, but the
308
- program will try to handle the file with this class (of course this will fail, if the file
309
- is really of the false type).
310
-
311
- If you completely know what you are doing you can also disable the warning with the
312
- parameter :ignore.
313
-
314
- Temporary files of this gem are stored in directories which are named with 'oo_' and
315
- a number (the PID of the current process).
316
- These directories are created within the current working directory. If you want to
317
- use a different directory for temporary files set the environment variable ROO_TMP! (for
318
- example "export ROO_TMP=/tmp" in your .bashrc file).
319
- ROO_TMP was introduced in releases >1.1.0.
320
-
321
- h3. Accessing Spreadsheet over the Web
322
-
323
- You can even read openoffice or excel-spreadsheets from a http-address:
324
- <pre>
325
- <code>oo = Excel.new("http://www.somedomain.com/simple_spreadsheet.xls").
326
- oo = OpenOffice.new("http://www.somedomain.com/simple_spreadsheet.ods").
327
- </code>
328
- </pre>
329
-
330
- or a zipped file:
331
- <pre>
332
- <code>oo = Excel.new("http://www.somedomain.com/simple_spreadsheet.xls.zip",:zip).
333
- oo = OpenOffice.new("http://www.somedomain.com/simple_spreadsheet.ods.zip",:zip).
334
- </code>
335
- </pre>
336
-
337
- after working with a spreadsheet from the web you have to call
338
- <pre>
339
- <code>oo.remove_tmp
340
- </code>
341
- </pre>
342
-
343
- to delete the temporary local copy of the spreadsheet file. If you don't call
344
- this method you will have subdirectories names 'oo_xxxxx' which you can remove manually.
345
- Calling remove_tmp is not the best solution to clean temporary files - i will
346
- provide a better solution in the next releases.
347
-
348
-
349
- h3. Remote Access
350
-
351
- You can even access your spreadsheet data from a remote machine via SOAP. The examples directory shows a little example how to do this. If you like, you can extend these functions or restrict the access to certain cells.
352
- Remote access with SOAP is nothing specific to roo, you can do this with every Rub object, but i thought it would nice to give an example what could be done with roo.
353
-
354
- h3. Excel spreadsheets / OpenOffice spreadsheets / Google spreadsheets with Ruby on Rails
355
-
356
- There is a simple helper method to display a spreadsheet at your application page:
357
-
358
- * in your controller, add "require 'roo'" and "@rspreadsheet = OpenOffice.new("numbers1.ods")" or
359
- "@rspreadsheet = OpenOffice.new("http://www.somehost.com/data/numbers1.od s")" to get access to your spreadsheet file
360
- * use it in any view of your application with "&lt;%= spreadsheet @rspreadsheet, ["Tabelle"] %&gt;<br/>" or one of the following formats
361
-
362
- <img src="Roo_Spreadsheets_Rails.png">
363
-
364
- h2. Where is it used?
365
-
366
- How do you use roo? What are you doing with roo?
367
-
368
- * The author of this gem uses roo for the generation of weekly reports which are (automatically) sent to his customers (Thomas Preymesser, Homepage: www.thopre.com, Blog: thopre.wordpress.com, email me: thopre@gmail.com)
369
-
370
-
371
- If you have an interesting application where you use roo then write me a short description of your project and i will publish it here (write, if your email-address should be published or not).
372
-
373
- Or you can write directly in the project wiki at "http://roo.rubyforge.org/wiki/wiki.pl?Who's_Using_Roo":http://roo.rubyforge.org/wiki/wiki.pl?Who's_Using_Roo
374
-
375
-
376
- If you don't want to publish the details you can also write me an email and state, that it should not be published - i am just curious to hear, where it is used.
377
-
378
- h2. Documentation
379
-
380
- "rdoc":rdoc/index.html
381
-
382
- h2. Tests and test data
383
-
384
- There are many test files within the test directory. If you don't want to run unit tests and don't want the test data you can completely delete the 'test' directory within the hierarchy of this gem.
385
-
386
- h2. Feature Requests / Bugs
387
-
388
- Submit Feature Requests and bugs here: "http://rubyforge.org/tracker/?group_id=3729":http://rubyforge.org/tracker/?group_id=3729
389
-
390
- h2. Forum
391
-
392
- International Group:
393
- "http://groups.google.com/group/ruby-roo":http://groups.google.com/group/ruby-roo
394
-
395
- Deutschsprachige Group:
396
- "http://groups.google.com/group/ruby-roo-de":http://groups.google.com/group/ruby-roo-de
397
-
398
- h2. Wiki
399
-
400
- "http://roo.rubyforge.org/wiki/wiki.pl":http://roo.rubyforge.org/wiki/wiki.pl
401
-
402
- h2. How to submit patches
403
-
404
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
405
-
406
- <strike>The trunk repository is <code>svn://rubyforge.org/var/svn/roo/trunk</code> for anonymous access.</strike>
407
-
408
- h2. License
409
-
410
- This code is free to use under the terms of Ruby
411
-
412
- h2. Contact
413
-
414
- Comments are welcome. Send an email to "Thomas Preymesser":mailto:thopre@gmail.com.
415
-
416
- h2. Thanks
417
-
418
- * "Dr Nic Williams":http://rubyforge.org/users/nicwilliams/ for his wonderful gem '"newgem":http://rubyforge.org/projects/newgem/' which makes it very convenient to create, manage and publish Ruby gems
419
- * for the Excel-part the "spreadsheet":http://rubyforge.org/projects/spreadsheet/ gem is used. My functions are a convenient wrapper around the functions of this gem
420
- * Dirk Huth f&uuml;rs Testen unter Windows
421
- * Thanks to davecahill for a bug-fix patch within the google part
422
- * Thanks to Ryan Waldron for a bug-fix patch in Google set_value
423
-