roo 1.13.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.simplecov +4 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +515 -0
- data/Gemfile +16 -10
- data/Guardfile +24 -0
- data/LICENSE +3 -1
- data/README.md +254 -0
- data/Rakefile +23 -23
- data/examples/roo_soap_client.rb +28 -31
- data/examples/roo_soap_server.rb +4 -6
- data/examples/write_me.rb +9 -10
- data/lib/roo/base.rb +334 -395
- data/lib/roo/csv.rb +120 -113
- data/lib/roo/excelx/cell.rb +77 -0
- data/lib/roo/excelx/comments.rb +22 -0
- data/lib/roo/excelx/extractor.rb +22 -0
- data/lib/roo/excelx/relationships.rb +25 -0
- data/lib/roo/excelx/shared_strings.rb +37 -0
- data/lib/roo/excelx/sheet.rb +107 -0
- data/lib/roo/excelx/sheet_doc.rb +200 -0
- data/lib/roo/excelx/styles.rb +64 -0
- data/lib/roo/excelx/workbook.rb +59 -0
- data/lib/roo/excelx.rb +413 -597
- data/lib/roo/font.rb +17 -0
- data/lib/roo/libre_office.rb +5 -0
- data/lib/roo/link.rb +15 -0
- data/lib/roo/{openoffice.rb → open_office.rb} +681 -496
- data/lib/roo/spreadsheet.rb +20 -23
- data/lib/roo/utils.rb +78 -0
- data/lib/roo/version.rb +3 -0
- data/lib/roo.rb +18 -24
- data/roo.gemspec +20 -204
- data/spec/lib/roo/base_spec.rb +1 -4
- data/spec/lib/roo/csv_spec.rb +21 -13
- data/spec/lib/roo/excelx/format_spec.rb +7 -6
- data/spec/lib/roo/excelx_spec.rb +424 -11
- data/spec/lib/roo/libreoffice_spec.rb +16 -6
- data/spec/lib/roo/openoffice_spec.rb +13 -8
- data/spec/lib/roo/spreadsheet_spec.rb +40 -12
- data/spec/lib/roo/utils_spec.rb +106 -0
- data/spec/spec_helper.rb +2 -1
- data/test/test_generic_spreadsheet.rb +117 -139
- data/test/test_helper.rb +9 -56
- data/test/test_roo.rb +274 -478
- metadata +65 -303
- data/CHANGELOG +0 -417
- data/Gemfile.lock +0 -78
- data/README.markdown +0 -126
- data/VERSION +0 -1
- data/lib/roo/excel.rb +0 -355
- data/lib/roo/excel2003xml.rb +0 -300
- data/lib/roo/google.rb +0 -292
- data/lib/roo/roo_rails_helper.rb +0 -83
- data/lib/roo/worksheet.rb +0 -18
- data/scripts/txt2html +0 -67
- data/spec/lib/roo/excel2003xml_spec.rb +0 -15
- data/spec/lib/roo/excel_spec.rb +0 -17
- data/spec/lib/roo/google_spec.rb +0 -64
- data/test/files/1900_base.xls +0 -0
- data/test/files/1900_base.xlsx +0 -0
- data/test/files/1904_base.xls +0 -0
- data/test/files/1904_base.xlsx +0 -0
- data/test/files/Bibelbund.csv +0 -3741
- data/test/files/Bibelbund.ods +0 -0
- data/test/files/Bibelbund.xls +0 -0
- data/test/files/Bibelbund.xlsx +0 -0
- data/test/files/Bibelbund.xml +0 -62518
- data/test/files/Bibelbund1.ods +0 -0
- data/test/files/Pfand_from_windows_phone.xlsx +0 -0
- data/test/files/bad_excel_date.xls +0 -0
- data/test/files/bbu.ods +0 -0
- data/test/files/bbu.xls +0 -0
- data/test/files/bbu.xlsx +0 -0
- data/test/files/bbu.xml +0 -152
- data/test/files/bode-v1.ods.zip +0 -0
- data/test/files/bode-v1.xls.zip +0 -0
- data/test/files/boolean.csv +0 -2
- data/test/files/boolean.ods +0 -0
- data/test/files/boolean.xls +0 -0
- data/test/files/boolean.xlsx +0 -0
- data/test/files/boolean.xml +0 -112
- data/test/files/borders.ods +0 -0
- data/test/files/borders.xls +0 -0
- data/test/files/borders.xlsx +0 -0
- data/test/files/borders.xml +0 -144
- data/test/files/bug-numbered-sheet-names.xlsx +0 -0
- data/test/files/bug-row-column-fixnum-float.xls +0 -0
- data/test/files/bug-row-column-fixnum-float.xml +0 -127
- data/test/files/comments.ods +0 -0
- data/test/files/comments.xls +0 -0
- data/test/files/comments.xlsx +0 -0
- data/test/files/csvtypes.csv +0 -1
- data/test/files/datetime.ods +0 -0
- data/test/files/datetime.xls +0 -0
- data/test/files/datetime.xlsx +0 -0
- data/test/files/datetime.xml +0 -142
- data/test/files/datetime_floatconv.xls +0 -0
- data/test/files/datetime_floatconv.xml +0 -148
- data/test/files/dreimalvier.ods +0 -0
- data/test/files/emptysheets.ods +0 -0
- data/test/files/emptysheets.xls +0 -0
- data/test/files/emptysheets.xlsx +0 -0
- data/test/files/emptysheets.xml +0 -105
- data/test/files/excel2003.xml +0 -21140
- data/test/files/false_encoding.xls +0 -0
- data/test/files/false_encoding.xml +0 -132
- data/test/files/file_item_error.xlsx +0 -0
- data/test/files/formula.ods +0 -0
- data/test/files/formula.xls +0 -0
- data/test/files/formula.xlsx +0 -0
- data/test/files/formula.xml +0 -134
- data/test/files/formula_parse_error.xls +0 -0
- data/test/files/formula_parse_error.xml +0 -1833
- data/test/files/formula_string_error.xlsx +0 -0
- data/test/files/html-escape.ods +0 -0
- data/test/files/link.xls +0 -0
- data/test/files/link.xlsx +0 -0
- data/test/files/matrix.ods +0 -0
- data/test/files/matrix.xls +0 -0
- data/test/files/named_cells.ods +0 -0
- data/test/files/named_cells.xls +0 -0
- data/test/files/named_cells.xlsx +0 -0
- data/test/files/no_spreadsheet_file.txt +0 -1
- data/test/files/numbers1.csv +0 -18
- data/test/files/numbers1.ods +0 -0
- data/test/files/numbers1.xls +0 -0
- data/test/files/numbers1.xlsx +0 -0
- data/test/files/numbers1.xml +0 -312
- data/test/files/numeric-link.xlsx +0 -0
- data/test/files/only_one_sheet.ods +0 -0
- data/test/files/only_one_sheet.xls +0 -0
- data/test/files/only_one_sheet.xlsx +0 -0
- data/test/files/only_one_sheet.xml +0 -67
- data/test/files/paragraph.ods +0 -0
- data/test/files/paragraph.xls +0 -0
- data/test/files/paragraph.xlsx +0 -0
- data/test/files/paragraph.xml +0 -127
- data/test/files/prova.xls +0 -0
- data/test/files/ric.ods +0 -0
- data/test/files/simple_spreadsheet.ods +0 -0
- data/test/files/simple_spreadsheet.xls +0 -0
- data/test/files/simple_spreadsheet.xlsx +0 -0
- data/test/files/simple_spreadsheet.xml +0 -225
- data/test/files/simple_spreadsheet_from_italo.ods +0 -0
- data/test/files/simple_spreadsheet_from_italo.xls +0 -0
- data/test/files/simple_spreadsheet_from_italo.xml +0 -242
- data/test/files/so_datetime.csv +0 -7
- data/test/files/style.ods +0 -0
- data/test/files/style.xls +0 -0
- data/test/files/style.xlsx +0 -0
- data/test/files/style.xml +0 -154
- data/test/files/time-test.csv +0 -2
- data/test/files/time-test.ods +0 -0
- data/test/files/time-test.xls +0 -0
- data/test/files/time-test.xlsx +0 -0
- data/test/files/time-test.xml +0 -131
- data/test/files/type_excel.ods +0 -0
- data/test/files/type_excel.xlsx +0 -0
- data/test/files/type_excelx.ods +0 -0
- data/test/files/type_excelx.xls +0 -0
- data/test/files/type_openoffice.xls +0 -0
- data/test/files/type_openoffice.xlsx +0 -0
- data/test/files/whitespace.ods +0 -0
- data/test/files/whitespace.xls +0 -0
- data/test/files/whitespace.xlsx +0 -0
- data/test/files/whitespace.xml +0 -184
- data/test/rm_sub_test.rb +0 -12
- data/test/rm_test.rb +0 -7
- data/website/index.html +0 -385
- data/website/index.txt +0 -423
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -130
- 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 "<%= spreadsheet @rspreadsheet, ["Tabelle"] %><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ü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
|
-
|