roo 0.8.5 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +1 -0
- data/README.txt +25 -1
- data/Rakefile +15 -0
- data/lib/roo.rb +1 -0
- data/lib/roo/excel.rb +0 -20
- data/lib/roo/generic_spreadsheet.rb +35 -28
- data/lib/roo/google.rb +8 -37
- data/lib/roo/openoffice.rb +0 -13
- data/lib/roo/roo_rails_helper.rb +81 -0
- data/lib/roo/version.rb +2 -2
- data/test/test_roo.rb +30 -16
- data/website/index.html +10 -11
- data/website/index.txt +6 -7
- metadata +3 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
README for roo
|
2
2
|
==============
|
3
3
|
|
4
|
-
|
4
|
+
Installation:
|
5
|
+
|
6
|
+
sudo gem install roo
|
7
|
+
|
8
|
+
Usage:
|
9
|
+
|
10
|
+
require 'roo'
|
11
|
+
|
12
|
+
sob = Openoffice("myspreadsheet.ods") # creates an Openoffice Spreadsheet instance
|
13
|
+
sob = Excel("myspreadsheet.xls") # creates an Excel Spreadsheet instance
|
14
|
+
sob = Google("myspreadsheetkey_at_google") # creates an Google Spreadsheet instance
|
15
|
+
|
16
|
+
sob.default_sheet = sob.sheets.first # first sheet in the spreadsheet file will be used
|
17
|
+
sob.cell(1,1) # returns the content of the first row/first cell in the sheet
|
18
|
+
sob.cell('A',1) # same cell
|
19
|
+
|
20
|
+
sob.info # prints infos about the spreadsheet file
|
21
|
+
|
22
|
+
sob.first_row # the number of the first row
|
23
|
+
sob.last_row # the number of the last row
|
24
|
+
sob.first_column # the number of the first column
|
25
|
+
sob.last_column # the number of the last column
|
26
|
+
|
27
|
+
|
28
|
+
see http://roo.rubyforge.org for a more complete tutorial
|
5
29
|
|
data/Rakefile
CHANGED
@@ -139,4 +139,19 @@ task :check_version do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
+
task 'stats' do
|
143
|
+
require '/home/tp/ruby-test/scriptlines'
|
144
|
+
files = FileList['lib/**/*.rb']
|
145
|
+
puts ScriptLines.headline
|
146
|
+
sum = ScriptLines.new("TOTAL (#{files.size} file(s))")
|
147
|
+
files.each do |fn|
|
148
|
+
File.open(fn) do |file|
|
149
|
+
script_lines = ScriptLines.new(fn)
|
150
|
+
script_lines.read(file)
|
151
|
+
sum += script_lines
|
152
|
+
puts script_lines
|
153
|
+
end
|
154
|
+
end
|
142
155
|
|
156
|
+
puts sum
|
157
|
+
end
|
data/lib/roo.rb
CHANGED
data/lib/roo/excel.rb
CHANGED
@@ -95,21 +95,6 @@ class Excel < GenericSpreadsheet
|
|
95
95
|
new_str
|
96
96
|
end
|
97
97
|
|
98
|
-
# sets the working sheet (1,2,3,..)
|
99
|
-
def default_sheet=(n)
|
100
|
-
if n.kind_of?(Fixnum)
|
101
|
-
#
|
102
|
-
elsif n.kind_of?(String)
|
103
|
-
raise RangeError if ! self.sheets.include?(n)
|
104
|
-
# parseexcel supports now the name of a sheet
|
105
|
-
else
|
106
|
-
raise TypeError, "what are you trying to set as default sheet?"
|
107
|
-
end
|
108
|
-
@default_sheet = n
|
109
|
-
@first_row[n] = @last_row[n] = @first_column[n] = @last_column[n] = nil
|
110
|
-
@cells_read[n] = false
|
111
|
-
end
|
112
|
-
|
113
98
|
# returns the content of a cell. The upper left corner is (1,1) or ('A',1)
|
114
99
|
def cell(row,col,sheet=nil)
|
115
100
|
sheet = @default_sheet unless sheet
|
@@ -268,11 +253,6 @@ class Excel < GenericSpreadsheet
|
|
268
253
|
|
269
254
|
private
|
270
255
|
|
271
|
-
# check if default_sheet was set
|
272
|
-
def default_sheet_check
|
273
|
-
raise ArgumentError, "Error: default_sheet not set" if @default_sheet == nil
|
274
|
-
end
|
275
|
-
|
276
256
|
# determine the first and last boundaries
|
277
257
|
def get_firsts_lasts(sheet=nil)
|
278
258
|
sheet = @default_sheet unless sheet
|
@@ -6,6 +6,25 @@ class GenericSpreadsheet
|
|
6
6
|
# sets the line with attribute names (default: 1)
|
7
7
|
attr_accessor :header_line
|
8
8
|
|
9
|
+
# set the working sheet in the document
|
10
|
+
def default_sheet=(sheet)
|
11
|
+
if sheet.kind_of? Fixnum
|
12
|
+
if sheet >= 0 and sheet <= sheets.length
|
13
|
+
sheet = self.sheets[sheet-1]
|
14
|
+
else
|
15
|
+
raise RangeError
|
16
|
+
end
|
17
|
+
elsif sheet.kind_of?(String)
|
18
|
+
raise RangeError if ! self.sheets.include?(sheet)
|
19
|
+
else
|
20
|
+
raise TypeError, "what are you trying to set as default sheet?"
|
21
|
+
end
|
22
|
+
@default_sheet = sheet
|
23
|
+
check_default_sheet
|
24
|
+
@first_row[sheet] = @last_row[sheet] = @first_column[sheet] = @last_column[sheet] = nil
|
25
|
+
@cells_read[sheet] = false
|
26
|
+
end
|
27
|
+
|
9
28
|
# converts cell coordinate to numeric values of row,col
|
10
29
|
def normalize(row,col)
|
11
30
|
if row.class == String
|
@@ -71,25 +90,14 @@ class GenericSpreadsheet
|
|
71
90
|
self.default_sheet = sheet
|
72
91
|
# $log.debug("nach default_sheet=")
|
73
92
|
result << "Sheet " + n.to_s + ":\n"
|
74
|
-
|
93
|
+
unless first_row
|
75
94
|
result << " - empty -"
|
76
|
-
|
77
|
-
if first_row
|
95
|
+
else
|
78
96
|
result << " First row: #{first_row}\n"
|
79
|
-
end
|
80
|
-
# $log.debug("nach first_row")
|
81
|
-
if last_row
|
82
97
|
result << " Last row: #{last_row}\n"
|
83
|
-
end
|
84
|
-
# $log.debug("nach last_row")
|
85
|
-
if first_column
|
86
98
|
result << " First column: #{GenericSpreadsheet.number_to_letter(first_column)}\n"
|
87
|
-
end
|
88
|
-
# $log.debug("nach first_column")
|
89
|
-
if last_column
|
90
99
|
result << " Last column: #{GenericSpreadsheet.number_to_letter(last_column)}"
|
91
100
|
end
|
92
|
-
# $log.debug("nach last_column")
|
93
101
|
result << "\n" if sheet != sheets.last
|
94
102
|
n += 1
|
95
103
|
}
|
@@ -248,7 +256,7 @@ class GenericSpreadsheet
|
|
248
256
|
end
|
249
257
|
|
250
258
|
# convert letters like 'AB' to a number
|
251
|
-
def
|
259
|
+
def self.letter_to_number(letters)
|
252
260
|
result = 0
|
253
261
|
while letters && letters.length > 0
|
254
262
|
character = letters[0,1].upcase
|
@@ -363,26 +371,25 @@ class GenericSpreadsheet
|
|
363
371
|
ret
|
364
372
|
end
|
365
373
|
|
366
|
-
# helper method
|
367
|
-
def after(d)
|
368
|
-
if DateTime.now > d
|
369
|
-
yield
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
# helper method
|
374
|
-
def before(d)
|
375
|
-
if DateTime.now <= d
|
376
|
-
yield
|
377
|
-
end
|
378
|
-
end
|
379
|
-
|
380
374
|
private
|
381
375
|
|
382
376
|
def initialize
|
383
377
|
|
384
378
|
end
|
385
379
|
|
380
|
+
# check if default_sheet was set and exists in sheets-array
|
381
|
+
def check_default_sheet
|
382
|
+
sheet_found = false
|
383
|
+
raise ArgumentError, "Error: default_sheet not set" if @default_sheet == nil
|
384
|
+
if sheets.index(@default_sheet)
|
385
|
+
sheet_found = true
|
386
|
+
end
|
387
|
+
if ! sheet_found
|
388
|
+
raise RangeError, "sheet '#{@default_sheet}' not found"
|
389
|
+
end
|
390
|
+
#raise ArgumentError, "Error: default_sheet not set" if @default_sheet == nil
|
391
|
+
end
|
392
|
+
|
386
393
|
def process_zipfile_packed(zip, path='')
|
387
394
|
ret=nil
|
388
395
|
if zip.file.file? path
|
data/lib/roo/google.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'rubygems' #TODO:
|
1
|
+
#require 'rubygems' #TODO:
|
2
2
|
require 'gdata/spreadsheet'
|
3
3
|
#require 'log4r'
|
4
4
|
|
@@ -26,13 +26,6 @@ module GData
|
|
26
26
|
result
|
27
27
|
end
|
28
28
|
|
29
|
-
# #-- new (testing only)
|
30
|
-
# def raw_url(url)
|
31
|
-
# path = "/feeds/worksheets/#{@spreadsheet_id}/private/basic"
|
32
|
-
# path = url
|
33
|
-
# doc = Hpricot(request(path))
|
34
|
-
# end
|
35
|
-
|
36
29
|
#-- new
|
37
30
|
def save_entry_roo(entry)
|
38
31
|
path = "/feeds/cells/#{@spreadsheet_id}/1/#{@headers ? 'private' : 'public'}/full"
|
@@ -127,19 +120,6 @@ class Google < GenericSpreadsheet
|
|
127
120
|
return @gs.sheetlist
|
128
121
|
end
|
129
122
|
|
130
|
-
# set the working sheet in the document
|
131
|
-
#--
|
132
|
-
# TODO: eigenlich identisch mit Openoffice => refactoring
|
133
|
-
def default_sheet=(sheet)
|
134
|
-
if ! sheet.kind_of?(String)
|
135
|
-
raise TypeError, "what are you trying to set as default sheet?"
|
136
|
-
end
|
137
|
-
@default_sheet = sheet
|
138
|
-
check_default_sheet
|
139
|
-
@first_row[sheet] = @last_row[sheet] = @first_column[sheet] = @last_column[sheet] = nil
|
140
|
-
#--TODO: @cells_read[sheet] = false
|
141
|
-
end
|
142
|
-
|
143
123
|
# is String a date with format DD/MM/YYYY
|
144
124
|
def Google.date?(string)
|
145
125
|
return false if string.class == Float
|
@@ -164,11 +144,15 @@ class Google < GenericSpreadsheet
|
|
164
144
|
# $log.debug(mm)
|
165
145
|
# $log.debug(dd)
|
166
146
|
#TODO:
|
167
|
-
if dd.to_i < 1 or dd.to_i >31 or mm.to_i < 1 or mm.to_i > 12 or yyyy.to_i < 1900 or yyyy.to_i > 3000
|
147
|
+
#if dd.to_i < 1 or dd.to_i >31 or mm.to_i < 1 or mm.to_i > 12 or yyyy.to_i < 1900 or yyyy.to_i > 3000
|
148
|
+
# raise "Invalid date parameter: #{yyyy}, #{mm}, #{dd}"
|
149
|
+
#end
|
150
|
+
begin
|
151
|
+
return Date.new(yyyy.to_i,mm.to_i,dd.to_i)
|
152
|
+
rescue ArgumentError
|
168
153
|
raise "Invalid date parameter: #{yyyy}, #{mm}, #{dd}"
|
169
154
|
end
|
170
|
-
|
171
|
-
end
|
155
|
+
end # celltype date
|
172
156
|
return @cell[sheet]["#{row},#{col}"]
|
173
157
|
end
|
174
158
|
|
@@ -459,19 +443,6 @@ class Google < GenericSpreadsheet
|
|
459
443
|
@cells_read[sheet] = true
|
460
444
|
end
|
461
445
|
|
462
|
-
# Checks if the default_sheet exists. Otherwise a RangeError exception is
|
463
|
-
# raised
|
464
|
-
def check_default_sheet
|
465
|
-
sheet_found = false
|
466
|
-
raise ArgumentError, "Error: default_sheet not set" if @default_sheet == nil
|
467
|
-
if sheets.index(@default_sheet)
|
468
|
-
sheet_found = true
|
469
|
-
end
|
470
|
-
if ! sheet_found
|
471
|
-
raise RangeError, "sheet '#{@default_sheet}' not found"
|
472
|
-
end
|
473
|
-
end
|
474
|
-
|
475
446
|
def numeric?(string)
|
476
447
|
string =~ /^[0-9]+[\.]*[0-9]*$/
|
477
448
|
end
|
data/lib/roo/openoffice.rb
CHANGED
@@ -163,19 +163,6 @@ class Openoffice < GenericSpreadsheet
|
|
163
163
|
return_sheets
|
164
164
|
end
|
165
165
|
|
166
|
-
# set the working sheet in the document
|
167
|
-
def default_sheet=(sheet)
|
168
|
-
if ! sheet.kind_of?(String)
|
169
|
-
raise TypeError, "what are you trying to set as default sheet?"
|
170
|
-
end
|
171
|
-
@default_sheet = sheet
|
172
|
-
check_default_sheet
|
173
|
-
@first_row[sheet] = @last_row[sheet] = @first_column[sheet] = @last_column[sheet] = nil
|
174
|
-
@cells_read[sheet] = false
|
175
|
-
end
|
176
|
-
|
177
|
-
alias set_default_sheet default_sheet=
|
178
|
-
|
179
166
|
# version of the openoffice document
|
180
167
|
# at 2007 this is always "1.0"
|
181
168
|
def officeversion
|
@@ -0,0 +1,81 @@
|
|
1
|
+
def spreadsheet(spreadsheet, sheets, options={})
|
2
|
+
coordinates = true # default
|
3
|
+
o=""
|
4
|
+
if options[:coordinates] != nil
|
5
|
+
o << ":coordinates uebergeben: #{options[:coordinates]}"
|
6
|
+
coordinates = options[:coordinates]
|
7
|
+
end
|
8
|
+
if options[:bgcolor]
|
9
|
+
bgcolor = options[:bgcolor]
|
10
|
+
else
|
11
|
+
bgcolor = false
|
12
|
+
end
|
13
|
+
|
14
|
+
sheets.each { |sheet|
|
15
|
+
@rspreadsheet.default_sheet = sheet
|
16
|
+
linenumber = @rspreadsheet.first_row(sheet)
|
17
|
+
if options[:first_row]
|
18
|
+
linenumber += (options[:first_row]-1)
|
19
|
+
end
|
20
|
+
o << '<table border="0" cellspacing="1" cellpadding="1">'
|
21
|
+
if options[:first_row]
|
22
|
+
first_row = options[:first_row]
|
23
|
+
end
|
24
|
+
if options[:last_row]
|
25
|
+
last_row = options[:last_row]
|
26
|
+
end
|
27
|
+
if options[:first_column]
|
28
|
+
first_column = options[:first_column]
|
29
|
+
end
|
30
|
+
if options[:last_column]
|
31
|
+
last_column = options[:last_column]
|
32
|
+
end
|
33
|
+
first_row = @rspreadsheet.first_row(sheet) unless first_row
|
34
|
+
last_row = @rspreadsheet.last_row(sheet) unless last_row
|
35
|
+
first_column = @rspreadsheet.first_column(sheet) unless first_column
|
36
|
+
last_column = @rspreadsheet.last_column(sheet) unless last_column
|
37
|
+
if coordinates
|
38
|
+
o << " <tr>"
|
39
|
+
o << " <td> </td>"
|
40
|
+
@rspreadsheet.first_column(sheet).upto(@rspreadsheet.last_column(sheet)) {|c|
|
41
|
+
if c < first_column or c > last_column
|
42
|
+
next
|
43
|
+
end
|
44
|
+
o << " <td>"
|
45
|
+
o << " <b>#{GenericSpreadsheet.number_to_letter(c)}</b>"
|
46
|
+
o << " </td>"
|
47
|
+
}
|
48
|
+
o << "</tr>"
|
49
|
+
end
|
50
|
+
@rspreadsheet.first_row.upto(@rspreadsheet.last_row) do |y|
|
51
|
+
if first_row and (y < first_row or y > last_row)
|
52
|
+
next
|
53
|
+
end
|
54
|
+
o << "<tr>"
|
55
|
+
if coordinates
|
56
|
+
o << "<td><b>#{linenumber.to_s}</b></td>"
|
57
|
+
end
|
58
|
+
linenumber += 1
|
59
|
+
@rspreadsheet.first_column(sheet).upto(@rspreadsheet.last_column(sheet)) do |x|
|
60
|
+
if x < first_column or x > last_column
|
61
|
+
next
|
62
|
+
end
|
63
|
+
if bgcolor
|
64
|
+
o << "<td bgcolor=\"#{bgcolor}\">"
|
65
|
+
else
|
66
|
+
o << '<td bgcolor="lightgreen">'
|
67
|
+
end
|
68
|
+
if @rspreadsheet.cell(y,x).to_s.empty?
|
69
|
+
o << " "
|
70
|
+
else
|
71
|
+
o << "#{@rspreadsheet.cell(y,x)}"
|
72
|
+
end
|
73
|
+
o << "</td>"
|
74
|
+
end
|
75
|
+
o << "</tr>"
|
76
|
+
end
|
77
|
+
o << "</table>"
|
78
|
+
} # each sheet
|
79
|
+
return o
|
80
|
+
end
|
81
|
+
|
data/lib/roo/version.rb
CHANGED
data/test/test_roo.rb
CHANGED
@@ -116,7 +116,7 @@ class TestRoo < Test::Unit::TestCase
|
|
116
116
|
|
117
117
|
OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
|
118
118
|
EXCEL = true # do Excel Tests?
|
119
|
-
GOOGLE =
|
119
|
+
GOOGLE = true # do Google-Spreadsheet Tests?
|
120
120
|
|
121
121
|
OPENOFFICEWRITE = false # experimental: write access with OO-Documents
|
122
122
|
ONLINE = false
|
@@ -1093,7 +1093,9 @@ class TestRoo < Test::Unit::TestCase
|
|
1093
1093
|
assert_equal :formula, oo.celltype('A',7)
|
1094
1094
|
# assert_equal "=[Sheet2.A1]", oo.formula('C',7)
|
1095
1095
|
# !!! different from formulas in Openoffice
|
1096
|
-
assert_equal "=sheet2!R[-6]C[-2]", oo.formula('C',7)
|
1096
|
+
#was: assert_equal "=sheet2!R[-6]C[-2]", oo.formula('C',7)
|
1097
|
+
# has Google changed their format of formulas/references to other sheets?
|
1098
|
+
assert_equal "=Sheet2!R[-6]C[-2]", oo.formula('C',7)
|
1097
1099
|
assert_nil oo.formula('A',6)
|
1098
1100
|
# assert_equal [[7, 1, "=SUM([.A1:.A6])"],
|
1099
1101
|
# [7, 2, "=SUM([.$A$1:.B6])"],
|
@@ -1101,10 +1103,16 @@ class TestRoo < Test::Unit::TestCase
|
|
1101
1103
|
# [8, 2, "=SUM([.$A$1:.B7])"],
|
1102
1104
|
# ], oo.formulas(oo.sheets.first)
|
1103
1105
|
# different format than in openoffice spreadsheets:
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1106
|
+
#was:
|
1107
|
+
# assert_equal [[7, 1, "=SUM(R[-6]C[0]:R[-1]C[0])"],
|
1108
|
+
# [7, 2, "=SUM(R1C1:R[-1]C[0])"],
|
1109
|
+
# [7, 3, "=sheet2!R[-6]C[-2]"],
|
1110
|
+
# [8, 2, "=SUM(R1C1:R[-1]C[0])"]],
|
1111
|
+
# oo.formulas(oo.sheets.first)
|
1112
|
+
assert_equal [[7, 1, "=SUM(R[-6]C:R[-1]C)"],
|
1113
|
+
[7, 2, "=SUM(R1C1:R[-1]C)"],
|
1114
|
+
[7, 3, "=Sheet2!R[-6]C[-2]"],
|
1115
|
+
[8, 2, "=SUM(R1C1:R[-1]C)"]],
|
1108
1116
|
oo.formulas(oo.sheets.first)
|
1109
1117
|
end # GOOGLE
|
1110
1118
|
end
|
@@ -1911,9 +1919,12 @@ class TestRoo < Test::Unit::TestCase
|
|
1911
1919
|
oo.default_sheet = oo.sheets.first
|
1912
1920
|
rec = oo.find 16
|
1913
1921
|
assert rec
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1922
|
+
oo.header_line = nil
|
1923
|
+
assert_nil oo.header_line
|
1924
|
+
# keine Headerlines in diesem Beispiel definiert
|
1925
|
+
after Date.new(2008,1,31) do
|
1926
|
+
assert_equal "einundvierzig", rec[0]
|
1927
|
+
#assert_equal false, rec
|
1917
1928
|
|
1918
1929
|
rec = oo.find 15
|
1919
1930
|
assert rec
|
@@ -1928,7 +1939,8 @@ class TestRoo < Test::Unit::TestCase
|
|
1928
1939
|
oo.default_sheet = oo.sheets.first
|
1929
1940
|
rec = oo.find 16
|
1930
1941
|
assert rec
|
1931
|
-
|
1942
|
+
# keine Headerlines in diesem Beispiel definiert
|
1943
|
+
after Date.new(2008,1,31) do
|
1932
1944
|
assert_equal "einundvierzig", rec[0]
|
1933
1945
|
|
1934
1946
|
rec = oo.find 15
|
@@ -1940,11 +1952,12 @@ class TestRoo < Test::Unit::TestCase
|
|
1940
1952
|
|
1941
1953
|
def test_find_by_row_google
|
1942
1954
|
if GOOGLE
|
1943
|
-
oo =
|
1955
|
+
oo = Google.new(key_of("numbers1"))
|
1944
1956
|
oo.default_sheet = oo.sheets.first
|
1945
1957
|
rec = oo.find 16
|
1946
1958
|
assert rec
|
1947
|
-
|
1959
|
+
# keine Headerlines in diesem Beispiel definiert
|
1960
|
+
after Date.new(2008,1,31) do
|
1948
1961
|
assert_equal "einundvierzig", rec[0]
|
1949
1962
|
|
1950
1963
|
rec = oo.find 15
|
@@ -2507,10 +2520,11 @@ class TestRoo < Test::Unit::TestCase
|
|
2507
2520
|
}
|
2508
2521
|
end
|
2509
2522
|
if GOOGLE
|
2510
|
-
after Date.new(2008,1,
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2523
|
+
after Date.new(2008,1,31) do
|
2524
|
+
assert_raise(IOError) {
|
2525
|
+
# oo = Google.new(key_of('testnichtvorhanden'+'Bibelbund.ods'))
|
2526
|
+
oo = Google.new('testnichtvorhanden')
|
2527
|
+
}
|
2514
2528
|
end
|
2515
2529
|
end
|
2516
2530
|
end
|
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.
|
36
|
+
<a href="http://rubyforge.org/projects/roo" class="numbers">0.9.0</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
@@ -378,23 +378,22 @@ provide a better solution in the next releases.</p>
|
|
378
378
|
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>
|
379
379
|
|
380
380
|
|
381
|
-
<h3>
|
381
|
+
<h3>Excel spreadsheets / Openoffice spreadsheets / Google spreadsheets with Ruby on Rails</h3>
|
382
382
|
|
383
383
|
|
384
|
-
<p>
|
385
|
-
|
386
|
-
|
387
|
-
<p>To display this example:</p>
|
384
|
+
<p>There is a simple helper method to display a spreadsheet at your application page:</p>
|
388
385
|
|
389
386
|
|
390
387
|
<ul>
|
391
|
-
<li>
|
392
|
-
|
393
|
-
<li>
|
394
|
-
<li>point your browser to http://localhost:3000/spreadsheet/</li>
|
388
|
+
<li>in your controller, add “require ‘roo’” and ”@rspreadsheet = Openoffice.new(“numbers1.ods”)” or
|
389
|
+
”@rspreadsheet = Openoffice.new(“http://www.somehost.com/data/numbers1.od s”)” to get access to your spreadsheet file</li>
|
390
|
+
<li>use it in any view of your application with ”<%= spreadsheet @rspreadsheet, [“Tabelle”] %><br/>” or one of the following formats</li>
|
395
391
|
</ul>
|
396
392
|
|
397
393
|
|
394
|
+
<p><img src="Roo_Spreadsheets_Rails.png"></p>
|
395
|
+
|
396
|
+
|
398
397
|
<h2>Where is it used?</h2>
|
399
398
|
|
400
399
|
|
@@ -483,7 +482,7 @@ The trunk repository is <code>svn://rubyforge.org/var/svn/gorank/trunk</code> fo
|
|
483
482
|
<li>Dirk Huth fürs Testen unter Windows</li>
|
484
483
|
</ul>
|
485
484
|
<p class="coda">
|
486
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
485
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 24th January 2008<br>
|
487
486
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
488
487
|
</p>
|
489
488
|
</div>
|
data/website/index.txt
CHANGED
@@ -259,16 +259,15 @@ h3. Remote Access
|
|
259
259
|
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.
|
260
260
|
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.
|
261
261
|
|
262
|
-
h3.
|
262
|
+
h3. Excel spreadsheets / Openoffice spreadsheets / Google spreadsheets with Ruby on Rails
|
263
263
|
|
264
|
-
|
264
|
+
There is a simple helper method to display a spreadsheet at your application page:
|
265
265
|
|
266
|
-
|
266
|
+
* in your controller, add "require 'roo'" and "@rspreadsheet = Openoffice.new("numbers1.ods")" or
|
267
|
+
"@rspreadsheet = Openoffice.new("http://www.somehost.com/data/numbers1.od s")" to get access to your spreadsheet file
|
268
|
+
* use it in any view of your application with "<%= spreadsheet @rspreadsheet, ["Tabelle"] %><br/>" or one of the following formats
|
267
269
|
|
268
|
-
|
269
|
-
* cd roorails
|
270
|
-
* ruby script/server
|
271
|
-
* point your browser to http://localhost:3000/spreadsheet/
|
270
|
+
<img src="Roo_Spreadsheets_Rails.png">
|
272
271
|
|
273
272
|
h2. Where is it used?
|
274
273
|
|
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.
|
4
|
+
version: 0.9.0
|
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-01-
|
12
|
+
date: 2008-01-24 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/roo/openoffice.rb
|
77
77
|
- lib/roo/excel.rb
|
78
78
|
- lib/roo/google.rb
|
79
|
+
- lib/roo/roo_rails_helper.rb
|
79
80
|
- scripts/txt2html
|
80
81
|
- setup.rb
|
81
82
|
- test/false_encoding.xls
|