robust_excel_ole 1.9 → 1.10
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/.gitignore +1 -0
- data/Changelog +6 -0
- data/README.rdoc +14 -0
- data/docs/README_ranges.rdoc +8 -0
- data/docs/README_sheet.rdoc +3 -1
- data/examples/modifying_sheets/example_access_sheets_and_cells.rb +1 -1
- data/examples/modifying_sheets/example_adding_sheets.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +1 -1
- data/jreo.bat +3 -0
- data/lib/jreo_console.rb +67 -0
- data/lib/robust_excel_ole.rb +5 -1
- data/lib/robust_excel_ole/address.rb +5 -1
- data/lib/robust_excel_ole/bookstore.rb +8 -0
- data/lib/robust_excel_ole/cell.rb +5 -5
- data/lib/robust_excel_ole/excel.rb +30 -11
- data/lib/robust_excel_ole/general.rb +0 -4
- data/lib/robust_excel_ole/range.rb +63 -15
- data/lib/robust_excel_ole/range_owners.rb +89 -39
- data/lib/robust_excel_ole/reo_common.rb +4 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- data/lib/robust_excel_ole/workbook.rb +55 -41
- data/spec/bookstore_spec.rb +43 -1
- data/spec/data/another_workbook.xls +0 -0
- data/spec/data/different_workbook.xls +0 -0
- data/spec/data/more_data/workbook.xls +0 -0
- data/spec/data/workbook.xls +0 -0
- data/spec/excel_spec.rb +3 -2
- data/spec/helpers/key_sender.rb +1 -0
- data/spec/range_spec.rb +50 -29
- data/spec/reo_common_spec.rb +0 -1
- data/spec/workbook_spec.rb +6 -6
- data/spec/workbook_specs/workbook_open_spec.rb +15 -14
- data/spec/workbook_specs/workbook_sheet_spec.rb +10 -1
- data/spec/workbook_specs/workbook_unobtr_spec.rb +2 -2
- metadata +5 -2
data/spec/range_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe RobustExcelOle::Range do
|
|
55
55
|
@sheet = @book.sheet(1)
|
56
56
|
@range = RobustExcelOle::Range.new(@sheet.ole_worksheet.UsedRange.Columns(1))
|
57
57
|
end
|
58
|
-
it { @range.values.should eq ['foo', 'foo', 'matz'] }
|
58
|
+
it { @range.values.should eq ['foo', 'foo', 'matz', nil] }
|
59
59
|
end
|
60
60
|
|
61
61
|
context "read 'merge_cells.xls'" do
|
@@ -103,32 +103,53 @@ describe RobustExcelOle::Range do
|
|
103
103
|
describe "#[]" do
|
104
104
|
context "access [0]" do
|
105
105
|
it { @range[0].should be_kind_of RobustExcelOle::Cell }
|
106
|
-
it { @range[0].
|
106
|
+
it { @range[0].v.should eq 'simple' }
|
107
107
|
end
|
108
108
|
|
109
109
|
context "access [2]" do
|
110
|
-
it { @range[2].
|
110
|
+
it { @range[2].v.should eq 'sheet2' }
|
111
111
|
end
|
112
112
|
|
113
113
|
context "access [0] and [1] and [2]" do
|
114
114
|
it "should get every values" do
|
115
|
-
@range[0].
|
116
|
-
@range[1].
|
117
|
-
@range[2].
|
115
|
+
@range[0].v.should eq 'simple'
|
116
|
+
@range[1].v.should eq 'file'
|
117
|
+
@range[2].v.should eq 'sheet2'
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
describe "#v" do
|
123
123
|
|
124
|
-
context "v" do
|
124
|
+
context "v, v=" do
|
125
|
+
|
126
|
+
before do
|
127
|
+
@sheet1 = @book.sheet(1)
|
128
|
+
end
|
129
|
+
|
130
|
+
after do
|
131
|
+
@book.close(:if_unsaved => :forget)
|
132
|
+
end
|
125
133
|
|
126
134
|
it "should return value" do
|
127
135
|
@sheet[1,1].v.should == 'simple'
|
128
136
|
@sheet.range(1..2,3..4).v.should == [["sheet2", nil], [nil, nil]]
|
129
137
|
end
|
130
|
-
end
|
131
138
|
|
139
|
+
it "should set value of a cell and return its value" do
|
140
|
+
@sheet1[2,3].v.should == "foobaaa"
|
141
|
+
@sheet1[2,3].Value.should == "foobaaa"
|
142
|
+
@sheet1[2,3].v = "bar"
|
143
|
+
@sheet1[2,3].v.should == "bar"
|
144
|
+
@sheet1[2,3].Value.should == "bar"
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should set value and return value of a rectangular range" do
|
148
|
+
@sheet1.range([1..2,3..5]).v.should == [["sheet1",nil,nil],["foobaaa",nil,nil]]
|
149
|
+
@sheet1.range([1..2,3..5]).v = [[1,2,3],[4,5,6]]
|
150
|
+
@sheet1.range([1..2,3..5]).v.should == [[1,2,3],[4,5,6]]
|
151
|
+
end
|
152
|
+
end
|
132
153
|
end
|
133
154
|
|
134
155
|
describe "#copy" do
|
@@ -152,61 +173,61 @@ describe RobustExcelOle::Range do
|
|
152
173
|
|
153
174
|
it "should copy range" do
|
154
175
|
@range1.copy([4,2])
|
155
|
-
@sheet1.range([4..5,2..4]).
|
176
|
+
@sheet1.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
156
177
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
157
178
|
end
|
158
179
|
|
159
180
|
it "should copy range when giving an address" do
|
160
181
|
@range1.copy([4..5,2..4])
|
161
|
-
@sheet1.range([4..5,2..4]).
|
182
|
+
@sheet1.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
162
183
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
163
184
|
end
|
164
185
|
|
165
186
|
it "should copy range to another worksheet of another workbook" do
|
166
187
|
@range1.copy([4,2], @sheet2)
|
167
|
-
@sheet2.range([4..5,2..4]).
|
188
|
+
@sheet2.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
168
189
|
@sheet2[4,2].Interior.ColorIndex.should == 4
|
169
190
|
end
|
170
191
|
|
171
192
|
it "should copy range to another worksheet of another workbook of another Excel instance" do
|
172
193
|
@range1.copy([4,2], @sheet3)
|
173
|
-
@sheet3.range([4..5,2..4]).
|
194
|
+
@sheet3.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
174
195
|
@sheet3[4,2].Interior.ColorIndex.should == 4
|
175
196
|
end
|
176
197
|
|
177
198
|
it "should copy values only" do
|
178
199
|
@range1.copy([4,2], @sheet1, :values_only => true)
|
179
|
-
@sheet1.range([4..5,2..4]).
|
200
|
+
@sheet1.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
180
201
|
@sheet1[4,2].Interior.ColorIndex.should == -4142
|
181
202
|
end
|
182
203
|
|
183
204
|
it "should copy values only to another worksheet of another Excel instance" do
|
184
205
|
@range1.copy([4,2], @sheet3, :values_only => true)
|
185
|
-
@sheet3.range([4..5,2..4]).
|
206
|
+
@sheet3.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
186
207
|
@sheet3[4,2].Interior.ColorIndex.should == -4142
|
187
208
|
end
|
188
209
|
|
189
210
|
it "should copy and transpose with values only" do
|
190
211
|
@range1.copy([4,2], @sheet1, :values_only => true, :transpose => true)
|
191
|
-
@sheet1.range([4..6,2..3]).
|
212
|
+
@sheet1.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
192
213
|
@sheet1[4,2].Interior.ColorIndex.should == -4142
|
193
214
|
end
|
194
215
|
|
195
216
|
it "should copy and transpose with values only into another Excel instance" do
|
196
217
|
@range1.copy([4,2], @sheet3, :values_only => true, :transpose => true)
|
197
|
-
@sheet3.range([4..6,2..3]).
|
218
|
+
@sheet3.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
198
219
|
@sheet3[4,2].Interior.ColorIndex.should == -4142
|
199
220
|
end
|
200
221
|
|
201
222
|
it "should copy and transpose" do
|
202
223
|
@range1.copy([4,2], @sheet1, :transpose => true)
|
203
|
-
@sheet1.range([4..6,2..3]).
|
224
|
+
@sheet1.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
204
225
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
205
226
|
end
|
206
227
|
|
207
228
|
it "should copy and transpose into another Excel instance" do
|
208
229
|
@range1.copy([4,2], @sheet3, :transpose => true)
|
209
|
-
@sheet3.range([4..6,2..3]).
|
230
|
+
@sheet3.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
210
231
|
@sheet3[4,2].Interior.ColorIndex.should == 4
|
211
232
|
end
|
212
233
|
end
|
@@ -232,61 +253,61 @@ describe RobustExcelOle::Range do
|
|
232
253
|
|
233
254
|
it "should copy range" do
|
234
255
|
@range1.copy(4,2)
|
235
|
-
@sheet1.range(4..5,2..4).
|
256
|
+
@sheet1.range(4..5,2..4).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
236
257
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
237
258
|
end
|
238
259
|
|
239
260
|
it "should copy range when giving an address" do
|
240
261
|
@range1.copy(4..5,2..4)
|
241
|
-
@sheet1.range([4..5,2..4]).
|
262
|
+
@sheet1.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
242
263
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
243
264
|
end
|
244
265
|
|
245
266
|
it "should copy range to another worksheet of another workbook" do
|
246
267
|
@range1.copy(4,2, @sheet2)
|
247
|
-
@sheet2.range([4..5,2..4]).
|
268
|
+
@sheet2.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
248
269
|
@sheet2[4,2].Interior.ColorIndex.should == 4
|
249
270
|
end
|
250
271
|
|
251
272
|
it "should copy range to another worksheet of another workbook of another Excel instance" do
|
252
273
|
@range1.copy(4,2, @sheet3)
|
253
|
-
@sheet3.range([4..5,2..4]).
|
274
|
+
@sheet3.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
254
275
|
@sheet3[4,2].Interior.ColorIndex.should == 4
|
255
276
|
end
|
256
277
|
|
257
278
|
it "should copy values only" do
|
258
279
|
@range1.copy(4,2, @sheet1, :values_only => true)
|
259
|
-
@sheet1.range([4..5,2..4]).
|
280
|
+
@sheet1.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
260
281
|
@sheet1[4,2].Interior.ColorIndex.should == -4142
|
261
282
|
end
|
262
283
|
|
263
284
|
it "should copy values only to another worksheet of another Excel instance" do
|
264
285
|
@range1.copy(4,2, @sheet3, :values_only => true)
|
265
|
-
@sheet3.range([4..5,2..4]).
|
286
|
+
@sheet3.range([4..5,2..4]).v.should == [["foo", "workbook", "sheet1"],["foo", nil, "foobaaa"]]
|
266
287
|
@sheet3[4,2].Interior.ColorIndex.should == -4142
|
267
288
|
end
|
268
289
|
|
269
290
|
it "should copy and transpose with values only" do
|
270
291
|
@range1.copy(4,2, @sheet1, :values_only => true, :transpose => true)
|
271
|
-
@sheet1.range([4..6,2..3]).
|
292
|
+
@sheet1.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
272
293
|
@sheet1[4,2].Interior.ColorIndex.should == -4142
|
273
294
|
end
|
274
295
|
|
275
296
|
it "should copy and transpose with values only into another Excel instance" do
|
276
297
|
@range1.copy(4,2, @sheet3, :values_only => true, :transpose => true)
|
277
|
-
@sheet3.range([4..6,2..3]).
|
298
|
+
@sheet3.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
278
299
|
@sheet3[4,2].Interior.ColorIndex.should == -4142
|
279
300
|
end
|
280
301
|
|
281
302
|
it "should copy and transpose" do
|
282
303
|
@range1.copy(4,2, @sheet1, :transpose => true)
|
283
|
-
@sheet1.range([4..6,2..3]).
|
304
|
+
@sheet1.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
284
305
|
@sheet1[4,2].Interior.ColorIndex.should == 4
|
285
306
|
end
|
286
307
|
|
287
308
|
it "should copy and transpose into another Excel instance" do
|
288
309
|
@range1.copy(4,2, @sheet3, :transpose => true)
|
289
|
-
@sheet3.range([4..6,2..3]).
|
310
|
+
@sheet3.range([4..6,2..3]).v.should == [["foo", "foo"],["workbook", nil],["sheet1","foobaaa"]]
|
290
311
|
@sheet3[4,2].Interior.ColorIndex.should == 4
|
291
312
|
end
|
292
313
|
|
@@ -294,7 +315,7 @@ describe RobustExcelOle::Range do
|
|
294
315
|
|
295
316
|
describe "#method_missing" do
|
296
317
|
it "can access COM method" do
|
297
|
-
@range.Range(@range.Cells.Item(1), @range.Cells.Item(3)).
|
318
|
+
@range.Range(@range.Cells.Item(1), @range.Cells.Item(3)).v.should eq [@range.values(0..2)]
|
298
319
|
end
|
299
320
|
|
300
321
|
context "unknown method" do
|
data/spec/reo_common_spec.rb
CHANGED
data/spec/workbook_spec.rb
CHANGED
@@ -669,7 +669,7 @@ describe Workbook do
|
|
669
669
|
|
670
670
|
context "with two running excel instances" do
|
671
671
|
before :all do
|
672
|
-
Excel.
|
672
|
+
Excel.kill_all
|
673
673
|
end
|
674
674
|
|
675
675
|
before do
|
@@ -691,17 +691,17 @@ describe Workbook do
|
|
691
691
|
Workbook.unobtrusively(@simple_file, :if_closed => :current) do |book|
|
692
692
|
book.should be_a Workbook
|
693
693
|
book.should be_alive
|
694
|
-
|
695
|
-
|
696
|
-
|
694
|
+
book.excel.should == @excel1
|
695
|
+
book.excel.should_not == @excel2
|
696
|
+
end
|
697
697
|
end
|
698
698
|
|
699
699
|
it "should open unobtrusively in a given Excel" do
|
700
700
|
Workbook.unobtrusively(@simple_file, :if_closed => @excel2) do |book|
|
701
701
|
book.should be_a Workbook
|
702
702
|
book.should be_alive
|
703
|
-
|
704
|
-
|
703
|
+
book.excel.should_not == @excel1
|
704
|
+
book.excel.should == @excel2
|
705
705
|
end
|
706
706
|
end
|
707
707
|
end
|
@@ -43,7 +43,8 @@ describe Workbook do
|
|
43
43
|
before do
|
44
44
|
@ole_excel1 = WIN32OLE.new('Excel.Application')
|
45
45
|
@ole_excel2 = WIN32OLE.new('Excel.Application')
|
46
|
-
|
46
|
+
#@ole_workbook1 = @ole_excel1.Workbooks.Open(@simple_file1, { 'ReadOnly' => false })
|
47
|
+
@ole_workbook1 = @ole_excel1.Workbooks.Open(@simple_file1, nil, false)
|
47
48
|
@ole_workbook1.Worksheets.Add
|
48
49
|
end
|
49
50
|
|
@@ -401,7 +402,7 @@ describe Workbook do
|
|
401
402
|
it "should yield identical Workbook objects when reopening and the Excel is closed" do
|
402
403
|
@book.should be_alive
|
403
404
|
@book.close
|
404
|
-
Excel.
|
405
|
+
Excel.kill_all
|
405
406
|
book2 = Workbook.open(@simple_file1)
|
406
407
|
book2.should be_alive
|
407
408
|
book2.should === @book
|
@@ -1192,7 +1193,7 @@ describe Workbook do
|
|
1192
1193
|
excel2 = @book.excel
|
1193
1194
|
fn = @book.filename
|
1194
1195
|
@book.close
|
1195
|
-
Excel.
|
1196
|
+
Excel.kill_all
|
1196
1197
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :current})
|
1197
1198
|
book2.should be_alive
|
1198
1199
|
book2.should be_a Workbook
|
@@ -1204,7 +1205,7 @@ describe Workbook do
|
|
1204
1205
|
|
1205
1206
|
it "should reopen a book in the first opened Excel if the old Excel is closed" do
|
1206
1207
|
excel = @book.excel
|
1207
|
-
Excel.
|
1208
|
+
Excel.kill_all
|
1208
1209
|
new_excel = Excel.new(:reuse => false)
|
1209
1210
|
new_excel2 = Excel.new(:reuse => false)
|
1210
1211
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :current})
|
@@ -1220,7 +1221,7 @@ describe Workbook do
|
|
1220
1221
|
|
1221
1222
|
it "should reopen a book in the first opened excel, if the book cannot be reopened" do
|
1222
1223
|
@book.close
|
1223
|
-
Excel.
|
1224
|
+
Excel.kill_all
|
1224
1225
|
excel1 = Excel.new(:reuse => false)
|
1225
1226
|
excel2 = Excel.new(:reuse => false)
|
1226
1227
|
book2 = Workbook.open(@different_file, :default => {:excel => :current})
|
@@ -1384,7 +1385,7 @@ describe Workbook do
|
|
1384
1385
|
excel2 = @book.excel
|
1385
1386
|
fn = @book.filename
|
1386
1387
|
@book.close
|
1387
|
-
Excel.
|
1388
|
+
Excel.kill_all
|
1388
1389
|
book2 = Workbook.open(@simple_file1, :default_excel => :current)
|
1389
1390
|
book2.should be_alive
|
1390
1391
|
book2.should be_a Workbook
|
@@ -1396,7 +1397,7 @@ describe Workbook do
|
|
1396
1397
|
|
1397
1398
|
it "should reopen a book in the first opened Excel if the old Excel is closed" do
|
1398
1399
|
excel = @book.excel
|
1399
|
-
Excel.
|
1400
|
+
Excel.kill_all
|
1400
1401
|
new_excel = Excel.new(:reuse => false)
|
1401
1402
|
new_excel2 = Excel.new(:reuse => false)
|
1402
1403
|
book2 = Workbook.open(@simple_file1, :default_excel => :current)
|
@@ -1412,7 +1413,7 @@ describe Workbook do
|
|
1412
1413
|
|
1413
1414
|
it "should reopen a book in the first opened excel, if the book cannot be reopened" do
|
1414
1415
|
@book.close
|
1415
|
-
Excel.
|
1416
|
+
Excel.kill_all
|
1416
1417
|
excel1 = Excel.new(:reuse => false)
|
1417
1418
|
excel2 = Excel.new(:reuse => false)
|
1418
1419
|
book2 = Workbook.open(@different_file, :default_excel => :current)
|
@@ -1584,7 +1585,7 @@ describe Workbook do
|
|
1584
1585
|
excel2 = @book.excel
|
1585
1586
|
fn = @book.filename
|
1586
1587
|
@book.close
|
1587
|
-
Excel.
|
1588
|
+
Excel.kill_all
|
1588
1589
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :active})
|
1589
1590
|
book2.should be_alive
|
1590
1591
|
book2.should be_a Workbook
|
@@ -1596,7 +1597,7 @@ describe Workbook do
|
|
1596
1597
|
|
1597
1598
|
it "should reopen a book in the first opened Excel if the old Excel is closed" do
|
1598
1599
|
excel = @book.excel
|
1599
|
-
Excel.
|
1600
|
+
Excel.kill_all
|
1600
1601
|
new_excel = Excel.new(:reuse => false)
|
1601
1602
|
new_excel2 = Excel.new(:reuse => false)
|
1602
1603
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :active})
|
@@ -1612,7 +1613,7 @@ describe Workbook do
|
|
1612
1613
|
|
1613
1614
|
it "should reopen a book in the first opened excel, if the book cannot be reopened" do
|
1614
1615
|
@book.close
|
1615
|
-
Excel.
|
1616
|
+
Excel.kill_all
|
1616
1617
|
excel1 = Excel.new(:reuse => false)
|
1617
1618
|
excel2 = Excel.new(:reuse => false)
|
1618
1619
|
book2 = Workbook.open(@different_file, :default => {:excel => :active})
|
@@ -1695,7 +1696,7 @@ describe Workbook do
|
|
1695
1696
|
excel2 = @book.excel
|
1696
1697
|
fn = @book.filename
|
1697
1698
|
@book.close
|
1698
|
-
Excel.
|
1699
|
+
Excel.kill_all
|
1699
1700
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :reuse})
|
1700
1701
|
book2.should be_alive
|
1701
1702
|
book2.should be_a Workbook
|
@@ -1707,7 +1708,7 @@ describe Workbook do
|
|
1707
1708
|
|
1708
1709
|
it "should reopen a book in the first opened Excel if the old Excel is closed" do
|
1709
1710
|
excel = @book.excel
|
1710
|
-
Excel.
|
1711
|
+
Excel.kill_all
|
1711
1712
|
new_excel = Excel.new(:reuse => false)
|
1712
1713
|
new_excel2 = Excel.new(:reuse => false)
|
1713
1714
|
book2 = Workbook.open(@simple_file1, :default => {:excel => :reuse})
|
@@ -1723,7 +1724,7 @@ describe Workbook do
|
|
1723
1724
|
|
1724
1725
|
it "should reopen a book in the first opened excel, if the book cannot be reopened" do
|
1725
1726
|
@book.close
|
1726
|
-
Excel.
|
1727
|
+
Excel.kill_all
|
1727
1728
|
excel1 = Excel.new(:reuse => false)
|
1728
1729
|
excel2 = Excel.new(:reuse => false)
|
1729
1730
|
book2 = Workbook.open(@different_file, :default => {:excel => :reuse})
|
@@ -27,6 +27,7 @@ describe Workbook do
|
|
27
27
|
@linked_file = @dir + '/workbook_linked.xlsm'
|
28
28
|
@simple_file_xlsm = @dir + '/workbook.xls'
|
29
29
|
@simple_file_xlsx = @dir + '/workbook.xlsx'
|
30
|
+
@file_with_references = @dir + '/test_add_sheet.xlsx'
|
30
31
|
end
|
31
32
|
|
32
33
|
after do
|
@@ -229,7 +230,8 @@ describe Workbook do
|
|
229
230
|
describe "copy_sheet" do
|
230
231
|
|
231
232
|
before do
|
232
|
-
|
233
|
+
#@book = Workbook.open(@simple_file)
|
234
|
+
@book = Workbook.open(@file_with_references)
|
233
235
|
@sheet = @book.sheet(1)
|
234
236
|
@another_book = Workbook.open(@another_simple_file)
|
235
237
|
end
|
@@ -239,6 +241,13 @@ describe Workbook do
|
|
239
241
|
@another_book.close(:if_unsaved => :forget)
|
240
242
|
end
|
241
243
|
|
244
|
+
it "should copy the second sheet, append it and leave the references so far" do
|
245
|
+
@book.add_sheet(@book.sheet(2), :after => @book.sheet(3))
|
246
|
+
@book.sheet(1)[2,1].Value.should == "x"
|
247
|
+
@book.sheet(1)[2,2].Value.should == "y"
|
248
|
+
@book.sheet(1)[2,3].Value.should == "z"
|
249
|
+
end
|
250
|
+
|
242
251
|
it "should copy and append a given sheet" do
|
243
252
|
@book.ole_workbook.Worksheets.Count.should == 3
|
244
253
|
@book.copy_sheet @sheet
|
@@ -1168,7 +1168,7 @@ describe Workbook do
|
|
1168
1168
|
context "with no open book" do
|
1169
1169
|
|
1170
1170
|
it "should open unobtrusively if no Excel is open" do
|
1171
|
-
Excel.
|
1171
|
+
Excel.kill_all
|
1172
1172
|
Workbook.unobtrusively(@simple_file) do |book|
|
1173
1173
|
book.should be_a Workbook
|
1174
1174
|
book.excel.Visible.should be false
|
@@ -1185,7 +1185,7 @@ describe Workbook do
|
|
1185
1185
|
context "with two running excel instances" do
|
1186
1186
|
|
1187
1187
|
before :all do
|
1188
|
-
Excel.
|
1188
|
+
Excel.kill_all
|
1189
1189
|
end
|
1190
1190
|
|
1191
1191
|
before do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robust_excel_ole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.10'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- traths
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -79,6 +79,8 @@ files:
|
|
79
79
|
- examples/open_save_close/example_reuse.rb
|
80
80
|
- examples/open_save_close/example_simple.rb
|
81
81
|
- examples/open_save_close/example_unobtrusively.rb
|
82
|
+
- jreo.bat
|
83
|
+
- lib/jreo_console.rb
|
82
84
|
- lib/reo_console.rb
|
83
85
|
- lib/robust_excel_ole.rb
|
84
86
|
- lib/robust_excel_ole/address.rb
|
@@ -110,6 +112,7 @@ files:
|
|
110
112
|
- spec/data/protected_sheet.xls
|
111
113
|
- spec/data/reference_workbook.xls
|
112
114
|
- spec/data/referencing_wb.xls
|
115
|
+
- spec/data/test_add_sheet.xlsx
|
113
116
|
- spec/data/workbook.xls
|
114
117
|
- spec/data/workbook.xlsm
|
115
118
|
- spec/data/workbook.xlsx
|