roo 1.3.11 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -6
- data/Manifest.txt +53 -0
- data/README.txt +97 -0
- data/Rakefile +45 -0
- data/bin/roo +8 -0
- data/lib/roo.rb +55 -9
- data/lib/roo/excel.rb +44 -40
- data/lib/roo/excelx.rb +99 -60
- data/lib/roo/generic_spreadsheet.rb +29 -1
- data/lib/roo/google.rb +71 -117
- data/lib/roo/openoffice.rb +79 -27
- data/lib/roo/version.rb +9 -9
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +34 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +292 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/tasks/zentest.rake +36 -0
- data/test/1900_base.xls +0 -0
- data/test/1904_base.xls +0 -0
- data/test/Bibelbund.csv +0 -0
- data/test/bode-v1.ods.zip +0 -0
- data/test/bode-v1.xls.zip +0 -0
- data/test/boolean.xls +0 -0
- data/test/datetime.xls +0 -0
- data/test/named_cells.ods +0 -0
- data/test/numbers1.csv +0 -0
- data/test/{bad_excel_date.xls → prova.xls} +0 -0
- data/test/test_helper.rb +1 -1
- data/test/test_roo.rb +365 -256
- data/test/whitespace.xls +0 -0
- metadata +48 -30
- data/README.markdown +0 -55
- data/examples/roo_soap_client.rb +0 -53
- data/examples/roo_soap_server.rb +0 -29
- data/examples/write_me.rb +0 -33
- data/test/formula_parse_error.xls +0 -0
- data/test/skipped_tests.rb +0 -789
data/test/whitespace.xls
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Hugh McGowan
|
8
7
|
- Thomas Preymesser
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
11
|
|
13
|
-
date: 2009-
|
12
|
+
date: 2009-10-29 00:00:00 +01:00
|
14
13
|
default_executable:
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
@@ -19,60 +18,73 @@ dependencies:
|
|
19
18
|
version_requirement:
|
20
19
|
version_requirements: !ruby/object:Gem::Requirement
|
21
20
|
requirements:
|
22
|
-
- - "
|
21
|
+
- - ">"
|
23
22
|
- !ruby/object:Gem::Version
|
24
23
|
version: 0.6.4
|
25
24
|
version:
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
26
|
+
name: nokogiri
|
28
27
|
type: :runtime
|
29
28
|
version_requirement:
|
30
29
|
version_requirements: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
33
|
+
version: 0.0.1
|
35
34
|
version:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
36
|
+
name: builder
|
38
37
|
type: :runtime
|
39
38
|
version_requirement:
|
40
39
|
version_requirements: !ruby/object:Gem::Requirement
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
43
|
+
version: 2.1.2
|
45
44
|
version:
|
46
45
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
46
|
+
name: gimite-google-spreadsheet-ruby
|
48
47
|
type: :runtime
|
49
48
|
version_requirement:
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - ">="
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
53
|
+
version: 0.0.5
|
55
54
|
version:
|
56
55
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
58
|
-
type: :
|
56
|
+
name: bones
|
57
|
+
type: :development
|
59
58
|
version_requirement:
|
60
59
|
version_requirements: !ruby/object:Gem::Requirement
|
61
60
|
requirements:
|
62
61
|
- - ">="
|
63
62
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
63
|
+
version: 2.5.1
|
65
64
|
version:
|
66
|
-
description:
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
description: |-
|
66
|
+
Roo can access the contents of various spreadsheet files. It can handle
|
67
|
+
* Openoffice
|
68
|
+
* Excel
|
69
|
+
* Google spreadsheets
|
70
|
+
* Excelx
|
71
|
+
email: thopre@gmail.com
|
72
|
+
executables:
|
73
|
+
- roo
|
70
74
|
extensions: []
|
71
75
|
|
72
76
|
extra_rdoc_files:
|
73
77
|
- History.txt
|
74
|
-
-
|
78
|
+
- Manifest.txt
|
79
|
+
- README.txt
|
80
|
+
- bin/roo
|
81
|
+
- test/no_spreadsheet_file.txt
|
75
82
|
files:
|
83
|
+
- History.txt
|
84
|
+
- Manifest.txt
|
85
|
+
- README.txt
|
86
|
+
- Rakefile
|
87
|
+
- bin/roo
|
76
88
|
- lib/roo.rb
|
77
89
|
- lib/roo/excel.rb
|
78
90
|
- lib/roo/excelx.rb
|
@@ -81,6 +93,19 @@ files:
|
|
81
93
|
- lib/roo/openoffice.rb
|
82
94
|
- lib/roo/roo_rails_helper.rb
|
83
95
|
- lib/roo/version.rb
|
96
|
+
- tasks/ann.rake
|
97
|
+
- tasks/bones.rake
|
98
|
+
- tasks/gem.rake
|
99
|
+
- tasks/git.rake
|
100
|
+
- tasks/notes.rake
|
101
|
+
- tasks/post_load.rake
|
102
|
+
- tasks/rdoc.rake
|
103
|
+
- tasks/rubyforge.rake
|
104
|
+
- tasks/setup.rb
|
105
|
+
- tasks/spec.rake
|
106
|
+
- tasks/svn.rake
|
107
|
+
- tasks/test.rake
|
108
|
+
- tasks/zentest.rake
|
84
109
|
- test/1900_base.xls
|
85
110
|
- test/1904_base.xls
|
86
111
|
- test/Bibelbund.csv
|
@@ -88,7 +113,6 @@ files:
|
|
88
113
|
- test/Bibelbund.xls
|
89
114
|
- test/Bibelbund.xlsx
|
90
115
|
- test/Bibelbund1.ods
|
91
|
-
- test/bad_excel_date.xls
|
92
116
|
- test/bbu.ods
|
93
117
|
- test/bbu.xls
|
94
118
|
- test/bbu.xlsx
|
@@ -111,8 +135,8 @@ files:
|
|
111
135
|
- test/formula.ods
|
112
136
|
- test/formula.xls
|
113
137
|
- test/formula.xlsx
|
114
|
-
- test/formula_parse_error.xls
|
115
138
|
- test/html-escape.ods
|
139
|
+
- test/named_cells.ods
|
116
140
|
- test/no_spreadsheet_file.txt
|
117
141
|
- test/numbers1.csv
|
118
142
|
- test/numbers1.ods
|
@@ -124,13 +148,13 @@ files:
|
|
124
148
|
- test/paragraph.ods
|
125
149
|
- test/paragraph.xls
|
126
150
|
- test/paragraph.xlsx
|
151
|
+
- test/prova.xls
|
127
152
|
- test/ric.ods
|
128
153
|
- test/simple_spreadsheet.ods
|
129
154
|
- test/simple_spreadsheet.xls
|
130
155
|
- test/simple_spreadsheet.xlsx
|
131
156
|
- test/simple_spreadsheet_from_italo.ods
|
132
157
|
- test/simple_spreadsheet_from_italo.xls
|
133
|
-
- test/skipped_tests.rb
|
134
158
|
- test/style.ods
|
135
159
|
- test/style.xls
|
136
160
|
- test/style.xlsx
|
@@ -143,16 +167,14 @@ files:
|
|
143
167
|
- test/whitespace.ods
|
144
168
|
- test/whitespace.xls
|
145
169
|
- test/whitespace.xlsx
|
146
|
-
- History.txt
|
147
|
-
- README.markdown
|
148
170
|
has_rdoc: true
|
149
|
-
homepage: http://roo.rubyforge.org
|
171
|
+
homepage: http://roo.rubyforge.org/
|
150
172
|
licenses: []
|
151
173
|
|
152
174
|
post_install_message:
|
153
175
|
rdoc_options:
|
154
176
|
- --main
|
155
|
-
- README.
|
177
|
+
- README.txt
|
156
178
|
require_paths:
|
157
179
|
- lib
|
158
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -173,11 +195,7 @@ rubyforge_project: roo
|
|
173
195
|
rubygems_version: 1.3.5
|
174
196
|
signing_key:
|
175
197
|
specification_version: 3
|
176
|
-
summary:
|
198
|
+
summary: Roo can access the contents of various spreadsheet files
|
177
199
|
test_files:
|
178
|
-
- test/skipped_tests.rb
|
179
200
|
- test/test_helper.rb
|
180
201
|
- test/test_roo.rb
|
181
|
-
- examples/roo_soap_client.rb
|
182
|
-
- examples/roo_soap_server.rb
|
183
|
-
- examples/write_me.rb
|
data/README.markdown
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# README for Roo
|
2
|
-
|
3
|
-
Roo is available here and on Rubyforge. You can install the official release with 'gem install roo' or refer to the installation instructions below for the latest development gem.
|
4
|
-
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
# Run the following if you haven't done so before:
|
9
|
-
gem sources -a http://gems.github.com/
|
10
|
-
|
11
|
-
# Install the gem:
|
12
|
-
sudo gem install hmcgowan-roo
|
13
|
-
|
14
|
-
## Usage:
|
15
|
-
|
16
|
-
require 'rubygems'
|
17
|
-
require 'roo'
|
18
|
-
|
19
|
-
s = Openoffice.new("myspreadsheet.ods") # creates an Openoffice Spreadsheet instance
|
20
|
-
s = Excel.new("myspreadsheet.xls") # creates an Excel Spreadsheet instance
|
21
|
-
s = Google.new("myspreadsheetkey_at_google") # creates an Google Spreadsheet instance
|
22
|
-
s = Excelx.new("myspreadsheet.xlsx") # creates an Excel Spreadsheet instance for Excel .xlsx files
|
23
|
-
|
24
|
-
s.default_sheet = s.sheets.first # first sheet in the spreadsheet file will be used
|
25
|
-
|
26
|
-
# s.sheet is an array which holds the names of the sheets within
|
27
|
-
# a spreadsheet.
|
28
|
-
# you can also write
|
29
|
-
# s.default_sheet = s.sheets[3] or
|
30
|
-
# s.default_sheet = 'Sheet 3'
|
31
|
-
|
32
|
-
s.cell(1,1) # returns the content of the first row/first cell in the sheet
|
33
|
-
s.cell('A',1) # same cell
|
34
|
-
s.cell(1,'A') # same cell
|
35
|
-
s.cell(1,'A',s.sheets[0]) # same cell
|
36
|
-
|
37
|
-
# almost all methods have an optional argument 'sheet'.
|
38
|
-
# If this parameter is omitted, the default_sheet will be used.
|
39
|
-
|
40
|
-
s.info # prints infos about the spreadsheet file
|
41
|
-
|
42
|
-
s.first_row # the number of the first row
|
43
|
-
s.last_row # the number of the last row
|
44
|
-
s.first_column # the number of the first column
|
45
|
-
s.last_column # the number of the last column
|
46
|
-
|
47
|
-
# limited font information is available
|
48
|
-
|
49
|
-
s.font(1,1).bold?
|
50
|
-
s.font(1,1).italic?
|
51
|
-
s.font(1,1).underline?
|
52
|
-
|
53
|
-
|
54
|
-
see http://roo.rubyforge.org for a more complete tutorial
|
55
|
-
|
data/examples/roo_soap_client.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'soap/rpc/driver'
|
2
|
-
|
3
|
-
def ferien_fuer_region(proxy, region, year=nil)
|
4
|
-
proxy.first_row.upto(proxy.last_row) { |row|
|
5
|
-
if proxy.cell(row, 2) == region
|
6
|
-
jahr = proxy.cell(row,1).to_i
|
7
|
-
if year == nil || jahr == year
|
8
|
-
bis_datum = proxy.cell(row,5)
|
9
|
-
if DateTime.now > bis_datum
|
10
|
-
print '('
|
11
|
-
end
|
12
|
-
print jahr.to_s+" "
|
13
|
-
print proxy.cell(row,2)+" "
|
14
|
-
print proxy.cell(row,3)+" "
|
15
|
-
print proxy.cell(row,4).to_s+" "
|
16
|
-
print bis_datum.to_s+" "
|
17
|
-
print (proxy.cell(row,6) || '')+" "
|
18
|
-
if DateTime.now > bis_datum
|
19
|
-
print ')'
|
20
|
-
end
|
21
|
-
puts
|
22
|
-
end
|
23
|
-
end
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
proxy = SOAP::RPC::Driver.new("http://localhost:12321","spreadsheetserver")
|
28
|
-
proxy.add_method('cell','row','col')
|
29
|
-
proxy.add_method('officeversion')
|
30
|
-
proxy.add_method('last_row')
|
31
|
-
proxy.add_method('last_column')
|
32
|
-
proxy.add_method('first_row')
|
33
|
-
proxy.add_method('first_column')
|
34
|
-
proxy.add_method('sheets')
|
35
|
-
proxy.add_method('set_default_sheet','s')
|
36
|
-
proxy.add_method('ferien_fuer_region', 'region')
|
37
|
-
|
38
|
-
sheets = proxy.sheets
|
39
|
-
proxy.set_default_sheet(sheets.first)
|
40
|
-
|
41
|
-
puts "first row: #{proxy.first_row}"
|
42
|
-
puts "first column: #{proxy.first_column}"
|
43
|
-
puts "last row: #{proxy.last_row}"
|
44
|
-
puts "last column: #{proxy.last_column}"
|
45
|
-
puts "cell: #{proxy.cell('C',8)}"
|
46
|
-
puts "cell: #{proxy.cell('F',12)}"
|
47
|
-
puts "officeversion: #{proxy.officeversion}"
|
48
|
-
puts "Berlin:"
|
49
|
-
|
50
|
-
ferien_fuer_region(proxy, "Berlin")
|
51
|
-
|
52
|
-
|
53
|
-
|
data/examples/roo_soap_server.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'roo'
|
3
|
-
require 'soap/rpc/standaloneServer'
|
4
|
-
|
5
|
-
NS = "spreadsheetserver" # name of your service = namespace
|
6
|
-
class Server2 < SOAP::RPC::StandaloneServer
|
7
|
-
|
8
|
-
def on_init
|
9
|
-
spreadsheet = Openoffice.new("./Ferien-de.ods")
|
10
|
-
add_method(spreadsheet, 'cell', 'row', 'col')
|
11
|
-
add_method(spreadsheet, 'officeversion')
|
12
|
-
add_method(spreadsheet, 'first_row')
|
13
|
-
add_method(spreadsheet, 'last_row')
|
14
|
-
add_method(spreadsheet, 'first_column')
|
15
|
-
add_method(spreadsheet, 'last_column')
|
16
|
-
add_method(spreadsheet, 'sheets')
|
17
|
-
#add_method(spreadsheet, 'default_sheet=', 's')
|
18
|
-
# method with '...=' did not work? alias method 'set_default_sheet' created
|
19
|
-
add_method(spreadsheet, 'set_default_sheet', 's')
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
PORT = 12321
|
25
|
-
puts "serving at port #{PORT}"
|
26
|
-
svr = Server2.new('Roo', NS, '0.0.0.0', PORT)
|
27
|
-
|
28
|
-
trap('INT') { svr.shutdown }
|
29
|
-
svr.start
|
data/examples/write_me.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'roo'
|
3
|
-
|
4
|
-
#-- create a new spreadsheet within your google-spreadsheets and paste
|
5
|
-
#-- the 'key' parameter in the spreadsheet URL
|
6
|
-
MAXTRIES = 1000
|
7
|
-
print "what's your name? "
|
8
|
-
my_name = gets.chomp
|
9
|
-
print "where do you live? "
|
10
|
-
my_location = gets.chomp
|
11
|
-
print "your message? (if left blank, only your name and location will be inserted) "
|
12
|
-
my_message = gets.chomp
|
13
|
-
spreadsheet = Google.new('ptu6bbahNZpY0N0RrxQbWdw')
|
14
|
-
spreadsheet.default_sheet = 'Sheet1'
|
15
|
-
success = false
|
16
|
-
MAXTRIES.times do
|
17
|
-
col = rand(10)+1
|
18
|
-
row = rand(10)+1
|
19
|
-
if spreadsheet.empty?(row,col)
|
20
|
-
if my_message.empty?
|
21
|
-
text = Time.now.to_s+" "+"Greetings from #{my_name} (#{my_location})"
|
22
|
-
else
|
23
|
-
text = Time.now.to_s+" "+"#{my_message} from #{my_name} (#{my_location})"
|
24
|
-
end
|
25
|
-
spreadsheet.set_value(row,col,text)
|
26
|
-
puts "message written to row #{row}, column #{col}"
|
27
|
-
success = true
|
28
|
-
break
|
29
|
-
end
|
30
|
-
puts "Row #{row}, column #{col} already occupied, trying again..."
|
31
|
-
end
|
32
|
-
puts "no empty cell found within #{MAXTRIES} tries" if !success
|
33
|
-
|
Binary file
|
data/test/skipped_tests.rb
DELETED
@@ -1,789 +0,0 @@
|
|
1
|
-
# These tests were all removed from test_roo.rb because they were
|
2
|
-
# from unimplemented functionality, or more commonly, missing
|
3
|
-
# the source test data to run against.
|
4
|
-
|
5
|
-
module SkippedTests
|
6
|
-
# don't have these test files so removing. We can easily add in
|
7
|
-
# by modifying with_each_spreadsheet
|
8
|
-
GNUMERIC_ODS = false # do gnumeric with ods files Tests?
|
9
|
-
OPENOFFICEWRITE = false # experimental: write access with OO-Documents
|
10
|
-
|
11
|
-
def SKIP_test_writeopenoffice
|
12
|
-
if OPENOFFICEWRITE
|
13
|
-
File.cp(File.join(TESTDIR,"numbers1.ods"),
|
14
|
-
File.join(TESTDIR,"numbers2.ods"))
|
15
|
-
File.cp(File.join(TESTDIR,"numbers2.ods"),
|
16
|
-
File.join(TESTDIR,"bak_numbers2.ods"))
|
17
|
-
oo = Openoffice.new(File.join(TESTDIR,"numbers2.ods"))
|
18
|
-
oo.default_sheet = oo.sheets.first
|
19
|
-
oo.first_row.upto(oo.last_row) {|y|
|
20
|
-
oo.first_column.upto(oo.last_column) {|x|
|
21
|
-
unless oo.empty?(y,x)
|
22
|
-
# oo.set(y, x, oo.cell(y,x) + 7) if oo.celltype(y,x) == "float"
|
23
|
-
oo.set(y, x, oo.cell(y,x) + 7) if oo.celltype(y,x) == :float
|
24
|
-
end
|
25
|
-
}
|
26
|
-
}
|
27
|
-
oo.save
|
28
|
-
|
29
|
-
oo1 = Openoffice.new(File.join(TESTDIR,"numbers2.ods"))
|
30
|
-
oo2 = Openoffice.new(File.join(TESTDIR,"bak_numbers2.ods"))
|
31
|
-
#p oo2.to_s
|
32
|
-
assert_equal 999, oo2.cell('a',1), oo2.cell('a',1)
|
33
|
-
assert_equal oo2.cell('a',1) + 7, oo1.cell('a',1)
|
34
|
-
assert_equal oo2.cell('b',1)+7, oo1.cell('b',1)
|
35
|
-
assert_equal oo2.cell('c',1)+7, oo1.cell('c',1)
|
36
|
-
assert_equal oo2.cell('d',1)+7, oo1.cell('d',1)
|
37
|
-
assert_equal oo2.cell('a',2)+7, oo1.cell('a',2)
|
38
|
-
assert_equal oo2.cell('b',2)+7, oo1.cell('b',2)
|
39
|
-
assert_equal oo2.cell('c',2)+7, oo1.cell('c',2)
|
40
|
-
assert_equal oo2.cell('d',2)+7, oo1.cell('d',2)
|
41
|
-
assert_equal oo2.cell('e',2)+7, oo1.cell('e',2)
|
42
|
-
|
43
|
-
File.cp(File.join(TESTDIR,"bak_numbers2.ods"),
|
44
|
-
File.join(TESTDIR,"numbers2.ods"))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def SKIP_test_possible_bug_snowboard_borders #no test file
|
49
|
-
after Date.new(2008,12,15) do
|
50
|
-
local_only do
|
51
|
-
if EXCEL
|
52
|
-
ex = Excel.new(File.join(TESTDIR,'problem.xls'))
|
53
|
-
ex.default_sheet = ex.sheets.first
|
54
|
-
assert_equal 2, ex.first_row
|
55
|
-
assert_equal 30, ex.last_row
|
56
|
-
assert_equal 'A', ex.first_column_as_letter
|
57
|
-
assert_equal 'J', ex.last_column_as_letter
|
58
|
-
end
|
59
|
-
if EXCELX
|
60
|
-
ex = Excelx.new(File.join(TESTDIR,'problem.xlsx'))
|
61
|
-
ex.default_sheet = ex.sheets.first
|
62
|
-
assert_equal 2, ex.first_row
|
63
|
-
assert_equal 30, ex.last_row
|
64
|
-
assert_equal 'A', ex.first_column_as_letter
|
65
|
-
assert_equal 'J', ex.last_column_as_letter
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def common_possible_bug_snowboard_cells(ss)
|
72
|
-
assert_equal "A.", ss.cell(13,'A'), ss.class
|
73
|
-
assert_equal 147, ss.cell(13,'f'), ss.class
|
74
|
-
assert_equal 152, ss.cell(13,'g'), ss.class
|
75
|
-
assert_equal 156, ss.cell(13,'h'), ss.class
|
76
|
-
assert_equal 158, ss.cell(13,'i'), ss.class
|
77
|
-
assert_equal 160, ss.cell(13,'j'), ss.class
|
78
|
-
assert_equal 164, ss.cell(13,'k'), ss.class
|
79
|
-
assert_equal 168, ss.cell(13,'l'), ss.class
|
80
|
-
assert_equal :string, ss.celltype(13,'m'), ss.class
|
81
|
-
assert_equal "159W", ss.cell(13,'m'), ss.class
|
82
|
-
assert_equal "164W", ss.cell(13,'n'), ss.class
|
83
|
-
assert_equal "168W", ss.cell(13,'o'), ss.class
|
84
|
-
end
|
85
|
-
|
86
|
-
def SKIP_test_possible_bug_snowboard_cells # no test file
|
87
|
-
local_only do
|
88
|
-
after Date.new(2009,1,6) do
|
89
|
-
# warten auf Bugfix in parseexcel
|
90
|
-
if EXCEL
|
91
|
-
ex = Excel.new(File.join(TESTDIR,'problem.xls'))
|
92
|
-
ex.default_sheet = 'Custom X'
|
93
|
-
common_possible_bug_snowboard_cells(ex)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
if EXCELX
|
97
|
-
ex = Excelx.new(File.join(TESTDIR,'problem.xlsx'))
|
98
|
-
ex.default_sheet = 'Custom X'
|
99
|
-
common_possible_bug_snowboard_cells(ex)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
if EXCELX
|
105
|
-
def test_possible_bug_2008_09_13
|
106
|
-
local_only do
|
107
|
-
# war nur in der 1.0.0 Release ein Fehler und sollte mit aktueller
|
108
|
-
# Release nicht mehr auftreten.
|
109
|
-
=begin
|
110
|
-
−
|
111
|
-
<sst count="46" uniqueCount="39">
|
112
|
-
−
|
113
|
-
0<si>
|
114
|
-
<t>Bond</t>
|
115
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
116
|
-
</si>
|
117
|
-
−
|
118
|
-
1<si>
|
119
|
-
<t>James</t>
|
120
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
121
|
-
</si>
|
122
|
-
−
|
123
|
-
2<si>
|
124
|
-
<t>8659</t>
|
125
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
126
|
-
</si>
|
127
|
-
−
|
128
|
-
3<si>
|
129
|
-
<t>12B</t>
|
130
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
131
|
-
</si>
|
132
|
-
−
|
133
|
-
4<si>
|
134
|
-
<t>087692</t>
|
135
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
136
|
-
</si>
|
137
|
-
−
|
138
|
-
5<si>
|
139
|
-
<t>Rowe</t>
|
140
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
141
|
-
</si>
|
142
|
-
−
|
143
|
-
6<si>
|
144
|
-
<t>Karl</t>
|
145
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
146
|
-
</si>
|
147
|
-
−
|
148
|
-
7<si>
|
149
|
-
<t>9128</t>
|
150
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
151
|
-
</si>
|
152
|
-
−
|
153
|
-
8<si>
|
154
|
-
<t>79A</t>
|
155
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
156
|
-
</si>
|
157
|
-
−
|
158
|
-
9<si>
|
159
|
-
<t>Benson</t>
|
160
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
161
|
-
</si>
|
162
|
-
−
|
163
|
-
10<si>
|
164
|
-
<t>Cedric</t>
|
165
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
166
|
-
</si>
|
167
|
-
−
|
168
|
-
11<si>
|
169
|
-
<t>Greenstreet</t>
|
170
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
171
|
-
</si>
|
172
|
-
−
|
173
|
-
12<si>
|
174
|
-
<t>Jenny</t>
|
175
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
176
|
-
</si>
|
177
|
-
−
|
178
|
-
13<si>
|
179
|
-
<t>Smith</t>
|
180
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
181
|
-
</si>
|
182
|
-
−
|
183
|
-
14<si>
|
184
|
-
<t>Greame</t>
|
185
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
186
|
-
</si>
|
187
|
-
−
|
188
|
-
15<si>
|
189
|
-
<t>Lucas</t>
|
190
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
191
|
-
</si>
|
192
|
-
−
|
193
|
-
16<si>
|
194
|
-
<t>Ward</t>
|
195
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
196
|
-
</si>
|
197
|
-
−
|
198
|
-
17<si>
|
199
|
-
<t>Lee</t>
|
200
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
201
|
-
</si>
|
202
|
-
−
|
203
|
-
18<si>
|
204
|
-
<t>Bret</t>
|
205
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
206
|
-
</si>
|
207
|
-
−
|
208
|
-
19<si>
|
209
|
-
<t>Warne</t>
|
210
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
211
|
-
</si>
|
212
|
-
−
|
213
|
-
20<si>
|
214
|
-
<t>Shane</t>
|
215
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
216
|
-
</si>
|
217
|
-
−
|
218
|
-
21<si>
|
219
|
-
<t>782</t>
|
220
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
221
|
-
</si>
|
222
|
-
−
|
223
|
-
22<si>
|
224
|
-
<t>876</t>
|
225
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
226
|
-
</si>
|
227
|
-
−
|
228
|
-
23<si>
|
229
|
-
<t>9901</t>
|
230
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
231
|
-
</si>
|
232
|
-
−
|
233
|
-
24<si>
|
234
|
-
<t>1235</t>
|
235
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
236
|
-
</si>
|
237
|
-
−
|
238
|
-
25<si>
|
239
|
-
<t>16547</t>
|
240
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
241
|
-
</si>
|
242
|
-
−
|
243
|
-
26<si>
|
244
|
-
<t>7789</t>
|
245
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
246
|
-
</si>
|
247
|
-
−
|
248
|
-
27<si>
|
249
|
-
<t>89</t>
|
250
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
251
|
-
</si>
|
252
|
-
−
|
253
|
-
28<si>
|
254
|
-
<t>12A</t>
|
255
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
256
|
-
</si>
|
257
|
-
−
|
258
|
-
29<si>
|
259
|
-
<t>19A</t>
|
260
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
261
|
-
</si>
|
262
|
-
−
|
263
|
-
30<si>
|
264
|
-
<t>256</t>
|
265
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
266
|
-
</si>
|
267
|
-
−
|
268
|
-
31<si>
|
269
|
-
<t>129B</t>
|
270
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
271
|
-
</si>
|
272
|
-
−
|
273
|
-
32<si>
|
274
|
-
<t>11</t>
|
275
|
-
<phoneticPr fontId="1" type="noConversion"/>
|
276
|
-
</si>
|
277
|
-
−
|
278
|
-
33<si>
|
279
|
-
<t>Last Name</t>
|
280
|
-
</si>
|
281
|
-
−
|
282
|
-
34<si>
|
283
|
-
<t>First Name</t>
|
284
|
-
</si>
|
285
|
-
−
|
286
|
-
35 <si>
|
287
|
-
<t>Middle Name</t>
|
288
|
-
</si>
|
289
|
-
−
|
290
|
-
36<si>
|
291
|
-
<t>Resident ID</t>
|
292
|
-
</si>
|
293
|
-
−
|
294
|
-
37<si>
|
295
|
-
<t>Room Number</t>
|
296
|
-
</si>
|
297
|
-
−
|
298
|
-
38<si>
|
299
|
-
<t>Provider ID #</t>
|
300
|
-
</si>
|
301
|
-
</sst>
|
302
|
-
Hello Thomas,
|
303
|
-
How are you doing ? I am running into this strange issue with roo plugin (1.0.0). The attached
|
304
|
-
spreadsheet has all the cells formatted as "text", when I view in the Excel spreadsheet. But when it
|
305
|
-
get's into roo plugin (set_cell_values method - line 299), the values for the cells 1,1, 1,2, 1,3...1,6
|
306
|
-
show as 'date' instead of 'string'.
|
307
|
-
Because of this my parser is failing to get the proper values from the spreadsheet. Any ideas why
|
308
|
-
the formatting is getting set to the wrong value ?
|
309
|
-
Even stranger is if I save this file as ".XLS" and parse it the cells parse out fine as they are treated as
|
310
|
-
'string' instead of 'date'.
|
311
|
-
This attached file is the newer format of Microsoft Excel (.xlsx).
|
312
|
-
|
313
|
-
=end
|
314
|
-
xx = Excelx.new(File.join(TESTDIR,'sample_file_2008-09-13.xlsx'))
|
315
|
-
assert_equal 1, xx.sheets.size
|
316
|
-
|
317
|
-
assert_equal 1, xx.first_row
|
318
|
-
assert_equal 9, xx.last_row # 9 ist richtig. Es sind zwar 44 Zeilen definiert, aber der Rest hat keinen Inhalt
|
319
|
-
assert_equal 1, xx.first_column
|
320
|
-
assert_equal 6, xx.last_column
|
321
|
-
assert_equal 'A', xx.first_column_as_letter
|
322
|
-
assert_equal 'F', xx.last_column_as_letter
|
323
|
-
|
324
|
-
assert_nothing_raised() {
|
325
|
-
puts xx.info
|
326
|
-
}
|
327
|
-
p xx.cell(1,1)
|
328
|
-
p xx.cell(1,2)
|
329
|
-
p xx.cell(1,3)
|
330
|
-
p xx.cell(1,4)
|
331
|
-
p xx.cell(1,5)
|
332
|
-
p xx.cell(1,6)
|
333
|
-
xx.default_sheet = xx.sheets.first
|
334
|
-
|
335
|
-
assert_equal 'Last Name', xx.cell('A',1)
|
336
|
-
|
337
|
-
1.upto(6) do |col|
|
338
|
-
assert_equal :string, xx.celltype(1,col)
|
339
|
-
end
|
340
|
-
#for col in (1..6)
|
341
|
-
# assert_equal "1234", xx.cell(1,col)
|
342
|
-
#end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
#-- bei diesen Test bekomme ich seltsamerweise einen Fehler can't allocate
|
348
|
-
#-- memory innerhalb der zip-Routinen => erstmal deaktiviert
|
349
|
-
def SKIP_test_huge_table_timing_10_000_openoffice #no test file
|
350
|
-
with_each_spreadsheet(:name=>'/home/tp/ruby-test/too-testing/speedtest_10000') do |oo|
|
351
|
-
after Date.new(2009,1,1) do
|
352
|
-
if LONG_RUN
|
353
|
-
assert_nothing_raised(Timeout::Error) {
|
354
|
-
Timeout::timeout(3.minutes) do |timeout_length|
|
355
|
-
# process every cell
|
356
|
-
sum = 0
|
357
|
-
oo.sheets.each {|sheet|
|
358
|
-
oo.default_sheet = sheet
|
359
|
-
for row in oo.first_row..oo.last_row do
|
360
|
-
for col in oo.first_column..oo.last_column do
|
361
|
-
c = oo.cell(row,col)
|
362
|
-
sum += c.length if c
|
363
|
-
end
|
364
|
-
end
|
365
|
-
p sum
|
366
|
-
assert sum > 0
|
367
|
-
}
|
368
|
-
end
|
369
|
-
}
|
370
|
-
end
|
371
|
-
end
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
# Eine Spreadsheetdatei wird nicht als Dateiname sondern direkt als Dokument
|
376
|
-
# geoeffnettest_problemx_csv_imported
|
377
|
-
def SKIP_test_from_stream_openoffice
|
378
|
-
after Date.new(2009,1,6) do
|
379
|
-
if OPENOFFICE
|
380
|
-
filecontent = nil
|
381
|
-
File.open(File.join(TESTDIR,"numbers1.ods")) do |f|
|
382
|
-
filecontent = f.read
|
383
|
-
p filecontent.class
|
384
|
-
p filecontent.size
|
385
|
-
#p filecontent
|
386
|
-
assert filecontent.size > 0
|
387
|
-
# #stream macht das gleiche wie #new liest abe aus Stream anstatt Datei
|
388
|
-
oo = Openoffice.stream(filecontent)
|
389
|
-
end
|
390
|
-
#oo = Openoffice.open()
|
391
|
-
end
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
|
396
|
-
def SKIP_test_bug_encoding_exported_from_google
|
397
|
-
if EXCEL
|
398
|
-
xl = Excel.new(File.join(TESTDIR,"numbers1_from_google.xls"))
|
399
|
-
xl.default_sheet = xl.sheets.first
|
400
|
-
assert_equal 'test', xl.cell(2,'F')
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
def SKIP_test_invalid_iconv_from_ms
|
405
|
-
#TODO: does only run within a darwin-environment
|
406
|
-
if RUBY_PLATFORM.downcase =~ /darwin/
|
407
|
-
assert_nothing_raised() {
|
408
|
-
oo = Excel.new(File.join(TESTDIR,"ms.xls"))
|
409
|
-
}
|
410
|
-
end
|
411
|
-
end
|
412
|
-
|
413
|
-
def SKIP_test_false_encoding
|
414
|
-
ex = Excel.new(File.join(TESTDIR,'false_encoding.xls'))
|
415
|
-
ex.default_sheet = ex.sheets.first
|
416
|
-
assert_equal "Sheet1", ex.sheets.first
|
417
|
-
ex.first_row.upto(ex.last_row) do |row|
|
418
|
-
ex.first_column.upto(ex.last_column) do |col|
|
419
|
-
content = ex.cell(row,col)
|
420
|
-
puts "#{row}/#{col}"
|
421
|
-
#puts content if ! ex.empty?(row,col) or ex.formula?(row,col)
|
422
|
-
if ex.formula?(row,col)
|
423
|
-
#! ex.empty?(row,col)
|
424
|
-
puts content
|
425
|
-
end
|
426
|
-
end
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
def SKIP_test_simple_google
|
431
|
-
if GOOGLE
|
432
|
-
go = Google.new("egal")
|
433
|
-
assert_equal "42", go.cell(1,1)
|
434
|
-
end
|
435
|
-
end
|
436
|
-
def SKIP_test_bug_c2 # no test file
|
437
|
-
with_each_spreadsheet(:name=>'problem', :foramt=>:excel) do |oo|
|
438
|
-
after Date.new(2009,1,6) do
|
439
|
-
local_only do
|
440
|
-
expected = ['Supermodel X','T6','Shaun White','Jeremy','Custom',
|
441
|
-
'Warhol','Twin','Malolo','Supermodel','Air','Elite',
|
442
|
-
'King','Dominant','Dominant Slick','Blunt','Clash',
|
443
|
-
'Bullet','Tadashi Fuse','Jussi','Royale','S-Series',
|
444
|
-
'Fish','Love','Feelgood ES','Feelgood','GTwin','Troop',
|
445
|
-
'Lux','Stigma','Feather','Stria','Alpha','Feelgood ICS']
|
446
|
-
result = []
|
447
|
-
oo.sheets[2..oo.sheets.length].each do |s|
|
448
|
-
#(13..13).each do |s|
|
449
|
-
oo.default_sheet = s
|
450
|
-
name = oo.cell(2,'C')
|
451
|
-
result << name
|
452
|
-
#puts "#{name} (sheet: #{s})"
|
453
|
-
#assert_equal "whatever (sheet: 13)", "#{name} (sheet: #{s})"
|
454
|
-
end
|
455
|
-
assert_equal expected, result
|
456
|
-
end
|
457
|
-
end
|
458
|
-
end
|
459
|
-
end
|
460
|
-
|
461
|
-
def SKIP_test_bug_c2_parseexcel #no test file
|
462
|
-
after Date.new(2009,1,10) do
|
463
|
-
local_only do
|
464
|
-
#-- this is OK
|
465
|
-
@workbook = Spreadsheet::ParseExcel.parse(File.join(TESTDIR,"problem.xls"))
|
466
|
-
worksheet = @workbook.worksheet(11)
|
467
|
-
skip = 0
|
468
|
-
line = 1
|
469
|
-
row = 2
|
470
|
-
col = 3
|
471
|
-
worksheet.each(skip) { |row_par|
|
472
|
-
if line == row
|
473
|
-
if row_par == nil
|
474
|
-
raise "nil"
|
475
|
-
end
|
476
|
-
cell = row_par.at(col-1)
|
477
|
-
assert cell, "cell should not be nil"
|
478
|
-
assert_equal "Air", cell.to_s('utf-8')
|
479
|
-
end
|
480
|
-
line += 1
|
481
|
-
}
|
482
|
-
#-- worksheet 12 does not work
|
483
|
-
@workbook = Spreadsheet::ParseExcel.parse(File.join(TESTDIR,"problem.xls"))
|
484
|
-
worksheet = @workbook.worksheet(12)
|
485
|
-
skip = 0
|
486
|
-
line = 1
|
487
|
-
row = 2
|
488
|
-
col = 3
|
489
|
-
worksheet.each(skip) { |row_par|
|
490
|
-
if line == row
|
491
|
-
if row_par == nil
|
492
|
-
raise "nil"
|
493
|
-
end
|
494
|
-
cell = row_par.at(col-1)
|
495
|
-
assert cell, "cell should not be nil"
|
496
|
-
assert_equal "Elite", cell.to_s('utf-8')
|
497
|
-
end
|
498
|
-
line += 1
|
499
|
-
}
|
500
|
-
end
|
501
|
-
end
|
502
|
-
end
|
503
|
-
|
504
|
-
def SKIP_test_bug_c2_excelx #no test file
|
505
|
-
after Date.new(2008,9,15) do
|
506
|
-
local_only do
|
507
|
-
expected = ['Supermodel X','T6','Shaun White','Jeremy','Custom',
|
508
|
-
'Warhol','Twin','Malolo','Supermodel','Air','Elite',
|
509
|
-
'King','Dominant','Dominant Slick','Blunt','Clash',
|
510
|
-
'Bullet','Tadashi Fuse','Jussi','Royale','S-Series',
|
511
|
-
'Fish','Love','Feelgood ES','Feelgood','GTwin','Troop',
|
512
|
-
'Lux','Stigma','Feather','Stria','Alpha','Feelgood ICS']
|
513
|
-
result = []
|
514
|
-
@e = Excelx.new(File.join(TESTDIR,"problem.xlsx"))
|
515
|
-
@e.sheets[2..@e.sheets.length].each do |s|
|
516
|
-
@e.default_sheet = s
|
517
|
-
# assert_equal "A.",@e.cell('a',13)
|
518
|
-
name = @e.cell(2,'C')
|
519
|
-
result << name
|
520
|
-
#puts "#{name} (sheet: #{s})"
|
521
|
-
#assert_equal :string, @e.celltype('c',2)
|
522
|
-
#assert_equal "Vapor (sheet: Vapor)", "#{name} (sheet: #{@e.sheets.first})"
|
523
|
-
assert @e.cell(2,'c')
|
524
|
-
end
|
525
|
-
assert_equal expected, result
|
526
|
-
|
527
|
-
@e = Excelx.new(File.join(TESTDIR,"problem.xlsx"))
|
528
|
-
#@e.sheets[2..@e.sheets.length].each do |s|
|
529
|
-
(13..13).each do |s|
|
530
|
-
@e.default_sheet = s
|
531
|
-
name = @e.cell(2,'C')
|
532
|
-
#puts "#{name} (sheet: #{s})"
|
533
|
-
assert_equal "Elite (sheet: 13)", "#{name} (sheet: #{s})"
|
534
|
-
end
|
535
|
-
end
|
536
|
-
end
|
537
|
-
end
|
538
|
-
|
539
|
-
def SKIP_test_compare_csv_excelx_excel #no test file
|
540
|
-
if EXCELX
|
541
|
-
after Date.new(2008,12,30) do
|
542
|
-
# parseexcel bug
|
543
|
-
local_only do
|
544
|
-
s1 = Excel.new(File.join(TESTDIR,"problem.xls"))
|
545
|
-
s2 = Excelx.new(File.join(TESTDIR,"problem.xlsx"))
|
546
|
-
s1.sheets.each {|sh| #TODO:
|
547
|
-
s1.default_sheet = sh
|
548
|
-
s2.default_sheet = sh
|
549
|
-
File.delete_if_exist("/tmp/problem.csv")
|
550
|
-
File.delete_if_exist("/tmp/problemx.csv")
|
551
|
-
assert s1.to_csv("/tmp/problem.csv")
|
552
|
-
assert s2.to_csv("/tmp/problemx.csv")
|
553
|
-
assert File.exists?("/tmp/problem.csv")
|
554
|
-
assert File.exists?("/tmp/problemx.csv")
|
555
|
-
assert_equal "", `diff /tmp/problem.csv /tmp/problemx.csv`, "Unterschied in Sheet #{sh} #{s1.sheets.index(sh)}"
|
556
|
-
}
|
557
|
-
end
|
558
|
-
end
|
559
|
-
end
|
560
|
-
end
|
561
|
-
|
562
|
-
def SKIP_test_problemx_csv_imported #no test file
|
563
|
-
after Date.new(2009,1,6) do
|
564
|
-
if EXCEL
|
565
|
-
local_only do
|
566
|
-
# wieder eingelesene CSV-Datei aus obigem Test
|
567
|
-
# muss identisch mit problem.xls sein
|
568
|
-
# Importieren aus csv-Datei muss manuell gemacht werden
|
569
|
-
ex = Excel.new(File.join(TESTDIR,"problem.xls"))
|
570
|
-
cs = Excel.new(File.join(TESTDIR,"problemx_csv_imported.xls"))
|
571
|
-
# nur das erste sheet betrachten
|
572
|
-
ex.default_sheet = ex.sheets.first
|
573
|
-
cs.default_sheet = cs.sheets.first
|
574
|
-
ex.first_row.upto(ex.last_row) do |row|
|
575
|
-
ex.first_column.upto(ex.last_column) do |col|
|
576
|
-
assert_equal ex.cell(row,col), cs.cell(row,col), "cell #{row}/#{col} does not match '#{ex.cell(row,col)}' '#{cs.cell(row,col)}'"
|
577
|
-
assert_equal ex.celltype(row,col), cs.celltype(row,col), "celltype #{row}/#{col} does not match"
|
578
|
-
assert_equal ex.empty?(row,col), cs.empty?(row,col), "empty? #{row}/#{col} does not match"
|
579
|
-
if defined? excel_supports_formulas
|
580
|
-
assert_equal ex.formula?(row,col), cs.formula?(row,col), "formula? #{row}/#{col} does not match"
|
581
|
-
assert_equal ex.formula(row,col), cs.formula(row,col), "formula #{row}/#{col} does not match"
|
582
|
-
end
|
583
|
-
end
|
584
|
-
end
|
585
|
-
cs.first_row.upto(cs.last_row) do |row|
|
586
|
-
cs.first_column.upto(cs.last_column) do |col|
|
587
|
-
assert_equal ex.cell(row,col), cs.cell(row,col), "cell #{row}/#{col} does not match '#{ex.cell(row,col)}' '#{cs.cell(row,col)}'"
|
588
|
-
assert_equal ex.celltype(row,col), cs.celltype(row,col), "celltype #{row}/#{col} does not match"
|
589
|
-
assert_equal ex.empty?(row,col), cs.empty?(row,col), "empty? #{row}/#{col} does not match"
|
590
|
-
if defined? excel_supports_formulas
|
591
|
-
assert_equal ex.formula?(row,col), cs.formula?(row,col), "formula? #{row}/#{col} does not match"
|
592
|
-
assert_equal ex.formula(row,col), cs.formula(row,col), "formula #{row}/#{col} does not match"
|
593
|
-
end
|
594
|
-
end
|
595
|
-
end
|
596
|
-
end
|
597
|
-
end
|
598
|
-
end
|
599
|
-
end
|
600
|
-
|
601
|
-
def SKIP_test_open_from_uri
|
602
|
-
if ONLINE
|
603
|
-
if OPENOFFICE
|
604
|
-
assert_raises(RuntimeError) {
|
605
|
-
oo = Openoffice.new("http://gibbsnichtdomainxxxxx.com/file.ods")
|
606
|
-
}
|
607
|
-
end
|
608
|
-
if EXCEL
|
609
|
-
assert_raises(RuntimeError) {
|
610
|
-
oo = Excel.new("http://gibbsnichtdomainxxxxx.com/file.xls")
|
611
|
-
}
|
612
|
-
end
|
613
|
-
if EXCELX
|
614
|
-
assert_raises(RuntimeError) {
|
615
|
-
oo = Excelx.new("http://gibbsnichtdomainxxxxx.com/file.xlsx")
|
616
|
-
}
|
617
|
-
end
|
618
|
-
end
|
619
|
-
end
|
620
|
-
|
621
|
-
def SKIP_test_to_ascii_openoffice #file does not exist
|
622
|
-
after Date.new(9999,12,31) do
|
623
|
-
with_each_spreadsheet(:name=>'verysimple_spreadsheet', :format=>:openoffice) do |oo|
|
624
|
-
oo.default_sheet = oo.sheets.first
|
625
|
-
expected="
|
626
|
-
A | B | C |
|
627
|
-
-------+-------+------|
|
628
|
-
7| 8| 9|
|
629
|
-
-------+-------+------|
|
630
|
-
4| 5| 6|
|
631
|
-
-------+-------+------|
|
632
|
-
1| 2| 3|
|
633
|
-
----------------------/
|
634
|
-
"
|
635
|
-
assert_equal expected, oo.to_ascii
|
636
|
-
end
|
637
|
-
end
|
638
|
-
end
|
639
|
-
if false
|
640
|
-
def test_soap_server
|
641
|
-
#threads = []
|
642
|
-
#threads << Thread.new("serverthread") do
|
643
|
-
fork do
|
644
|
-
p "serverthread started"
|
645
|
-
puts "in child, pid = #$$"
|
646
|
-
puts `/usr/bin/ruby rooserver.rb`
|
647
|
-
p "serverthread finished"
|
648
|
-
end
|
649
|
-
#threads << Thread.new("clientthread") do
|
650
|
-
p "clientthread started"
|
651
|
-
sleep 10
|
652
|
-
proxy = SOAP::RPC::Driver.new("http://localhost:12321","spreadsheetserver")
|
653
|
-
proxy.add_method('cell','row','col')
|
654
|
-
proxy.add_method('officeversion')
|
655
|
-
proxy.add_method('last_row')
|
656
|
-
proxy.add_method('last_column')
|
657
|
-
proxy.add_method('first_row')
|
658
|
-
proxy.add_method('first_column')
|
659
|
-
proxy.add_method('sheets')
|
660
|
-
proxy.add_method('set_default_sheet','s')
|
661
|
-
proxy.add_method('ferien_fuer_region', 'region')
|
662
|
-
|
663
|
-
sheets = proxy.sheets
|
664
|
-
p sheets
|
665
|
-
proxy.set_default_sheet(sheets.first)
|
666
|
-
|
667
|
-
assert_equal 1, proxy.first_row
|
668
|
-
assert_equal 1, proxy.first_column
|
669
|
-
assert_equal 187, proxy.last_row
|
670
|
-
assert_equal 7, proxy.last_column
|
671
|
-
assert_equal 42, proxy.cell('C',8)
|
672
|
-
assert_equal 43, proxy.cell('F',12)
|
673
|
-
assert_equal "1.0", proxy.officeversion
|
674
|
-
p "clientthread finished"
|
675
|
-
#end
|
676
|
-
#threads.each {|t| t.join }
|
677
|
-
puts "fertig"
|
678
|
-
Process.kill("INT",pid)
|
679
|
-
pid = Process.wait
|
680
|
-
puts "child terminated, pid= #{pid}, status= #{$?.exitstatus}"
|
681
|
-
end
|
682
|
-
end # false
|
683
|
-
|
684
|
-
def split_coord(s)
|
685
|
-
letter = ""
|
686
|
-
number = 0
|
687
|
-
i = 0
|
688
|
-
while i<s.length and "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".include?(s[i,1])
|
689
|
-
letter += s[i,1]
|
690
|
-
i+=1
|
691
|
-
end
|
692
|
-
while i<s.length and "01234567890".include?(s[i,1])
|
693
|
-
number = number*10 + s[i,1].to_i
|
694
|
-
i+=1
|
695
|
-
end
|
696
|
-
if letter=="" or number==0
|
697
|
-
raise ArgumentError
|
698
|
-
end
|
699
|
-
return letter,number
|
700
|
-
end
|
701
|
-
|
702
|
-
#def sum(s,expression)
|
703
|
-
# arg = expression.split(':')
|
704
|
-
# b,z = split_coord(arg[0])
|
705
|
-
# first_row = z
|
706
|
-
# first_col = Openoffice.letter_to_number(b)
|
707
|
-
# b,z = split_coord(arg[1])
|
708
|
-
# last_row = z
|
709
|
-
# last_col = Openoffice.letter_to_number(b)
|
710
|
-
# result = 0
|
711
|
-
# first_row.upto(last_row) {|row|
|
712
|
-
# first_col.upto(last_col) {|col|
|
713
|
-
# result = result + s.cell(row,col)
|
714
|
-
# }
|
715
|
-
# }
|
716
|
-
# result
|
717
|
-
#end
|
718
|
-
|
719
|
-
#def test_dsl
|
720
|
-
# s = Openoffice.new(File.join(TESTDIR,"numbers1.ods"))
|
721
|
-
# s.default_sheet = s.sheets.first
|
722
|
-
#
|
723
|
-
# s.set 'a',1, 5
|
724
|
-
# s.set 'b',1, 3
|
725
|
-
# s.set 'c',1, 7
|
726
|
-
# s.set('a',2, s.cell('a',1)+s.cell('b',1))
|
727
|
-
# assert_equal 8, s.cell('a',2)
|
728
|
-
#
|
729
|
-
# assert_equal 15, sum(s,'A1:C1')
|
730
|
-
# end
|
731
|
-
|
732
|
-
#def test_create_spreadsheet1
|
733
|
-
# name = File.join(TESTDIR,'createdspreadsheet.ods')
|
734
|
-
# rm(name) if File.exists?(File.join(TESTDIR,'createdspreadsheet.ods'))
|
735
|
-
# # anlegen, falls noch nicht existierend
|
736
|
-
# s = Openoffice.new(name,true)
|
737
|
-
# assert File.exists?(name)
|
738
|
-
#end
|
739
|
-
|
740
|
-
#def test_create_spreadsheet2
|
741
|
-
# # anlegen, falls noch nicht existierend
|
742
|
-
# s = Openoffice.new(File.join(TESTDIR,"createdspreadsheet.ods"),true)
|
743
|
-
# s.set 'a',1,42
|
744
|
-
# s.set 'b',1,43
|
745
|
-
# s.set 'c',1,44
|
746
|
-
# s.save
|
747
|
-
#
|
748
|
-
# #after Date.new(2007,7,3) do
|
749
|
-
# # t = Openoffice.new(File.join(TESTDIR,"createdspreadsheet.ods"))
|
750
|
-
# # assert_equal 42, t.cell(1,'a')
|
751
|
-
# # assert_equal 43, t.cell('b',1)
|
752
|
-
# # assert_equal 44, t.cell('c',3)
|
753
|
-
# #end
|
754
|
-
#end
|
755
|
-
|
756
|
-
#TODO: xlsx-Datei anpassen!
|
757
|
-
def test_excelx_open_from_uri_and_zipped
|
758
|
-
#TODO: gezippte xlsx Datei online zum Testen suchen
|
759
|
-
after Date.new(2999,6,30) do
|
760
|
-
if EXCELX
|
761
|
-
if ONLINE
|
762
|
-
url = 'http://stiny-leonhard.de/bode-v1.xlsx.zip'
|
763
|
-
excel = Excelx.new(url, :zip)
|
764
|
-
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
765
|
-
excel.remove_tmp # don't forget to remove the temporary files
|
766
|
-
end
|
767
|
-
end
|
768
|
-
end
|
769
|
-
end
|
770
|
-
|
771
|
-
def test_excelx_zipped
|
772
|
-
# TODO: bode...xls bei Gelegenheit nach .xlsx konverieren lassen und zippen!
|
773
|
-
if EXCELX
|
774
|
-
after Date.new(2999,7,30) do
|
775
|
-
# diese Datei gibt es noch nicht gezippt
|
776
|
-
excel = Excelx.new(File.join(TESTDIR,"bode-v1.xlsx.zip"), :zip)
|
777
|
-
assert excel
|
778
|
-
assert_raises (ArgumentError) {
|
779
|
-
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
780
|
-
}
|
781
|
-
excel.default_sheet = excel.sheets.first
|
782
|
-
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
783
|
-
excel.remove_tmp # don't forget to remove the temporary files
|
784
|
-
end
|
785
|
-
end
|
786
|
-
end
|
787
|
-
|
788
|
-
|
789
|
-
end
|