robust_excel_ole 1.15 → 1.18.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.
- checksums.yaml +4 -4
- data/Changelog +27 -0
- data/README.rdoc +18 -1
- data/___dummy_workbook.xls +0 -0
- data/docs/README_excel.rdoc +6 -0
- data/docs/README_open.rdoc +18 -2
- data/docs/README_ranges.rdoc +11 -2
- data/examples/example_ruby_library.rb +27 -0
- data/extconf.rb +13 -0
- data/lib/robust_excel_ole.rb +4 -3
- data/lib/robust_excel_ole/{address.rb → address_tool.rb} +23 -22
- data/lib/robust_excel_ole/{reo_common.rb → base.rb} +2 -90
- data/lib/robust_excel_ole/bookstore.rb +14 -77
- data/lib/robust_excel_ole/cell.rb +30 -18
- data/lib/robust_excel_ole/excel.rb +71 -41
- data/lib/robust_excel_ole/general.rb +39 -14
- data/lib/robust_excel_ole/range.rb +42 -19
- data/lib/robust_excel_ole/range_owners.rb +40 -25
- data/lib/robust_excel_ole/vba_objects.rb +30 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- data/lib/robust_excel_ole/workbook.rb +241 -235
- data/lib/robust_excel_ole/worksheet.rb +42 -21
- data/lib/rubygems_plugin.rb +3 -0
- data/robust_excel_ole.gemspec +1 -0
- data/spec/address_tool_spec.rb +175 -0
- data/spec/{reo_common_spec.rb → base_spec.rb} +11 -30
- data/spec/bookstore_spec.rb +3 -3
- data/spec/cell_spec.rb +67 -25
- data/spec/data/more_data/workbook.xls +0 -0
- data/spec/excel_spec.rb +41 -275
- data/spec/general_spec.rb +17 -23
- data/spec/range_spec.rb +57 -3
- data/spec/workbook_spec.rb +7 -75
- data/spec/workbook_specs/workbook_misc_spec.rb +11 -21
- data/spec/workbook_specs/workbook_open_spec.rb +570 -30
- data/spec/workbook_specs/workbook_unobtr_spec.rb +33 -33
- data/spec/worksheet_spec.rb +36 -4
- metadata +10 -6
- data/spec/address_spec.rb +0 -174
@@ -28,17 +28,18 @@ module RobustExcelOle
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def workbook
|
31
|
-
|
32
|
-
begin
|
31
|
+
@workbook ||= begin
|
33
32
|
ole_workbook = self.Parent
|
34
33
|
saved_status = ole_workbook.Saved
|
35
34
|
ole_workbook.Saved = true unless saved_status
|
36
35
|
@workbook = workbook_class.new(ole_workbook)
|
37
36
|
ole_workbook.Saved = saved_status
|
38
|
-
|
39
|
-
nil
|
37
|
+
@workbook
|
40
38
|
end
|
41
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
def excel
|
42
|
+
workbook.excel
|
42
43
|
end
|
43
44
|
|
44
45
|
# sheet name
|
@@ -70,7 +71,7 @@ module RobustExcelOle
|
|
70
71
|
xy = "#{x}_#{y}"
|
71
72
|
@cells = { }
|
72
73
|
begin
|
73
|
-
@cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y))
|
74
|
+
@cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y), @worksheet)
|
74
75
|
rescue
|
75
76
|
raise RangeNotEvaluatable, "cannot read cell (#{x.inspect},#{y.inspect})"
|
76
77
|
end
|
@@ -93,10 +94,7 @@ module RobustExcelOle
|
|
93
94
|
else
|
94
95
|
name, value = p1, p2
|
95
96
|
begin
|
96
|
-
|
97
|
-
workbook.color_if_modified = 42 # aqua-marin
|
98
|
-
set_namevalue_glob(name, value)
|
99
|
-
workbook.color_if_modified = old_color_if_modified
|
97
|
+
set_namevalue_glob(name, value, :color => 42)
|
100
98
|
rescue REOError
|
101
99
|
begin
|
102
100
|
workbook.set_namevalue_glob(name, value)
|
@@ -110,24 +108,34 @@ module RobustExcelOle
|
|
110
108
|
# value of a cell, if row and column are given
|
111
109
|
# @params row and column
|
112
110
|
# @returns value of the cell
|
111
|
+
def cellval(x,y)
|
112
|
+
xy = "#{x}_#{y}"
|
113
|
+
begin
|
114
|
+
@ole_worksheet.Cells.Item(x, y).Value
|
115
|
+
rescue
|
116
|
+
raise RangeNotEvaluatable, "cannot read cell (#{p1.inspect},#{p2.inspect})"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
=begin
|
113
121
|
def cellval(x,y)
|
114
122
|
xy = "#{x}_#{y}"
|
115
123
|
@cells = { }
|
116
124
|
begin
|
117
|
-
@cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y))
|
125
|
+
@cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y), @worksheet)
|
118
126
|
@cells[xy].Value
|
119
127
|
rescue
|
120
128
|
raise RangeNotEvaluatable, "cannot read cell (#{p1.inspect},#{p2.inspect})"
|
121
129
|
end
|
122
130
|
end
|
131
|
+
=end
|
123
132
|
|
124
133
|
# sets the value of a cell, if row, column and color of the cell are given
|
125
134
|
# @params [Integer] x,y row and column
|
126
135
|
# @option opts [Symbol] :color the color of the cell when set
|
127
136
|
def set_cellval(x,y,value, opts = { }) # option opts is deprecated
|
128
137
|
cell = @ole_worksheet.Cells.Item(x, y)
|
129
|
-
|
130
|
-
cell.Interior.ColorIndex = workbook.color_if_modified unless workbook.color_if_modified.nil?
|
138
|
+
cell.Interior.ColorIndex = opts[:color] unless opts[:color].nil?
|
131
139
|
cell.Value = value
|
132
140
|
rescue # WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException
|
133
141
|
raise RangeNotEvaluatable, "cannot assign value #{value.inspect} to cell (#{y.inspect},#{x.inspect})"
|
@@ -151,17 +159,31 @@ module RobustExcelOle
|
|
151
159
|
end
|
152
160
|
end
|
153
161
|
|
162
|
+
def each_value
|
163
|
+
@ole_worksheet.UsedRange.Value.each do |row_values|
|
164
|
+
yield row_values
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def each_value_with_index(offset = 0)
|
169
|
+
i = offset
|
170
|
+
@ole_worksheet.UsedRange.Value.each do |row_values|
|
171
|
+
yield row_values, i
|
172
|
+
i += 1
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
154
176
|
def each_row(offset = 0)
|
155
177
|
offset += 1
|
156
178
|
1.upto(@end_row) do |row|
|
157
179
|
next if row < offset
|
158
|
-
yield RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(row, 1), @ole_worksheet.Cells(row, @end_column)))
|
180
|
+
yield RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(row, 1), @ole_worksheet.Cells(row, @end_column)), self)
|
159
181
|
end
|
160
182
|
end
|
161
183
|
|
162
184
|
def each_row_with_index(offset = 0)
|
163
185
|
each_row(offset) do |row_range|
|
164
|
-
yield RobustExcelOle::Range.new(row_range), (row_range.Row - 1 - offset)
|
186
|
+
yield RobustExcelOle::Range.new(row_range, self), (row_range.Row - 1 - offset)
|
165
187
|
end
|
166
188
|
end
|
167
189
|
|
@@ -169,24 +191,24 @@ module RobustExcelOle
|
|
169
191
|
offset += 1
|
170
192
|
1.upto(@end_column) do |column|
|
171
193
|
next if column < offset
|
172
|
-
yield RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(1, column), @ole_worksheet.Cells(@end_row, column)))
|
194
|
+
yield RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(1, column), @ole_worksheet.Cells(@end_row, column)), self)
|
173
195
|
end
|
174
196
|
end
|
175
197
|
|
176
198
|
def each_column_with_index(offset = 0)
|
177
199
|
each_column(offset) do |column_range|
|
178
|
-
yield RobustExcelOle::Range.new(column_range), (column_range.Column - 1 - offset)
|
200
|
+
yield RobustExcelOle::Range.new(column_range, self), (column_range.Column - 1 - offset)
|
179
201
|
end
|
180
202
|
end
|
181
203
|
|
182
204
|
def row_range(row, integer_range = nil)
|
183
205
|
integer_range ||= 1..@end_column
|
184
|
-
RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(row, integer_range.min), @ole_worksheet.Cells(row, integer_range.max)))
|
206
|
+
RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(row, integer_range.min), @ole_worksheet.Cells(row, integer_range.max)), self)
|
185
207
|
end
|
186
208
|
|
187
209
|
def col_range(col, integer_range = nil)
|
188
210
|
integer_range ||= 1..@end_row
|
189
|
-
RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(integer_range.min, col), @ole_worksheet.Cells(integer_range.max, col)))
|
211
|
+
RobustExcelOle::Range.new(@ole_worksheet.Range(@ole_worksheet.Cells(integer_range.min, col), @ole_worksheet.Cells(integer_range.max, col)), self)
|
190
212
|
end
|
191
213
|
|
192
214
|
def == other_worksheet
|
@@ -222,10 +244,9 @@ module RobustExcelOle
|
|
222
244
|
|
223
245
|
private
|
224
246
|
|
225
|
-
# @private
|
226
247
|
def method_missing(name, *args)
|
227
248
|
if name.to_s[0,1] =~ /[A-Z]/
|
228
|
-
if ::
|
249
|
+
if ::ERRORMESSAGE_JRUBY_BUG
|
229
250
|
begin
|
230
251
|
@ole_worksheet.send(name, *args)
|
231
252
|
rescue Java::OrgRacobCom::ComFailException
|
data/robust_excel_ole.gemspec
CHANGED
@@ -0,0 +1,175 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), './spec_helper')
|
4
|
+
require File.expand_path( '../../lib/robust_excel_ole/base', __FILE__)
|
5
|
+
|
6
|
+
$VERBOSE = nil
|
7
|
+
|
8
|
+
include General
|
9
|
+
include RobustExcelOle
|
10
|
+
|
11
|
+
module RobustExcelOle
|
12
|
+
|
13
|
+
describe AddressTool do
|
14
|
+
|
15
|
+
before(:all) do
|
16
|
+
excel = Excel.new(:reuse => true)
|
17
|
+
open_books = excel == nil ? 0 : excel.Workbooks.Count
|
18
|
+
puts "*** open books *** : #{open_books}" if open_books > 0
|
19
|
+
Excel.kill_all
|
20
|
+
@dir = create_tmpdir
|
21
|
+
@simple_file = @dir + '/workbook.xls'
|
22
|
+
@workbook = Workbook.open(@simple_file)
|
23
|
+
@address_tool = @workbook.excel.address_tool
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:all) do
|
27
|
+
@workbook.close
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should transform relative r1c1-reference into r1c1-format" do
|
31
|
+
@address_tool.as_r1c1("Z1S[2]:Z[-1]S4").should == "Z1S(2):Z(-1)S4"
|
32
|
+
@address_tool.as_r1c1("Z[1]S2:Z3S[4]").should == "Z(1)S2:Z3S(4)"
|
33
|
+
@address_tool.as_r1c1("Z1S[2]").should == "Z1S(2)"
|
34
|
+
@address_tool.as_r1c1("Z[-1]S4").should == "Z(-1)S4"
|
35
|
+
@address_tool.as_r1c1("Z[3]").should == "Z(3)"
|
36
|
+
@address_tool.as_r1c1("S[-2]").should == "S(-2)"
|
37
|
+
end
|
38
|
+
|
39
|
+
# test for 1.8.6
|
40
|
+
it "should transform relative integer_ranges-format into r1c1-format" do
|
41
|
+
@address_tool.as_r1c1([1..2,[3]..4]).should == "Z1S(3):Z2S4"
|
42
|
+
@address_tool.as_r1c1([[1]..2,3..4]).should == "Z(1)S3:Z2S4"
|
43
|
+
@address_tool.as_r1c1([[1]..2,nil]).should == "Z(1):Z2"
|
44
|
+
@address_tool.as_r1c1([nil,[1]..2]).should == "S(1):S2"
|
45
|
+
@address_tool.as_r1c1([nil,[1]]).should == "S(1):S(1)"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should transform relative integer_ranges-format into r1c1-format" do
|
49
|
+
@address_tool.as_r1c1([1..[-2],[3]..4]).should == "Z1S(3):Z(-2)S4"
|
50
|
+
@address_tool.as_r1c1([[1]..2,3..[4]]).should == "Z(1)S3:Z2S(4)"
|
51
|
+
@address_tool.as_r1c1([1..[-2],nil]).should == "Z1:Z(-2)"
|
52
|
+
@address_tool.as_r1c1([nil,[-1]..2]).should == "S(-1):S2"
|
53
|
+
@address_tool.as_r1c1([[3]..[3],nil]).should == "Z(3):Z(3)"
|
54
|
+
@address_tool.as_r1c1([nil,[-2]..[-2]]).should == "S(-2):S(-2)"
|
55
|
+
@address_tool.as_r1c1([[3],nil]).should == "Z(3):Z(3)"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should transform relative r1c1-format into r1c1-format" do
|
59
|
+
@address_tool.as_integer_ranges("Z1S[2]:Z[3]S4").should == [1..[3],[2]..4]
|
60
|
+
@address_tool.as_integer_ranges("Z[1]S2:Z3S[4]").should == [[1]..3,2..[4]]
|
61
|
+
@address_tool.as_integer_ranges("Z1S[2]").should == [1..1,[2]..[2]]
|
62
|
+
@address_tool.as_integer_ranges("Z[3]S4").should == [[3]..[3],4..4]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should transform a1-format" do
|
66
|
+
@address_tool.as_a1("A2").should == "A2"
|
67
|
+
@address_tool.as_r1c1("A2").should == "Z2S1:Z2S1"
|
68
|
+
@address_tool.as_integer_ranges("A2").should == [2..2,1..1]
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should transform several-letter-a1-format" do
|
72
|
+
@address_tool.as_a1("ABO15").should == "ABO15"
|
73
|
+
@address_tool.as_r1c1("ABO15").should == "Z15S743:Z15S743"
|
74
|
+
@address_tool.as_integer_ranges("ABO15").should == [15..15,743..743]
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should transform complex a1-format" do
|
78
|
+
@address_tool.as_a1("A2:B3").should == "A2:B3"
|
79
|
+
@address_tool.as_r1c1("A2:B3").should == "Z2S1:Z3S2"
|
80
|
+
@address_tool.as_integer_ranges("A2:B3").should == [2..3,1..2]
|
81
|
+
@address_tool.as_a1("S1:DP2").should == "S1:DP2"
|
82
|
+
@address_tool.as_r1c1("S1:DP2").should == "Z1S19:Z2S120"
|
83
|
+
@address_tool.as_integer_ranges("S1:DP2").should == [1..2,19..120]
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should transform infinite a1-format" do
|
87
|
+
@address_tool.as_a1("A:B").should == "A:B"
|
88
|
+
@address_tool.as_r1c1("A:B").should == "S1:S2"
|
89
|
+
@address_tool.as_integer_ranges("A:B").should == [nil,1..2]
|
90
|
+
@address_tool.as_a1("1:3").should == "1:3"
|
91
|
+
@address_tool.as_r1c1("1:3").should == "Z1:Z3"
|
92
|
+
@address_tool.as_integer_ranges("1:3").should == [1..3,nil]
|
93
|
+
@address_tool.as_a1("B").should == "B"
|
94
|
+
@address_tool.as_r1c1("B").should == "S2:S2"
|
95
|
+
@address_tool.as_integer_ranges("B").should == [nil,2..2]
|
96
|
+
@address_tool.as_a1("3").should == "3"
|
97
|
+
@address_tool.as_r1c1("3").should == "Z3:Z3"
|
98
|
+
@address_tool.as_integer_ranges("3").should == [3..3,nil]
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should transform r1c1-format" do
|
102
|
+
@address_tool.as_r1c1("Z2S1").should == "Z2S1"
|
103
|
+
@address_tool.as_integer_ranges("Z2S1").should == [2..2,1..1]
|
104
|
+
expect{
|
105
|
+
@address_tool.as_a1("Z2S1")
|
106
|
+
}.to raise_error(NotImplementedREOError)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should transform complex r1c1-format" do
|
110
|
+
@address_tool.as_r1c1("Z2S1:Z3S2").should == "Z2S1:Z3S2"
|
111
|
+
@address_tool.as_integer_ranges("Z2S1:Z3S2").should == [2..3,1..2]
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should transform as_integer_ranges format" do
|
115
|
+
@address_tool.as_integer_ranges([2..2,1..1]).should == [2..2,1..1]
|
116
|
+
@address_tool.as_r1c1([2..2,1..1]).should == "Z2S1:Z2S1"
|
117
|
+
expect{
|
118
|
+
@address_tool.as_a1([2..2,1..1])
|
119
|
+
}.to raise_error(NotImplementedREOError)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should transform simple as_integer_ranges format" do
|
123
|
+
@address_tool.as_integer_ranges([2,1]).should == [2..2,1..1]
|
124
|
+
@address_tool.as_r1c1([2,1]).should == "Z2S1:Z2S1"
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should transform complex as_integer_ranges format" do
|
128
|
+
@address_tool.as_integer_ranges([2,"A"]).should == [2..2,1..1]
|
129
|
+
@address_tool.as_r1c1([2,"A"]).should == "Z2S1:Z2S1"
|
130
|
+
@address_tool.as_integer_ranges([2,"A".."B"]).should == [2..2,1..2]
|
131
|
+
@address_tool.as_r1c1([2,"A".."B"]).should == "Z2S1:Z2S2"
|
132
|
+
@address_tool.as_integer_ranges([1..2,"C"]).should == [1..2,3..3]
|
133
|
+
@address_tool.as_r1c1([1..2,"C"]).should == "Z1S3:Z2S3"
|
134
|
+
@address_tool.as_integer_ranges([1..2,"C".."E"]).should == [1..2,3..5]
|
135
|
+
@address_tool.as_r1c1([1..2,"C".."E"]).should == "Z1S3:Z2S5"
|
136
|
+
@address_tool.as_integer_ranges([2,3..5]).should == [2..2,3..5]
|
137
|
+
@address_tool.as_r1c1([2,3..5]).should == "Z2S3:Z2S5"
|
138
|
+
@address_tool.as_integer_ranges([1..2,3..5]).should == [1..2,3..5]
|
139
|
+
@address_tool.as_r1c1([1..2,3..5]).should == "Z1S3:Z2S5"
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should transform infinite as_integer_ranges format" do
|
143
|
+
@address_tool.as_integer_ranges([nil,1..2]).should == [nil,1..2]
|
144
|
+
@address_tool.as_r1c1([nil,1..2]).should == "S1:S2"
|
145
|
+
@address_tool.as_integer_ranges([1..3,nil]).should == [1..3,nil]
|
146
|
+
@address_tool.as_r1c1([1..3,nil]).should == "Z1:Z3"
|
147
|
+
@address_tool.as_integer_ranges([nil,2]).should == [nil,2..2]
|
148
|
+
@address_tool.as_r1c1([nil,2]).should == "S2:S2"
|
149
|
+
@address_tool.as_integer_ranges([3,nil]).should == [3..3,nil]
|
150
|
+
@address_tool.as_r1c1([3,nil]).should == "Z3:Z3"
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should raise an error" do
|
154
|
+
expect{
|
155
|
+
@address_tool.as_a1("1A")
|
156
|
+
}.to raise_error(AddressInvalid, /format not correct/)
|
157
|
+
expect{
|
158
|
+
@address_tool.as_r1c1("A1B")
|
159
|
+
}.to raise_error(AddressInvalid, /format not correct/)
|
160
|
+
#expect{
|
161
|
+
# @address_tool.as_integer_ranges(["A".."B","C".."D"])
|
162
|
+
#}.to raise_error(AddressInvalid, /format not correct/)
|
163
|
+
#expect{
|
164
|
+
# @address_tool.as_integer_ranges(["A".."B",1..2])
|
165
|
+
#}.to raise_error(AddressInvalid, /format not correct/)
|
166
|
+
#expect{
|
167
|
+
# @address_tool.as_integer_ranges(["A".."B",nil])
|
168
|
+
#}.to raise_error(AddressInvalid, /format not correct/)
|
169
|
+
expect{
|
170
|
+
@address_tool.as_integer_ranges(["A",1,2])
|
171
|
+
}.to raise_error(AddressInvalid, /more than two components/)
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
require File.join(File.dirname(__FILE__), './spec_helper')
|
4
|
-
require File.expand_path( '../../lib/robust_excel_ole/
|
4
|
+
require File.expand_path( '../../lib/robust_excel_ole/base', __FILE__)
|
5
5
|
|
6
6
|
$VERBOSE = nil
|
7
7
|
|
@@ -10,7 +10,7 @@ include RobustExcelOle
|
|
10
10
|
|
11
11
|
module RobustExcelOle
|
12
12
|
|
13
|
-
describe
|
13
|
+
describe Base do
|
14
14
|
|
15
15
|
before(:all) do
|
16
16
|
excel = Excel.new(:reuse => true)
|
@@ -40,12 +40,12 @@ module RobustExcelOle
|
|
40
40
|
|
41
41
|
it "should put some number" do
|
42
42
|
a = 4
|
43
|
-
|
43
|
+
Base::trace "some text #{a}"
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should put another text" do
|
47
47
|
b = Workbook.open(@simple_file)
|
48
|
-
|
48
|
+
Base::trace "book: #{b}"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -63,7 +63,7 @@ module RobustExcelOle
|
|
63
63
|
["ActiveCell", "ActiveSheet", "ActiveWorkbook", "Application", "Calculate", "Cells", "Columns",
|
64
64
|
"DisplayAlerts", "Evaluate", "Hwnd", "Name", "Names", "Quit", "Range", "Ready", "Save",
|
65
65
|
"Sheets", "UserName", "Value", "Visible", "Workbooks", "Worksheets"]
|
66
|
-
@excel_methods = ["alive?", "workbook_class", "close", "
|
66
|
+
@excel_methods = ["alive?", "workbook_class", "close", "properties", "recreate", "with_displayalerts"]
|
67
67
|
end
|
68
68
|
|
69
69
|
after do
|
@@ -82,45 +82,26 @@ module RobustExcelOle
|
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
|
-
describe "Object methods" do
|
86
|
-
|
87
|
-
before do
|
88
|
-
@book = Workbook.open(@simple_file)
|
89
|
-
@sheet = @book.sheet(1)
|
90
|
-
end
|
91
|
-
|
92
|
-
before do
|
93
|
-
@book.close
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should raise an error when asking excel of a sheet" do
|
97
|
-
expect{
|
98
|
-
@sheet.excel
|
99
|
-
}.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Workbook")
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
85
|
describe "misc" do
|
105
86
|
|
106
87
|
it "should" do
|
107
88
|
|
108
89
|
LOG_TO_STDOUT = true
|
109
|
-
|
90
|
+
Base::trace "foo"
|
110
91
|
|
111
92
|
LOG_TO_STDOUT = false
|
112
|
-
|
93
|
+
Base::trace "foo"
|
113
94
|
|
114
95
|
REO_LOG_DIR = ""
|
115
|
-
|
96
|
+
Base::trace "foo"
|
116
97
|
|
117
98
|
#REO_LOG_DIR = "C:"
|
118
|
-
#
|
99
|
+
#Base::trace "foo"
|
119
100
|
|
120
|
-
|
101
|
+
Base::tr1 "foo"
|
121
102
|
|
122
103
|
h = {:a => {:c => 4}, :b => 2}
|
123
|
-
|
104
|
+
Base::puts_hash(h)
|
124
105
|
|
125
106
|
end
|
126
107
|
|
data/spec/bookstore_spec.rb
CHANGED
@@ -159,7 +159,7 @@ describe Bookstore do
|
|
159
159
|
it "should not fetch anything to a not existing network path file" do
|
160
160
|
@book1 = Workbook.open(@hostname_share_path)
|
161
161
|
@bookstore.store(@book1)
|
162
|
-
|
162
|
+
#@bookstore.fetch(@network_path_not_existing).should == nil
|
163
163
|
end
|
164
164
|
|
165
165
|
# nice to have
|
@@ -175,7 +175,7 @@ describe Bookstore do
|
|
175
175
|
it "should not fetch anything to a not existing network path file the stored absolute path file" do
|
176
176
|
@book1 = Workbook.open(@absolute_file_path)
|
177
177
|
@bookstore.store(@book1)
|
178
|
-
|
178
|
+
#@bookstore.fetch(@network_path_not_existing).should == nil
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should fetch to a given hostname share path file the stored network path file" do
|
@@ -581,7 +581,7 @@ describe Bookstore do
|
|
581
581
|
end
|
582
582
|
|
583
583
|
it "should print books" do
|
584
|
-
@bookstore.
|
584
|
+
@bookstore.print_filename2books
|
585
585
|
end
|
586
586
|
|
587
587
|
end
|