roo 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/License.txt +0 -0
- data/Manifest.txt +0 -0
- data/README.txt +0 -0
- data/Rakefile +0 -0
- data/base64include.rb +0 -0
- data/examples/roo_soap_client.rb +0 -0
- data/examples/roo_soap_server.rb +0 -0
- data/examples/write_me.rb +0 -0
- data/lib/roo.rb +0 -0
- data/lib/roo/excel.rb +0 -0
- data/lib/roo/excelx.rb +8 -6
- data/lib/roo/generic_spreadsheet.rb +0 -0
- data/lib/roo/google.rb +0 -0
- data/lib/roo/openoffice.rb +0 -0
- data/lib/roo/roo_rails_helper.rb +0 -0
- data/lib/roo/version.rb +1 -1
- data/scripts/txt2html +0 -0
- data/setup.rb +0 -0
- data/test/Bibelbund.csv +0 -0
- data/test/Bibelbund.ods +0 -0
- data/test/Bibelbund.xls +0 -0
- data/test/Bibelbund1.ods +0 -0
- data/test/bbu.ods +0 -0
- data/test/bbu.xls +0 -0
- data/test/bbu.xlsx +0 -0
- data/test/bode-v1.ods.zip +0 -0
- data/test/bode-v1.xls.zip +0 -0
- data/test/borders.ods +0 -0
- data/test/borders.xls +0 -0
- data/test/borders.xlsx +0 -0
- data/test/bug-row-column-fixnum-float.xls +0 -0
- data/test/formula.ods +0 -0
- data/test/formula.xls +0 -0
- data/test/formula.xlsx +0 -0
- data/test/no_spreadsheet_file.txt +0 -0
- data/test/numbers1.csv +0 -0
- data/test/numbers1.ods +0 -0
- data/test/numbers1.xls +0 -0
- data/test/numbers1.xlsx +0 -0
- data/test/numbers1_excel.csv +0 -0
- data/test/only_one_sheet.ods +0 -0
- data/test/only_one_sheet.xls +0 -0
- data/test/only_one_sheet.xlsx +0 -0
- data/test/ric.ods +0 -0
- data/test/simple_spreadsheet.ods +0 -0
- data/test/simple_spreadsheet.xls +0 -0
- data/test/simple_spreadsheet.xlsx +0 -0
- data/test/simple_spreadsheet_from_italo.ods +0 -0
- data/test/simple_spreadsheet_from_italo.xls +0 -0
- data/test/test_helper.rb +0 -0
- data/test/test_roo.rb +91 -13
- data/test/time-test.csv +0 -0
- data/test/time-test.ods +0 -0
- data/test/time-test.xls +0 -0
- data/test/time-test.xlsx +0 -0
- data/website/index.html +1 -1
- data/website/index.txt +0 -0
- data/website/javascripts/rounded_corners_lite.inc.js +0 -0
- data/website/stylesheets/screen.css +0 -0
- data/website/template.rhtml +0 -0
- metadata +12 -2
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 1.0.2 2008-07-04
|
2
|
+
* 2 bugfixes
|
3
|
+
* Excelx: fixed a bug when there are .xml.rels files in the XLSX archive
|
4
|
+
* Excelx: fixed a bug with celltype recognition (see comment with "2008-07-03")
|
1
5
|
== 1.0.1 2008-06-30
|
2
6
|
* 1 bugfix
|
3
7
|
* Excel: row/column method Fixnum/Float confusion
|
data/License.txt
CHANGED
File without changes
|
data/Manifest.txt
CHANGED
File without changes
|
data/README.txt
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/base64include.rb
CHANGED
File without changes
|
data/examples/roo_soap_client.rb
CHANGED
File without changes
|
data/examples/roo_soap_server.rb
CHANGED
File without changes
|
data/examples/write_me.rb
CHANGED
File without changes
|
data/lib/roo.rb
CHANGED
File without changes
|
data/lib/roo/excel.rb
CHANGED
File without changes
|
data/lib/roo/excelx.rb
CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
|
|
5
5
|
require 'zip/zipfilesystem'
|
6
6
|
require 'date'
|
7
7
|
#require 'base64'
|
8
|
-
|
8
|
+
require 'logger'
|
9
9
|
class String
|
10
10
|
def end_with?(str)
|
11
11
|
self[-str.length,str.length] == str
|
@@ -13,7 +13,8 @@ class String
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class Excelx < GenericSpreadsheet
|
16
|
-
|
16
|
+
#$log = Logger.new("excelx.log",5,100*1024)
|
17
|
+
#$log.level = Logger::DEBUG
|
17
18
|
@@nr = 0
|
18
19
|
|
19
20
|
# initialization and opening of a spreadsheet file
|
@@ -137,7 +138,7 @@ class Excelx < GenericSpreadsheet
|
|
137
138
|
sheet = @default_sheet unless sheet
|
138
139
|
read_cells(sheet) unless @cells_read[sheet]
|
139
140
|
row,col = normalize(row,col)
|
140
|
-
if @formula[sheet]["#{row},#{col}"]
|
141
|
+
if @formula and @formula[sheet] and @formula[sheet]["#{row},#{col}"]
|
141
142
|
return :formula
|
142
143
|
else
|
143
144
|
@cell_type[sheet]["#{row},#{col}"]
|
@@ -292,7 +293,7 @@ class Excelx < GenericSpreadsheet
|
|
292
293
|
end
|
293
294
|
if row.attributes['s'] == '2'
|
294
295
|
tmp_type = :date
|
295
|
-
elsif row.attributes['s'] == '1'
|
296
|
+
elsif row.attributes['s'] == '1' and row.attributes['t'] == nil # and ergaenzt 2008-07-03
|
296
297
|
tmp_type = :formula
|
297
298
|
end
|
298
299
|
formula = nil
|
@@ -323,8 +324,9 @@ class Excelx < GenericSpreadsheet
|
|
323
324
|
v = cell.text
|
324
325
|
end
|
325
326
|
x,y = split_coordinate(row.attributes['r'])
|
326
|
-
tr=nil #TODO: ???
|
327
|
+
tr=nil #TODO: ???s
|
327
328
|
set_cell_values(sheet,x,y,0,v,vt,formula,tr,str_v)
|
329
|
+
#$log.debug "#{sheet},#{x},#{y},0,#{v},#{vt},#{formula},#{tr},#{str_v})"
|
328
330
|
end
|
329
331
|
end
|
330
332
|
end
|
@@ -378,7 +380,7 @@ class Excelx < GenericSpreadsheet
|
|
378
380
|
f << zip.read(entry)
|
379
381
|
}
|
380
382
|
end
|
381
|
-
if entry.to_s =~ /sheet([0-9]+).xml
|
383
|
+
if entry.to_s =~ /sheet([0-9]+).xml$/
|
382
384
|
nr = $1
|
383
385
|
# entry.extract("xaxa_sheet#{nr}.xml")
|
384
386
|
open(@tmpdir+'/'+@file_nr.to_s+"_roo_sheet#{nr}",'wb') {|f|
|
File without changes
|
data/lib/roo/google.rb
CHANGED
File without changes
|
data/lib/roo/openoffice.rb
CHANGED
File without changes
|
data/lib/roo/roo_rails_helper.rb
CHANGED
File without changes
|
data/lib/roo/version.rb
CHANGED
data/scripts/txt2html
CHANGED
File without changes
|
data/setup.rb
CHANGED
File without changes
|
data/test/Bibelbund.csv
CHANGED
File without changes
|
data/test/Bibelbund.ods
CHANGED
File without changes
|
data/test/Bibelbund.xls
CHANGED
File without changes
|
data/test/Bibelbund1.ods
CHANGED
File without changes
|
data/test/bbu.ods
CHANGED
File without changes
|
data/test/bbu.xls
CHANGED
File without changes
|
data/test/bbu.xlsx
CHANGED
File without changes
|
data/test/bode-v1.ods.zip
CHANGED
File without changes
|
data/test/bode-v1.xls.zip
CHANGED
File without changes
|
data/test/borders.ods
CHANGED
File without changes
|
data/test/borders.xls
CHANGED
File without changes
|
data/test/borders.xlsx
CHANGED
File without changes
|
File without changes
|
data/test/formula.ods
CHANGED
File without changes
|
data/test/formula.xls
CHANGED
File without changes
|
data/test/formula.xlsx
CHANGED
File without changes
|
File without changes
|
data/test/numbers1.csv
CHANGED
File without changes
|
data/test/numbers1.ods
CHANGED
File without changes
|
data/test/numbers1.xls
CHANGED
File without changes
|
data/test/numbers1.xlsx
CHANGED
File without changes
|
data/test/numbers1_excel.csv
CHANGED
File without changes
|
data/test/only_one_sheet.ods
CHANGED
File without changes
|
data/test/only_one_sheet.xls
CHANGED
File without changes
|
data/test/only_one_sheet.xlsx
CHANGED
File without changes
|
data/test/ric.ods
CHANGED
File without changes
|
data/test/simple_spreadsheet.ods
CHANGED
File without changes
|
data/test/simple_spreadsheet.xls
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/test_helper.rb
CHANGED
File without changes
|
data/test/test_roo.rb
CHANGED
@@ -3098,19 +3098,19 @@ class TestRoo < Test::Unit::TestCase
|
|
3098
3098
|
end
|
3099
3099
|
|
3100
3100
|
def test_simple_spreadsheet_find_by_condition_excel
|
3101
|
-
if EXCEL
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
end
|
3101
|
+
if EXCEL
|
3102
|
+
oo = Excel.new(File.join("test","simple_spreadsheet.xls"))
|
3103
|
+
oo.default_sheet = oo.sheets.first
|
3104
|
+
oo.header_line = 3
|
3105
|
+
erg = oo.find(:all, :conditions => {'Comment' => 'Task 1'})
|
3106
|
+
assert_equal Date.new(2007,05,07), erg[1]['Date']
|
3107
|
+
assert_equal 10.75 , erg[1]['Start time']
|
3108
|
+
assert_equal 12.50 , erg[1]['End time']
|
3109
|
+
assert_equal 0 , erg[1]['Pause']
|
3110
|
+
#cannot be tested because excel cannot return the result of formulas:
|
3111
|
+
# assert_equal 1.75 , erg[1]['Sum']
|
3112
|
+
assert_equal "Task 1" , erg[1]['Comment']
|
3113
|
+
end
|
3114
3114
|
end
|
3115
3115
|
|
3116
3116
|
def test_simple_spreadsheet_find_by_condition_excelx
|
@@ -4097,4 +4097,82 @@ Sheet 3:
|
|
4097
4097
|
assert_equal ['def',42.5, 'nop'], ex.column(2)
|
4098
4098
|
|
4099
4099
|
end
|
4100
|
+
|
4101
|
+
def test_bug_c2
|
4102
|
+
@e = Excel.new(File.join('test',"problem.xls"))
|
4103
|
+
#@e.sheets[2..@e.sheets.length].each do |s|
|
4104
|
+
(13..13).each do |s|
|
4105
|
+
@e.default_sheet = s
|
4106
|
+
name = @e.cell(2,'C')
|
4107
|
+
#puts "#{name} (sheet: #{s})"
|
4108
|
+
assert_equal "whatever (sheet: 13)", "#{name} (sheet: #{s})"
|
4109
|
+
end
|
4110
|
+
end
|
4111
|
+
|
4112
|
+
def test_bug_c2_parseexcel
|
4113
|
+
#-- this is OK
|
4114
|
+
@workbook = Spreadsheet::ParseExcel.parse(File.join('test',"problem.xls"))
|
4115
|
+
worksheet = @workbook.worksheet(11)
|
4116
|
+
skip = 0
|
4117
|
+
line = 1
|
4118
|
+
row = 2
|
4119
|
+
col = 3
|
4120
|
+
worksheet.each(skip) { |row_par|
|
4121
|
+
if line == row
|
4122
|
+
if row_par == nil
|
4123
|
+
raise "nil"
|
4124
|
+
end
|
4125
|
+
cell = row_par.at(col-1)
|
4126
|
+
assert cell, "cell should not be nil"
|
4127
|
+
assert_equal "Air", cell.to_s('utf-8')
|
4128
|
+
end
|
4129
|
+
line += 1
|
4130
|
+
}
|
4131
|
+
#-- worksheet 12 does not work
|
4132
|
+
@workbook = Spreadsheet::ParseExcel.parse(File.join('test',"problem.xls"))
|
4133
|
+
worksheet = @workbook.worksheet(12)
|
4134
|
+
skip = 0
|
4135
|
+
line = 1
|
4136
|
+
row = 2
|
4137
|
+
col = 3
|
4138
|
+
worksheet.each(skip) { |row_par|
|
4139
|
+
if line == row
|
4140
|
+
if row_par == nil
|
4141
|
+
raise "nil"
|
4142
|
+
end
|
4143
|
+
cell = row_par.at(col-1)
|
4144
|
+
assert cell, "cell should not be nil"
|
4145
|
+
assert_equal "Elite", cell.to_s('utf-8')
|
4146
|
+
end
|
4147
|
+
line += 1
|
4148
|
+
}
|
4149
|
+
end
|
4150
|
+
|
4151
|
+
def test_bug_c2_excelx
|
4152
|
+
expected = ['Vapor']
|
4153
|
+
result = []
|
4154
|
+
@e = Excelx.new(File.join('test',"problem.xlsx"))
|
4155
|
+
@e.sheets[2..@e.sheets.length].each do |s|
|
4156
|
+
@e.default_sheet = s
|
4157
|
+
# assert_equal "A.",@e.cell('a',13)
|
4158
|
+
name = @e.cell(2,'C',s)
|
4159
|
+
result << name
|
4160
|
+
#puts "#{name} (sheet: #{s})"
|
4161
|
+
#assert_equal :string, @e.celltype('c',2)
|
4162
|
+
#assert_equal "Vapor (sheet: Vapor)", "#{name} (sheet: #{@e.sheets.first})"
|
4163
|
+
assert @e.cell(2,'c')
|
4164
|
+
end
|
4165
|
+
#assert_equal expected, result
|
4166
|
+
|
4167
|
+
@e = Excelx.new(File.join('test',"problem.xlsx"))
|
4168
|
+
#@e.sheets[2..@e.sheets.length].each do |s|
|
4169
|
+
(13..13).each do |s|
|
4170
|
+
@e.default_sheet = s
|
4171
|
+
name = @e.cell(2,'C')
|
4172
|
+
#puts "#{name} (sheet: #{s})"
|
4173
|
+
assert_equal "Elite (sheet: 13)", "#{name} (sheet: #{s})"
|
4174
|
+
end
|
4175
|
+
end
|
4176
|
+
|
4177
|
+
|
4100
4178
|
end # class
|
data/test/time-test.csv
CHANGED
File without changes
|
data/test/time-test.ods
CHANGED
File without changes
|
data/test/time-test.xls
CHANGED
File without changes
|
data/test/time-test.xlsx
CHANGED
File without changes
|
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">1.0.
|
36
|
+
<a href="http://rubyforge.org/projects/roo" class="numbers">1.0.2</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
data/website/index.txt
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/website/template.rhtml
CHANGED
File without changes
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-
|
12
|
+
date: 2008-07-04 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,6 +52,16 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.0.3
|
54
54
|
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hoe
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.7.0
|
64
|
+
version:
|
55
65
|
description: roo can access the contents of OpenOffice-, Excel- or Google-Spreadsheets
|
56
66
|
email: thopre@gmail.com
|
57
67
|
executables: []
|