roo 1.13.2 → 2.0.0

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