robust_excel_ole 1.31 → 1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog +20 -1
  3. data/README.rdoc +118 -18
  4. data/___dummy_workbook.xls +0 -0
  5. data/benchmarking/creek_example.rb +1 -1
  6. data/benchmarking/roo_example.rb +1 -1
  7. data/benchmarking/simple_xlsx_reader_example.rb +1 -1
  8. data/benchmarking/spreadsheet_example.rb +1 -1
  9. data/docs/README_excel.rdoc +16 -24
  10. data/docs/README_listobjects.rdoc +176 -0
  11. data/docs/README_open.rdoc +12 -12
  12. data/docs/README_ranges.rdoc +72 -55
  13. data/docs/README_save_close.rdoc +3 -3
  14. data/docs/README_sheet.rdoc +18 -13
  15. data/examples/example_ruby_library.rb +2 -2
  16. data/examples/introductory_examples/example_range.rb +2 -2
  17. data/examples/modifying_sheets/example_access_sheets_and_cells.rb +6 -6
  18. data/examples/modifying_sheets/example_add_names.rb +1 -1
  19. data/examples/modifying_sheets/example_concating.rb +1 -1
  20. data/examples/modifying_sheets/example_copying.rb +2 -2
  21. data/examples/modifying_sheets/example_listobjects.rb +86 -0
  22. data/examples/modifying_sheets/example_naming.rb +1 -1
  23. data/examples/modifying_sheets/example_ranges.rb +1 -1
  24. data/examples/open_save_close/example_control_to_excel.rb +1 -1
  25. data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +1 -1
  26. data/examples/open_save_close/example_if_obstructed_save.rb +3 -3
  27. data/examples/open_save_close/example_if_unsaved_accept.rb +1 -1
  28. data/examples/open_save_close/example_if_unsaved_forget.rb +3 -3
  29. data/examples/open_save_close/example_if_unsaved_forget_more.rb +4 -4
  30. data/examples/open_save_close/example_read_only.rb +1 -1
  31. data/examples/open_save_close/example_simple.rb +1 -1
  32. data/examples/open_save_close/example_unobtrusively.rb +3 -3
  33. data/lib/robust_excel_ole/address_tool.rb +54 -44
  34. data/lib/robust_excel_ole/base.rb +4 -6
  35. data/lib/robust_excel_ole/bookstore.rb +2 -16
  36. data/lib/robust_excel_ole/cell.rb +16 -21
  37. data/lib/robust_excel_ole/excel.rb +131 -186
  38. data/lib/robust_excel_ole/general.rb +82 -55
  39. data/lib/robust_excel_ole/list_object.rb +182 -109
  40. data/lib/robust_excel_ole/list_row.rb +65 -38
  41. data/lib/robust_excel_ole/range.rb +125 -93
  42. data/lib/robust_excel_ole/range_owners.rb +52 -66
  43. data/lib/robust_excel_ole/version.rb +1 -1
  44. data/lib/robust_excel_ole/workbook.rb +168 -176
  45. data/lib/robust_excel_ole/worksheet.rb +177 -141
  46. data/robust_excel_ole.gemspec +4 -3
  47. data/spec/bookstore_spec.rb +2 -3
  48. data/spec/cell_spec.rb +9 -9
  49. data/spec/data/more_data/workbook.xls +0 -0
  50. data/spec/excel_spec.rb +132 -85
  51. data/spec/general_spec.rb +47 -15
  52. data/spec/list_object_spec.rb +258 -145
  53. data/spec/list_row_spec.rb +218 -0
  54. data/spec/range_spec.rb +76 -29
  55. data/spec/spec_helper.rb +15 -1
  56. data/spec/workbook_spec.rb +75 -34
  57. data/spec/workbook_specs/workbook_all_spec.rb +2 -1
  58. data/spec/workbook_specs/workbook_misc_spec.rb +20 -13
  59. data/spec/workbook_specs/workbook_open_spec.rb +47 -45
  60. data/spec/workbook_specs/workbook_save_spec.rb +21 -22
  61. data/spec/workbook_specs/workbook_sheet_spec.rb +3 -3
  62. data/spec/workbook_specs/workbook_unobtr_spec.rb +303 -303
  63. data/spec/worksheet_spec.rb +522 -318
  64. metadata +37 -2
@@ -213,8 +213,8 @@ describe Workbook do
213
213
  file.puts "garbage"
214
214
  end
215
215
  sheet = @book.sheet(1)
216
- cell_value = sheet[1,1].Value
217
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
216
+ cell_value = sheet[1,1]
217
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
218
218
  @book.Saved.should be false
219
219
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_blocked => :forget)
220
220
  @book.should_not be_alive
@@ -225,7 +225,7 @@ describe Workbook do
225
225
  new_book.close
226
226
  old_book = Workbook.open(@simple_file1)
227
227
  old_sheet = old_book.sheet(1)
228
- old_sheet[1,1].Value.should == cell_value
228
+ old_sheet[1,1].should == cell_value
229
229
  old_book.close
230
230
  end
231
231
 
@@ -235,8 +235,8 @@ describe Workbook do
235
235
  file.puts "garbage"
236
236
  end
237
237
  sheet = @book.sheet(1)
238
- cell_value = sheet[1,1].Value
239
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
238
+ cell_value = sheet[1,1]
239
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
240
240
  @book.Saved.should be false
241
241
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_blocked => :save)
242
242
  @book.should_not be_alive
@@ -247,7 +247,7 @@ describe Workbook do
247
247
  new_book.close
248
248
  old_book = Workbook.open(@simple_file1)
249
249
  old_sheet = old_book.sheet(1)
250
- old_sheet[1,1].Value.should_not == cell_value
250
+ old_sheet[1,1].should_not == cell_value
251
251
  old_book.close
252
252
  end
253
253
 
@@ -268,8 +268,8 @@ describe Workbook do
268
268
 
269
269
  it "should raise an error if the blocking workbook was unsaved with :if_blocked => :close_if_saved" do
270
270
  sheet = @book.sheet(1)
271
- cell_value = sheet[1,1].Value
272
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
271
+ cell_value = sheet[1,1]
272
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
273
273
  @book.Saved.should be false
274
274
  expect{
275
275
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_blocked => :close_if_saved)
@@ -363,8 +363,8 @@ describe Workbook do
363
363
  file.puts "garbage"
364
364
  end
365
365
  sheet = @book.sheet(1)
366
- cell_value = sheet[1,1].Value
367
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
366
+ cell_value = sheet[1,1]
367
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
368
368
  @book.Saved.should be false
369
369
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :forget)
370
370
  @book.should_not be_alive
@@ -375,7 +375,7 @@ describe Workbook do
375
375
  new_book.close
376
376
  old_book = Workbook.open(@simple_file1)
377
377
  old_sheet = old_book.sheet(1)
378
- old_sheet[1,1].Value.should == cell_value
378
+ old_sheet[1,1].should == cell_value
379
379
  old_book.close
380
380
  end
381
381
 
@@ -385,8 +385,8 @@ describe Workbook do
385
385
  file.puts "garbage"
386
386
  end
387
387
  sheet = @book.sheet(1)
388
- cell_value = sheet[1,1].Value
389
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
388
+ cell_value = sheet[1,1]
389
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
390
390
  @book.Saved.should be false
391
391
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :save)
392
392
  @book.should_not be_alive
@@ -397,7 +397,7 @@ describe Workbook do
397
397
  new_book.close
398
398
  old_book = Workbook.open(@simple_file1)
399
399
  old_sheet = old_book.sheet(1)
400
- old_sheet[1,1].Value.should_not == cell_value
400
+ old_sheet[1,1].should_not == cell_value
401
401
  old_book.close
402
402
  end
403
403
 
@@ -418,8 +418,8 @@ describe Workbook do
418
418
 
419
419
  it "should raise an error if the blocking workbook was unsaved with :if_blocked => :close_if_saved" do
420
420
  sheet = @book.sheet(1)
421
- cell_value = sheet[1,1].Value
422
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
421
+ cell_value = sheet[1,1]
422
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
423
423
  @book.Saved.should be false
424
424
  expect{
425
425
  @book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :close_if_saved)
@@ -509,12 +509,12 @@ describe Workbook do
509
509
 
510
510
  it "should simple save if file name is equal to the old one with :if_exists => :overwrite" do
511
511
  sheet = @book.sheet(1)
512
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
513
- new_value = sheet[1,1].Value
512
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
513
+ new_value = sheet[1,1]
514
514
  @book.save_as(@simple_file1, :if_exists => :overwrite)
515
515
  new_book = Workbook.open(@simple_file1)
516
516
  new_sheet = new_book.sheet(1)
517
- new_sheet[1,1].Value.should == new_value
517
+ new_sheet[1,1].should == new_value
518
518
  new_book.close
519
519
  end
520
520
 
@@ -550,8 +550,8 @@ describe Workbook do
550
550
  it "should save if user answers 'yes'" do
551
551
  # "Yes" is to the left of "No", which is the default. --> language independent
552
552
  @key_sender.puts "{right}{right}{right}{enter}" #, :initial_wait => 0.2, :if_target_missing=>"Excel window not found")
553
- #@key_sender.puts "{left}{enter}"
554
- #@key_sender.puts "{left}{enter}"
553
+ @key_sender.puts "{left}{enter}"
554
+ @key_sender.puts "{left}{enter}"
555
555
  @book.save_as(@simple_save_file1, :if_exists => :alert)
556
556
  File.exist?(@simple_save_file1).should be true
557
557
  File.size?(@simple_save_file1).should > @garbage_length
@@ -683,4 +683,3 @@ describe Workbook do
683
683
  end
684
684
  end
685
685
  end
686
-
@@ -207,9 +207,9 @@ describe Workbook do
207
207
 
208
208
  it "should copy the second sheet, append it and leave the references so far" do
209
209
  @book2.add_sheet(@book2.sheet(2), :after => @book2.sheet(3))
210
- @book2.sheet(1)[2,1].Value.should == "x"
211
- @book2.sheet(1)[2,2].Value.should == "y"
212
- @book2.sheet(1)[2,3].Value.should == "z"
210
+ @book2.sheet(1)[2,1].should == "x"
211
+ @book2.sheet(1)[2,2].should == "y"
212
+ @book2.sheet(1)[2,3].should == "z"
213
213
  end
214
214
 
215
215
  it "should copy and append a given sheet" do
@@ -98,14 +98,14 @@ describe Workbook do
98
98
  book.Saved.should be true
99
99
  sheet = book.sheet(1)
100
100
  cell = sheet[1,1]
101
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
102
- @new_cell_value = sheet[1,1].Value
101
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
102
+ @new_cell_value = sheet[1,1]
103
103
  book.Saved.should be false
104
104
  end
105
105
  Excel.kill_all
106
106
  new_book = Workbook.open(@simple_file1)
107
107
  sheet = new_book.sheet(1)
108
- sheet[1,1].Value.should_not == @new_cell_value
108
+ sheet[1,1].should_not == @new_cell_value
109
109
  end
110
110
 
111
111
  it "should change the value" do
@@ -116,14 +116,14 @@ describe Workbook do
116
116
  book.Saved.should be true
117
117
  sheet = book.sheet(1)
118
118
  cell = sheet[1,1]
119
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
120
- @new_cell_value = sheet[1,1].Value
119
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
120
+ @new_cell_value = sheet[1,1]
121
121
  book.Saved.should be false
122
122
  end
123
123
  Excel.kill_all
124
124
  new_book = Workbook.open(@simple_file1)
125
125
  sheet = new_book.sheet(1)
126
- sheet[1,1].Value.should == @new_cell_value
126
+ sheet[1,1].should == @new_cell_value
127
127
  end
128
128
 
129
129
  end
@@ -133,7 +133,7 @@ describe Workbook do
133
133
  before do
134
134
  @book = Workbook.open(@simple_file1)
135
135
  sheet = @book.sheet(1)
136
- @old_cell_value = sheet[1,1].Value
136
+ @old_cell_value = sheet[1,1]
137
137
  @book.close
138
138
  end
139
139
 
@@ -145,14 +145,14 @@ describe Workbook do
145
145
  book.Saved.should be true
146
146
  sheet = book.sheet(1)
147
147
  cell = sheet[1,1]
148
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
148
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
149
149
  book.Saved.should be false
150
150
  book.excel.should == @book.excel
151
151
  end
152
152
  Excel.kill_all
153
153
  new_book = Workbook.open(@simple_file1)
154
154
  sheet = new_book.sheet(1)
155
- sheet[1,1].Value.should == @old_cell_value
155
+ sheet[1,1].should == @old_cell_value
156
156
  end
157
157
 
158
158
  it "should not change the value and use a given Excel" do
@@ -161,13 +161,13 @@ describe Workbook do
161
161
  Workbook.for_reading(@simple_file1, :if_closed => another_excel) do |book|
162
162
  sheet = book.sheet(1)
163
163
  cell = sheet[1,1]
164
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
164
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
165
165
  book.excel.should == another_excel
166
166
  end
167
167
  Excel.kill_all
168
168
  new_book = Workbook.open(@simple_file1)
169
169
  sheet = new_book.sheet(1)
170
- sheet[1,1].Value.should == @old_cell_value
170
+ sheet[1,1].should == @old_cell_value
171
171
  end
172
172
 
173
173
  it "should not change the value and use the new Excel instance" do
@@ -175,7 +175,7 @@ describe Workbook do
175
175
  Workbook.for_reading(@simple_file1, :if_closed => :new) do |book|
176
176
  sheet = book.sheet(1)
177
177
  cell = sheet[1,1]
178
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
178
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
179
179
  book.excel.should_not == @book.excel
180
180
  book.excel.should_not == new_excel
181
181
  book.excel.properties[:visible].should be false
@@ -184,19 +184,19 @@ describe Workbook do
184
184
  Excel.kill_all
185
185
  new_book = Workbook.open(@simple_file1)
186
186
  sheet = new_book.sheet(1)
187
- sheet[1,1].Value.should == @old_cell_value
187
+ sheet[1,1].should == @old_cell_value
188
188
  end
189
189
 
190
190
  it "should change the value" do
191
191
  Workbook.for_modifying(@simple_file1) do |book|
192
192
  sheet = book.sheet(1)
193
193
  cell = sheet[1,1]
194
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
194
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
195
195
  book.excel.should == @book.excel
196
196
  end
197
197
  new_book = Workbook.open(@simple_file, :visible => true)
198
198
  sheet = new_book.sheet(1)
199
- sheet[1,1].Value.should_not == @old_cell_value
199
+ sheet[1,1].should_not == @old_cell_value
200
200
  end
201
201
 
202
202
  it "should change the value and use a given Excel" do
@@ -206,12 +206,12 @@ describe Workbook do
206
206
  Workbook.for_modifying(@simple_file1, :if_closed => another_excel) do |book|
207
207
  sheet = book.sheet(1)
208
208
  cell = sheet[1,1]
209
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
209
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
210
210
  book.excel.should == another_excel
211
211
  end
212
212
  new_book = Workbook.open(@simple_file1, :visible => true)
213
213
  sheet = new_book.sheet(1)
214
- sheet[1,1].Value.should_not == @old_cell_value
214
+ sheet[1,1].should_not == @old_cell_value
215
215
  end
216
216
 
217
217
  it "should change the value and use the new Excel instance" do
@@ -219,7 +219,7 @@ describe Workbook do
219
219
  Workbook.for_modifying(@simple_file1, :if_closed => :new) do |book|
220
220
  sheet = book.sheet(1)
221
221
  cell = sheet[1,1]
222
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
222
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
223
223
  book.excel.should_not == @book.excel
224
224
  book.excel.should_not == new_excel
225
225
  book.excel.properties[:visible].should be false
@@ -227,7 +227,7 @@ describe Workbook do
227
227
  end
228
228
  new_book = Workbook.open(@simple_file1, :visible => true)
229
229
  sheet = new_book.sheet(1)
230
- sheet[1,1].Value.should_not == @old_cell_value
230
+ sheet[1,1].should_not == @old_cell_value
231
231
  end
232
232
  end
233
233
  end
@@ -238,7 +238,7 @@ describe Workbook do
238
238
 
239
239
  before do
240
240
  @book = Workbook.open(@simple_file1)
241
- @old_value = @book.sheet(1)[1,1].Value
241
+ @old_value = @book.sheet(1)[1,1]
242
242
  end
243
243
 
244
244
  after do
@@ -251,12 +251,12 @@ describe Workbook do
251
251
  book.should be_alive
252
252
  book.ReadOnly.should be false
253
253
  book.Saved.should be true
254
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
254
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
255
255
  book.Saved.should be false
256
256
  end
257
257
  @book.close(:if_unsaved => :forget)
258
258
  new_book = Workbook.open(@simple_file1)
259
- new_book.sheet(1)[1,1].Value.should == @old_value
259
+ new_book.sheet(1)[1,1].should == @old_value
260
260
  end
261
261
 
262
262
  it "should change the value" do
@@ -264,12 +264,12 @@ describe Workbook do
264
264
  book.should be_a Workbook
265
265
  book.should be_alive
266
266
  book.Saved.should be true
267
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
267
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
268
268
  book.Saved.should be false
269
269
  end
270
270
  @book.close(:if_unsaved => :forget)
271
271
  new_book = Workbook.open(@simple_file1)
272
- new_book.sheet(1)[1,1].Value.should_not == @old_value
272
+ new_book.sheet(1)[1,1].should_not == @old_value
273
273
  end
274
274
 
275
275
  it "should not change the value and make visible" do
@@ -278,12 +278,12 @@ describe Workbook do
278
278
  book.should be_alive
279
279
  book.visible.should be true
280
280
  book.Saved.should be true
281
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
281
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
282
282
  book.Saved.should be false
283
283
  end
284
284
  @book.close(:if_unsaved => :forget)
285
285
  new_book = Workbook.open(@simple_file1)
286
- new_book.sheet(1)[1,1].Value.should == @old_value
286
+ new_book.sheet(1)[1,1].should == @old_value
287
287
  end
288
288
 
289
289
  it "should change the value and make visible" do
@@ -292,12 +292,12 @@ describe Workbook do
292
292
  book.should be_alive
293
293
  book.visible.should be true
294
294
  book.Saved.should be true
295
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
295
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
296
296
  book.Saved.should be false
297
297
  end
298
298
  @book.close(:if_unsaved => :forget)
299
299
  new_book = Workbook.open(@simple_file1)
300
- new_book.sheet(1)[1,1].Value.should_not == @old_value
300
+ new_book.sheet(1)[1,1].should_not == @old_value
301
301
  end
302
302
 
303
303
  end
@@ -329,8 +329,8 @@ describe Workbook do
329
329
  Workbook.unobtrusively(@sub_file, :writable => false) do |book|
330
330
  book.ReadOnly.should be true
331
331
  book.filename.should == @sub_file
332
- @old_value = book.sheet(1)[1,1].Value
333
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
332
+ @old_value = book.sheet(1)[1,1]
333
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
334
334
  end
335
335
  Excel.current.workbooks.should == []
336
336
  end
@@ -339,8 +339,8 @@ describe Workbook do
339
339
  Workbook.unobtrusively(@main_file, :writable => false) do |book|
340
340
  book.ReadOnly.should be true
341
341
  book.filename.should == @main_file
342
- @old_value = book.sheet(1)[1,1].Value
343
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
342
+ @old_value = book.sheet(1)[1,1]
343
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
344
344
  end
345
345
  Excel.current.workbooks.map{|b| b.filename}.should == [@sub_file]
346
346
  end
@@ -374,7 +374,7 @@ describe Workbook do
374
374
 
375
375
  before do
376
376
  @book = Workbook.open(@simple_file1, :visible => true)
377
- @old_value = @book.sheet(1)[1,1].Value
377
+ @old_value = @book.sheet(1)[1,1]
378
378
  end
379
379
 
380
380
  after do
@@ -386,41 +386,41 @@ describe Workbook do
386
386
  book.saved.should be true
387
387
  book.visible.should be true
388
388
  book.writable.should be true
389
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
389
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
390
390
  end
391
391
  @book.saved.should be true
392
392
  @book.visible.should be true
393
393
  @book.writable.should be true
394
- @book.sheet(1)[1,1].Value.should_not == @old_value
394
+ @book.sheet(1)[1,1].should_not == @old_value
395
395
  @book.close
396
396
  new_book = Workbook.open(@simple_file1)
397
- new_book.sheet(1)[1,1].Value.should_not == @old_value
397
+ new_book.sheet(1)[1,1].should_not == @old_value
398
398
  end
399
399
 
400
400
  it "should unobtrusively open, modify, and not save the changes" do
401
401
  @book.unobtrusively(:writable => false) do |book|
402
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
402
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
403
403
  end
404
404
  @book.saved.should be true
405
405
  @book.visible.should be true
406
406
  @book.writable.should be true
407
- @book.sheet(1)[1,1].Value.should_not == @old_value
407
+ @book.sheet(1)[1,1].should_not == @old_value
408
408
  @book.close
409
409
  new_book = Workbook.open(@simple_file1)
410
- new_book.sheet(1)[1,1].Value.should == @old_value
410
+ new_book.sheet(1)[1,1].should == @old_value
411
411
  end
412
412
 
413
413
  it "should unobtrusively open, modify, and save the changes" do
414
414
  @book.unobtrusively(:writable => true) do |book|
415
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
415
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
416
416
  end
417
417
  @book.saved.should be true
418
418
  @book.visible.should be true
419
419
  @book.writable.should be true
420
- @book.sheet(1)[1,1].Value.should_not == @old_value
420
+ @book.sheet(1)[1,1].should_not == @old_value
421
421
  @book.close
422
422
  new_book = Workbook.open(@simple_file1)
423
- new_book.sheet(1)[1,1].Value.should_not == @old_value
423
+ new_book.sheet(1)[1,1].should_not == @old_value
424
424
  end
425
425
 
426
426
  end
@@ -429,9 +429,9 @@ describe Workbook do
429
429
 
430
430
  before do
431
431
  @book = Workbook.open(@simple_file1, :visible => true)
432
- @old_value = @book.sheet(1)[1,1].Value
432
+ @old_value = @book.sheet(1)[1,1]
433
433
  sheet = @book.sheet(1)
434
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
434
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
435
435
  end
436
436
 
437
437
  after do
@@ -443,15 +443,15 @@ describe Workbook do
443
443
  book.saved.should be false
444
444
  book.visible.should be true
445
445
  book.writable.should be true
446
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
446
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
447
447
  end
448
448
  @book.saved.should be false
449
449
  @book.visible.should be true
450
450
  @book.writable.should be true
451
- @book.sheet(1)[1,1].Value.should == @old_value
451
+ @book.sheet(1)[1,1].should == @old_value
452
452
  @book.close(:if_unsaved => :forget)
453
453
  @book = Workbook.open(@simple_file1)
454
- @book.sheet(1)[1,1].Value.should == @old_value
454
+ @book.sheet(1)[1,1].should == @old_value
455
455
  end
456
456
 
457
457
  it "should unobtrusively open, modify, and not save the changes" do
@@ -461,23 +461,23 @@ describe Workbook do
461
461
  @book.saved.should be false
462
462
  @book.visible.should be true
463
463
  @book.writable.should be true
464
- @book.sheet(1)[1,1].Value.should == "bla"
464
+ @book.sheet(1)[1,1].should == "bla"
465
465
  @book.close(:if_unsaved => :forget)
466
466
  new_book = Workbook.open(@simple_file1)
467
- new_book.sheet(1)[1,1].Value.should == @old_value
467
+ new_book.sheet(1)[1,1].should == @old_value
468
468
  end
469
469
 
470
470
  it "should unobtrusively open, modify, and save the changes" do
471
471
  @book.unobtrusively(:writable => true) do |book|
472
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
472
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
473
473
  end
474
474
  @book.saved.should be false
475
475
  @book.visible.should be true
476
476
  @book.writable.should be true
477
- @book.sheet(1)[1,1].Value.should == @old_value
477
+ @book.sheet(1)[1,1].should == @old_value
478
478
  @book.close(:if_unsaved => :forget)
479
479
  new_book = Workbook.open(@simple_file1)
480
- new_book.sheet(1)[1,1].Value.should == @old_value
480
+ new_book.sheet(1)[1,1].should == @old_value
481
481
  end
482
482
 
483
483
  end
@@ -486,7 +486,7 @@ describe Workbook do
486
486
 
487
487
  before do
488
488
  @book = Workbook.open(@simple_file1, :visible => true)
489
- @old_value = @book.sheet(1)[1,1].Value
489
+ @old_value = @book.sheet(1)[1,1]
490
490
  @book.close
491
491
  end
492
492
 
@@ -500,11 +500,11 @@ describe Workbook do
500
500
  book.saved.should be true
501
501
  book.visible.should be true
502
502
  book.writable.should be true
503
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
503
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
504
504
  end
505
505
  @book.should_not be_alive
506
506
  new_book = Workbook.open(@simple_file1)
507
- new_book.sheet(1)[1,1].Value.should_not == @old_value
507
+ new_book.sheet(1)[1,1].should_not == @old_value
508
508
  end
509
509
 
510
510
  it "should unobtrusively open and and not close the workbook" do
@@ -513,16 +513,16 @@ describe Workbook do
513
513
  book.saved.should be true
514
514
  book.visible.should be true
515
515
  book.writable.should be true
516
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
516
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
517
517
  end
518
518
  @book.should be_alive
519
519
  @book.saved.should be true
520
520
  @book.visible.should be true
521
521
  @book.writable.should be true
522
- @book.sheet(1)[1,1].Value.should_not == @old_value
522
+ @book.sheet(1)[1,1].should_not == @old_value
523
523
  @book.close
524
524
  new_book = Workbook.open(@simple_file1)
525
- new_book.sheet(1)[1,1].Value.should_not == @old_value
525
+ new_book.sheet(1)[1,1].should_not == @old_value
526
526
  end
527
527
 
528
528
  end
@@ -536,7 +536,7 @@ describe Workbook do
536
536
  Workbook.unobtrusively(@simple_file) do |book|
537
537
  book.should be_a Workbook
538
538
  sheet = book.sheet(1)
539
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
539
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
540
540
  book.should be_alive
541
541
  book.Saved.should be false
542
542
  end
@@ -588,7 +588,7 @@ describe Workbook do
588
588
  it "should connect" do
589
589
  Workbook.unobtrusively(@simple_file1) do |book|
590
590
  book.excel.Workbooks.Count.should == 1
591
- Excel.excels_number.should == 1
591
+ Excel.instance_count.should == 1
592
592
  book.FullName.should == General.absolute_path(@simple_file1)
593
593
  book.saved.should be true
594
594
  book.visible.should be false
@@ -645,8 +645,8 @@ describe Workbook do
645
645
  book.saved.should be true
646
646
  book.visible.should be false
647
647
  book.writable.should be true
648
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
649
- @new_value = book.sheet(1)[1,1].Value
648
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
649
+ @new_value = book.sheet(1)[1,1]
650
650
  book.Saved.should be false
651
651
  end
652
652
  ole_wb = WIN32OLE.connect(@abs_filename)
@@ -655,8 +655,8 @@ describe Workbook do
655
655
  ole_wb.ReadOnly.should be false
656
656
  ole_wb.Close
657
657
  book2 = Workbook.open(@simple_file1)
658
- book2.sheet(1)[1,1].Value.should_not == @old_value
659
- book2.sheet(1)[1,1].Value.should == @new_value
658
+ book2.sheet(1)[1,1].should_not == @old_value
659
+ book2.sheet(1)[1,1].should == @new_value
660
660
  end
661
661
 
662
662
  it "should modify and remain saved-status and not save the new value when writable => false" do
@@ -664,8 +664,8 @@ describe Workbook do
664
664
  book.saved.should be true
665
665
  book.visible.should be false
666
666
  book.writable.should be true
667
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
668
- @new_value = book.sheet(1)[1,1].Value
667
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
668
+ @new_value = book.sheet(1)[1,1]
669
669
  book.Saved.should be false
670
670
  end
671
671
  ole_wb = WIN32OLE.connect(@abs_filename)
@@ -674,8 +674,8 @@ describe Workbook do
674
674
  ole_wb.ReadOnly.should be false
675
675
  ole_wb.Close
676
676
  book2 = Workbook.open(@simple_file1)
677
- book2.sheet(1)[1,1].Value.should == @old_value
678
- book2.sheet(1)[1,1].Value.should_not == @new_value
677
+ book2.sheet(1)[1,1].should == @old_value
678
+ book2.sheet(1)[1,1].should_not == @new_value
679
679
  end
680
680
 
681
681
  end
@@ -726,9 +726,9 @@ describe Workbook do
726
726
  @ole_wb = ws.Open(@abs_filename)
727
727
  @ole_e1.Visible = true
728
728
  @ole_wb.Windows(@ole_wb.Name).Visible = true
729
- @old_value = @ole_wb.Worksheets.Item(1).Cells.Item(1,1).Value
729
+ @old_value = @ole_wb.Worksheets.Item(1).Cells.Item(1,1)
730
730
  @ole_wb.Worksheets.Item(1).Cells.Item(1,1).Value = @old_value = "foo" #== "foo" ? "bar" : "foo"
731
- @new_value = @ole_wb.Worksheets.Item(1).Cells.Item(1,1).Value
731
+ @new_value = @ole_wb.Worksheets.Item(1).Cells.Item(1,1)
732
732
  @ole_wb.Saved.should be false
733
733
  end
734
734
 
@@ -768,8 +768,8 @@ describe Workbook do
768
768
 
769
769
  it "should remain unsaved when modifying" do
770
770
  Workbook.unobtrusively(@simple_file1) do |book|
771
- book.sheet(1)[1,1] = "bar" #book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
772
- @new_value = book.sheet(1)[1,1].Value
771
+ book.sheet(1)[1,1] = "bar" #book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
772
+ @new_value = book.sheet(1)[1,1]
773
773
  book.saved.should be false
774
774
  book.visible.should be true
775
775
  book.writable.should be true
@@ -780,8 +780,8 @@ describe Workbook do
780
780
  ole_wb.ReadOnly.should be false
781
781
  Excel.kill_all
782
782
  book2 = Workbook.open(@simple_file1)
783
- book2.sheet(1)[1,1].Value.should_not == @old_value
784
- book2.sheet(1)[1,1].Value.should == @new_value
783
+ book2.sheet(1)[1,1].should_not == @old_value
784
+ book2.sheet(1)[1,1].should == @new_value
785
785
  end
786
786
 
787
787
  it "should not write with :writable => false" do
@@ -789,8 +789,8 @@ describe Workbook do
789
789
  @ole_wb.Save
790
790
  @ole_wb.Worksheets.Item(1).Cells.Item(1,1).Value = @old_value = "foo"
791
791
  Workbook.unobtrusively(@simple_file1, :writable => false) do |book|
792
- book.sheet(1)[1,1] = "bar" #book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
793
- @new_value = book.sheet(1)[1,1].Value
792
+ book.sheet(1)[1,1] = "bar" #book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
793
+ @new_value = book.sheet(1)[1,1]
794
794
  book.saved.should be false
795
795
  book.visible.should be true
796
796
  book.writable.should be true
@@ -801,8 +801,8 @@ describe Workbook do
801
801
  ole_wb.ReadOnly.should be false
802
802
  Excel.kill_all
803
803
  book2 = Workbook.open(@simple_file1)
804
- book2.sheet(1)[1,1].Value.should == @old_value
805
- book2.sheet(1)[1,1].Value.should_not == @new_value
804
+ book2.sheet(1)[1,1].should == @old_value
805
+ book2.sheet(1)[1,1].should_not == @new_value
806
806
  end
807
807
 
808
808
  end
@@ -846,8 +846,8 @@ describe Workbook do
846
846
 
847
847
  it "should remain read-only when modifying" do
848
848
  Workbook.unobtrusively(@simple_file1) do |book|
849
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
850
- @new_value = book.sheet(1)[1,1].Value
849
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
850
+ @new_value = book.sheet(1)[1,1]
851
851
  book.saved.should be false
852
852
  book.visible.should be true
853
853
  book.writable.should be false
@@ -858,14 +858,14 @@ describe Workbook do
858
858
  ole_wb.ReadOnly.should be true
859
859
  ole_wb.Close
860
860
  book2 = Workbook.open(@simple_file1)
861
- book2.sheet(1)[1,1].Value.should == @old_value
862
- book2.sheet(1)[1,1].Value.should_not == @new_value
861
+ book2.sheet(1)[1,1].should == @old_value
862
+ book2.sheet(1)[1,1].should_not == @new_value
863
863
  end
864
864
 
865
865
  it "should remain read-only when modifying" do
866
866
  Workbook.unobtrusively(@simple_file1, :read_only => false) do |book|
867
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
868
- @new_value = book.sheet(1)[1,1].Value
867
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
868
+ @new_value = book.sheet(1)[1,1]
869
869
  book.saved.should be false
870
870
  book.visible.should be true
871
871
  book.writable.should be true
@@ -876,14 +876,14 @@ describe Workbook do
876
876
  ole_wb.ReadOnly.should be true
877
877
  ole_wb.Close
878
878
  book2 = Workbook.open(@simple_file1)
879
- book2.sheet(1)[1,1].Value.should_not == @old_value
880
- book2.sheet(1)[1,1].Value.should == @new_value
879
+ book2.sheet(1)[1,1].should_not == @old_value
880
+ book2.sheet(1)[1,1].should == @new_value
881
881
  end
882
882
 
883
883
  it "should remain read-only when modifying" do
884
884
  Workbook.unobtrusively(@simple_file1, :read_only => false, :writable => true) do |book|
885
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
886
- @new_value = book.sheet(1)[1,1].Value
885
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
886
+ @new_value = book.sheet(1)[1,1]
887
887
  book.saved.should be false
888
888
  book.visible.should be true
889
889
  book.writable.should be true
@@ -894,14 +894,14 @@ describe Workbook do
894
894
  ole_wb.ReadOnly.should be true
895
895
  ole_wb.Close
896
896
  book2 = Workbook.open(@simple_file1)
897
- book2.sheet(1)[1,1].Value.should_not == @old_value
898
- book2.sheet(1)[1,1].Value.should == @new_value
897
+ book2.sheet(1)[1,1].should_not == @old_value
898
+ book2.sheet(1)[1,1].should == @new_value
899
899
  end
900
900
 
901
901
  it "should remain read-only when modifying and not save changes, when :writable => false" do
902
902
  Workbook.unobtrusively(@simple_file1, :writable => false, :read_only => false) do |book|
903
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
904
- @new_value = book.sheet(1)[1,1].Value
903
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
904
+ @new_value = book.sheet(1)[1,1]
905
905
  book.saved.should be false
906
906
  book.visible.should be true
907
907
  book.writable.should be true
@@ -912,14 +912,14 @@ describe Workbook do
912
912
  ole_wb.ReadOnly.should be true
913
913
  ole_wb.Close
914
914
  book2 = Workbook.open(@simple_file1)
915
- book2.sheet(1)[1,1].Value.should == @old_value
916
- book2.sheet(1)[1,1].Value.should_not == @new_value
915
+ book2.sheet(1)[1,1].should == @old_value
916
+ book2.sheet(1)[1,1].should_not == @new_value
917
917
  end
918
918
 
919
919
  it "should remain read-only when modifying and not save changes, when :writable => false" do
920
920
  Workbook.unobtrusively(@simple_file1, :read_only => false, :writable => false) do |book|
921
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
922
- @new_value = book.sheet(1)[1,1].Value
921
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
922
+ @new_value = book.sheet(1)[1,1]
923
923
  book.saved.should be false
924
924
  book.visible.should be true
925
925
  book.writable.should be true
@@ -930,15 +930,15 @@ describe Workbook do
930
930
  ole_wb.ReadOnly.should be true
931
931
  ole_wb.Close
932
932
  book2 = Workbook.open(@simple_file1)
933
- book2.sheet(1)[1,1].Value.should == @old_value
934
- book2.sheet(1)[1,1].Value.should_not == @new_value
933
+ book2.sheet(1)[1,1].should == @old_value
934
+ book2.sheet(1)[1,1].should_not == @new_value
935
935
  end
936
936
 
937
937
 
938
938
  it "should remain read-only when modifying and not save changes, when :writable => false" do
939
939
  Workbook.unobtrusively(@simple_file1, :writable => false, :read_only => false) do |book|
940
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
941
- @new_value = book.sheet(1)[1,1].Value
940
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
941
+ @new_value = book.sheet(1)[1,1]
942
942
  book.saved.should be false
943
943
  book.visible.should be true
944
944
  book.writable.should be true
@@ -949,14 +949,14 @@ describe Workbook do
949
949
  ole_wb.ReadOnly.should be true
950
950
  ole_wb.Close
951
951
  book2 = Workbook.open(@simple_file1)
952
- book2.sheet(1)[1,1].Value.should == @old_value
953
- book2.sheet(1)[1,1].Value.should_not == @new_value
952
+ book2.sheet(1)[1,1].should == @old_value
953
+ book2.sheet(1)[1,1].should_not == @new_value
954
954
  end
955
955
 
956
956
  it "should remain read-only when modifying and not save changes, even if :writable => true" do
957
957
  Workbook.unobtrusively(@simple_file1, :writable => true) do |book|
958
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
959
- @new_value = book.sheet(1)[1,1].Value
958
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
959
+ @new_value = book.sheet(1)[1,1]
960
960
  book.saved.should be false
961
961
  book.visible.should be true
962
962
  book.writable.should be false
@@ -967,14 +967,14 @@ describe Workbook do
967
967
  ole_wb.ReadOnly.should be true
968
968
  ole_wb.Close
969
969
  book2 = Workbook.open(@simple_file1)
970
- book2.sheet(1)[1,1].Value.should == @old_value
971
- book2.sheet(1)[1,1].Value.should_not == @new_value
970
+ book2.sheet(1)[1,1].should == @old_value
971
+ book2.sheet(1)[1,1].should_not == @new_value
972
972
  end
973
973
 
974
974
  it "should remain read-only when modifying and not save changes, when :writable => false" do
975
975
  Workbook.unobtrusively(@simple_file1, :writable => false) do |book|
976
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
977
- @new_value = book.sheet(1)[1,1].Value
976
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
977
+ @new_value = book.sheet(1)[1,1]
978
978
  book.saved.should be false
979
979
  book.visible.should be true
980
980
  book.writable.should be false
@@ -985,8 +985,8 @@ describe Workbook do
985
985
  ole_wb.ReadOnly.should be true
986
986
  Excel.kill_all
987
987
  book2 = Workbook.open(@simple_file1)
988
- book2.sheet(1)[1,1].Value.should == @old_value
989
- book2.sheet(1)[1,1].Value.should_not == @new_value
988
+ book2.sheet(1)[1,1].should == @old_value
989
+ book2.sheet(1)[1,1].should_not == @new_value
990
990
  end
991
991
 
992
992
 
@@ -998,7 +998,7 @@ describe Workbook do
998
998
 
999
999
  it "should open one excel instance and workbook should be closed" do
1000
1000
  Workbook.unobtrusively(@simple_file1){ |book| nil }
1001
- Excel.excels_number.should == 1
1001
+ Excel.instance_count.should == 1
1002
1002
  end
1003
1003
 
1004
1004
  end
@@ -1019,97 +1019,97 @@ describe Workbook do
1019
1019
  it "should open read-write" do
1020
1020
  Workbook.unobtrusively(@simple_file1) do |book|
1021
1021
  book.ReadOnly.should be false
1022
- @old_value = book.sheet(1)[1,1].Value
1023
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1022
+ @old_value = book.sheet(1)[1,1]
1023
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1024
1024
  book.Saved.should be false
1025
1025
  end
1026
1026
  Excel.current.Workbooks.Count.should == 0
1027
1027
  b1 = Workbook.open(@simple_file1)
1028
- b1.sheet(1)[1,1].Value.should_not == @old_value
1028
+ b1.sheet(1)[1,1].should_not == @old_value
1029
1029
  end
1030
1030
 
1031
1031
  it "should open as read-write" do
1032
1032
  Workbook.unobtrusively(@simple_file, :read_only => false) do |book|
1033
1033
  book.ReadOnly.should be false
1034
- @old_value = book.sheet(1)[1,1].Value
1035
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1034
+ @old_value = book.sheet(1)[1,1]
1035
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1036
1036
  book.Saved.should be false
1037
1037
  end
1038
1038
  Excel.current.Workbooks.Count.should == 0
1039
1039
  b1 = Workbook.open(@simple_file1)
1040
- b1.sheet(1)[1,1].Value.should_not == @old_value
1040
+ b1.sheet(1)[1,1].should_not == @old_value
1041
1041
  end
1042
1042
 
1043
1043
  it "should open as read-write but not save changes" do
1044
1044
  Workbook.unobtrusively(@simple_file, :read_only => false, :writable => false) do |book|
1045
1045
  book.ReadOnly.should be false
1046
- @old_value = book.sheet(1)[1,1].Value
1047
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1046
+ @old_value = book.sheet(1)[1,1]
1047
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1048
1048
  book.Saved.should be false
1049
1049
  end
1050
1050
  Excel.current.Workbooks.Count.should == 0
1051
1051
  b1 = Workbook.open(@simple_file1)
1052
- b1.sheet(1)[1,1].Value.should == @old_value
1052
+ b1.sheet(1)[1,1].should == @old_value
1053
1053
  end
1054
1054
 
1055
1055
  it "should open as read-write" do
1056
1056
  Workbook.unobtrusively(@simple_file, :writable => true) do |book|
1057
1057
  book.ReadOnly.should be false
1058
- @old_value = book.sheet(1)[1,1].Value
1059
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1058
+ @old_value = book.sheet(1)[1,1]
1059
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1060
1060
  book.Saved.should be false
1061
1061
  end
1062
1062
  Excel.current.Workbooks.Count.should == 0
1063
1063
  b1 = Workbook.open(@simple_file1)
1064
- b1.sheet(1)[1,1].Value.should_not == @old_value
1064
+ b1.sheet(1)[1,1].should_not == @old_value
1065
1065
  end
1066
1066
 
1067
1067
  it "should open as read-write" do
1068
1068
  Workbook.unobtrusively(@simple_file, :writable => true, :read_only => false) do |book|
1069
1069
  book.ReadOnly.should be false
1070
- @old_value = book.sheet(1)[1,1].Value
1071
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1070
+ @old_value = book.sheet(1)[1,1]
1071
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1072
1072
  book.Saved.should be false
1073
1073
  end
1074
1074
  Excel.current.Workbooks.Count.should == 0
1075
1075
  b1 = Workbook.open(@simple_file1)
1076
- b1.sheet(1)[1,1].Value.should_not == @old_value
1076
+ b1.sheet(1)[1,1].should_not == @old_value
1077
1077
  end
1078
1078
 
1079
1079
  it "should open read-only" do
1080
1080
  Workbook.unobtrusively(@simple_file, :read_only => true) do |book|
1081
1081
  book.ReadOnly.should be true
1082
- @old_value = book.sheet(1)[1,1].Value
1083
- #book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1082
+ @old_value = book.sheet(1)[1,1]
1083
+ #book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1084
1084
  #book.Saved.should be false
1085
1085
  end
1086
1086
  Excel.current.Workbooks.Count.should == 0
1087
1087
  b1 = Workbook.open(@simple_file1)
1088
- b1.sheet(1)[1,1].Value.should == @old_value
1088
+ b1.sheet(1)[1,1].should == @old_value
1089
1089
  end
1090
1090
 
1091
1091
  it "should open read-only" do
1092
1092
  Workbook.unobtrusively(@simple_file, :read_only => true, :writable => false) do |book|
1093
1093
  book.ReadOnly.should be true
1094
- @old_value = book.sheet(1)[1,1].Value
1095
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1094
+ @old_value = book.sheet(1)[1,1]
1095
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1096
1096
  book.Saved.should be false
1097
1097
  end
1098
1098
  Excel.current.Workbooks.Count.should == 0
1099
1099
  b1 = Workbook.open(@simple_file1)
1100
- b1.sheet(1)[1,1].Value.should == @old_value
1100
+ b1.sheet(1)[1,1].should == @old_value
1101
1101
  end
1102
1102
 
1103
1103
  it "should open not writable and read-only" do
1104
1104
  Workbook.unobtrusively(@simple_file, :writable => false) do |book|
1105
1105
  book.ReadOnly.should be true
1106
- @old_value = book.sheet(1)[1,1].Value
1107
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1106
+ @old_value = book.sheet(1)[1,1]
1107
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1108
1108
  book.Saved.should be false
1109
1109
  end
1110
1110
  Excel.current.Workbooks.Count.should == 0
1111
1111
  b1 = Workbook.open(@simple_file1)
1112
- b1.sheet(1)[1,1].Value.should == @old_value
1112
+ b1.sheet(1)[1,1].should == @old_value
1113
1113
  end
1114
1114
 
1115
1115
  it "should raise error if both options are true" do
@@ -1123,7 +1123,7 @@ describe Workbook do
1123
1123
 
1124
1124
  before do
1125
1125
  @book = Workbook.open(@simple_file1)
1126
- @old_value = @book.sheet(1)[1,1].Value
1126
+ @old_value = @book.sheet(1)[1,1]
1127
1127
  end
1128
1128
 
1129
1129
  it "should open as read-write by default" do
@@ -1132,11 +1132,11 @@ describe Workbook do
1132
1132
  book.should == @book
1133
1133
  book.filename.should == @book.filename
1134
1134
  book.excel.should == @book.excel
1135
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1135
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1136
1136
  end
1137
1137
  @book.close
1138
1138
  book2 = Workbook.open(@simple_file1)
1139
- book2.sheet(1)[1,1].Value.should_not == @old_value
1139
+ book2.sheet(1)[1,1].should_not == @old_value
1140
1140
  end
1141
1141
 
1142
1142
  it "should open as read-write" do
@@ -1145,11 +1145,11 @@ describe Workbook do
1145
1145
  book.should == @book
1146
1146
  book.filename.should == @book.filename
1147
1147
  book.excel.should == @book.excel
1148
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1148
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1149
1149
  end
1150
1150
  @book.close
1151
1151
  book2 = Workbook.open(@simple_file1)
1152
- book2.sheet(1)[1,1].Value.should_not == @old_value
1152
+ book2.sheet(1)[1,1].should_not == @old_value
1153
1153
  end
1154
1154
 
1155
1155
  it "should open as read-write" do
@@ -1158,11 +1158,11 @@ describe Workbook do
1158
1158
  book.should == @book
1159
1159
  book.filename.should == @book.filename
1160
1160
  book.excel.should == @book.excel
1161
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1161
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1162
1162
  end
1163
1163
  @book.close
1164
1164
  book2 = Workbook.open(@simple_file1)
1165
- book2.sheet(1)[1,1].Value.should == @old_value
1165
+ book2.sheet(1)[1,1].should == @old_value
1166
1166
  end
1167
1167
 
1168
1168
  it "should open as read-write" do
@@ -1171,11 +1171,11 @@ describe Workbook do
1171
1171
  book.should == @book
1172
1172
  book.filename.should == @book.filename
1173
1173
  book.excel.should == @book.excel
1174
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1174
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1175
1175
  end
1176
1176
  @book.close
1177
1177
  book2 = Workbook.open(@simple_file1)
1178
- book2.sheet(1)[1,1].Value.should_not == @old_value
1178
+ book2.sheet(1)[1,1].should_not == @old_value
1179
1179
  end
1180
1180
 
1181
1181
  it "should open as read-write" do
@@ -1184,11 +1184,11 @@ describe Workbook do
1184
1184
  book.should == @book
1185
1185
  book.filename.should == @book.filename
1186
1186
  book.excel.should == @book.excel
1187
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1187
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1188
1188
  end
1189
1189
  @book.close
1190
1190
  book2 = Workbook.open(@simple_file1)
1191
- book2.sheet(1)[1,1].Value.should_not == @old_value
1191
+ book2.sheet(1)[1,1].should_not == @old_value
1192
1192
  end
1193
1193
 
1194
1194
  it "should force to read-only" do
@@ -1198,7 +1198,7 @@ describe Workbook do
1198
1198
  book.should == @book
1199
1199
  book.filename.should == @book.filename
1200
1200
  book.excel.should == @book.excel
1201
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1201
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1202
1202
  end
1203
1203
  }.to raise_error(WorkbookReadOnly)
1204
1204
  end
@@ -1212,11 +1212,11 @@ describe Workbook do
1212
1212
  book.should == @book
1213
1213
  book.filename.should == @book.filename
1214
1214
  book.excel.should == @book.excel
1215
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1215
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1216
1216
  end
1217
1217
  @book.close
1218
1218
  book2 = Workbook.open(@simple_file1)
1219
- book2.sheet(1)[1,1].Value.should == @old_value
1219
+ book2.sheet(1)[1,1].should == @old_value
1220
1220
  end
1221
1221
 
1222
1222
  it "should open not writable" do
@@ -1225,11 +1225,11 @@ describe Workbook do
1225
1225
  book.should == @book
1226
1226
  book.filename.should == @book.filename
1227
1227
  book.excel.should == @book.excel
1228
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1228
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1229
1229
  end
1230
1230
  @book.close
1231
1231
  book2 = Workbook.open(@simple_file1)
1232
- book2.sheet(1)[1,1].Value.should == @old_value
1232
+ book2.sheet(1)[1,1].should == @old_value
1233
1233
  end
1234
1234
  end
1235
1235
 
@@ -1237,23 +1237,23 @@ describe Workbook do
1237
1237
 
1238
1238
  before do
1239
1239
  @book = Workbook.open(@simple_file1, :read_only => true)
1240
- @old_value = @book.sheet(1)[1,1].Value
1240
+ @old_value = @book.sheet(1)[1,1]
1241
1241
  end
1242
1242
 
1243
1243
  it "should not write" do
1244
1244
  Workbook.unobtrusively(@simple_file1, :writable => false) do |book|
1245
1245
  book.Readonly.should be true
1246
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1247
- book.sheet(1)[1,1].Value.should_not == @old_value
1246
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1247
+ book.sheet(1)[1,1].should_not == @old_value
1248
1248
  end
1249
1249
  @book.ReadOnly.should be true
1250
1250
  @book.close
1251
1251
  Workbook.unobtrusively(@simple_file1, :writable => false) do |book|
1252
- book.sheet(1)[1,1].Value.should == @old_value
1252
+ book.sheet(1)[1,1].should == @old_value
1253
1253
  end
1254
1254
  #@book.close
1255
1255
  #book2 = Workbook.open(@simple_file1)
1256
- #book2.sheet(1)[1,1].Value.should == @old_value
1256
+ #book2.sheet(1)[1,1].should == @old_value
1257
1257
  end
1258
1258
 
1259
1259
  it "should not change the read_only mode" do
@@ -1262,12 +1262,12 @@ describe Workbook do
1262
1262
  book.should == @book
1263
1263
  book.filename.should == @book.filename
1264
1264
  book.excel.should == @book.excel
1265
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1265
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1266
1266
  end
1267
1267
  @book.ReadOnly.should be true
1268
1268
  @book.close
1269
1269
  book2 = Workbook.open(@simple_file1)
1270
- book2.sheet(1)[1,1].Value.should == @old_value
1270
+ book2.sheet(1)[1,1].should == @old_value
1271
1271
  end
1272
1272
 
1273
1273
  it "should open as read-write" do
@@ -1276,11 +1276,11 @@ describe Workbook do
1276
1276
  book.should == @book
1277
1277
  book.filename.should == @book.filename
1278
1278
  book.excel.should == @book.excel
1279
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1279
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1280
1280
  end
1281
1281
  @book.close
1282
1282
  book2 = Workbook.open(@simple_file1)
1283
- book2.sheet(1)[1,1].Value.should_not == @old_value
1283
+ book2.sheet(1)[1,1].should_not == @old_value
1284
1284
  end
1285
1285
 
1286
1286
  it "should open as read-write" do
@@ -1289,11 +1289,11 @@ describe Workbook do
1289
1289
  book.should == @book
1290
1290
  book.filename.should == @book.filename
1291
1291
  book.excel.should == @book.excel
1292
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1292
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1293
1293
  end
1294
1294
  @book.close
1295
1295
  book2 = Workbook.open(@simple_file1)
1296
- book2.sheet(1)[1,1].Value.should == @old_value
1296
+ book2.sheet(1)[1,1].should == @old_value
1297
1297
  end
1298
1298
 
1299
1299
  it "should remain read-only even if writeble => true" do
@@ -1302,11 +1302,11 @@ describe Workbook do
1302
1302
  book.should == @book
1303
1303
  book.filename.should == @book.filename
1304
1304
  book.excel.should == @book.excel
1305
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1305
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1306
1306
  end
1307
1307
  @book.close
1308
1308
  book2 = Workbook.open(@simple_file1)
1309
- book2.sheet(1)[1,1].Value.should == @old_value
1309
+ book2.sheet(1)[1,1].should == @old_value
1310
1310
  end
1311
1311
 
1312
1312
  it "should force to read-write" do
@@ -1315,11 +1315,11 @@ describe Workbook do
1315
1315
  book.should == @book
1316
1316
  book.filename.should == @book.filename
1317
1317
  book.excel.should == @book.excel
1318
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1318
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1319
1319
  end
1320
1320
  @book.close
1321
1321
  book2 = Workbook.open(@simple_file1)
1322
- book2.sheet(1)[1,1].Value.should_not == @old_value
1322
+ book2.sheet(1)[1,1].should_not == @old_value
1323
1323
  end
1324
1324
 
1325
1325
  =begin
@@ -1329,11 +1329,11 @@ describe Workbook do
1329
1329
  book.Readonly.should be false
1330
1330
  book.filename.should == @book.filename
1331
1331
  book.excel.should == e1
1332
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1332
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1333
1333
  end
1334
1334
  @book.close
1335
1335
  book2 = Workbook.open(@simple_file1)
1336
- book2.sheet(1)[1,1].Value.should_not == @old_value
1336
+ book2.sheet(1)[1,1].should_not == @old_value
1337
1337
  end
1338
1338
 
1339
1339
  it "should force to read-write" do
@@ -1342,11 +1342,11 @@ describe Workbook do
1342
1342
  book.should == @book
1343
1343
  book.filename.should == @book.filename
1344
1344
  book.excel.should == @book.excel
1345
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1345
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1346
1346
  end
1347
1347
  @book.close
1348
1348
  book2 = Workbook.open(@simple_file1)
1349
- book2.sheet(1)[1,1].Value.should_not == @old_value
1349
+ book2.sheet(1)[1,1].should_not == @old_value
1350
1350
  end
1351
1351
 
1352
1352
  it "should force to read-write" do
@@ -1354,11 +1354,11 @@ describe Workbook do
1354
1354
  book.Readonly.should be false
1355
1355
  book.filename.should == @book.filename
1356
1356
  book.excel.should_not == @book.excel
1357
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1357
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1358
1358
  end
1359
1359
  @book.close
1360
1360
  book2 = Workbook.open(@simple_file1)
1361
- book2.sheet(1)[1,1].Value.should_not == @old_value
1361
+ book2.sheet(1)[1,1].should_not == @old_value
1362
1362
  end
1363
1363
  =end
1364
1364
 
@@ -1368,11 +1368,11 @@ describe Workbook do
1368
1368
  book.should == @book
1369
1369
  book.filename.should == @book.filename
1370
1370
  book.excel.should == @book.excel
1371
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1371
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1372
1372
  end
1373
1373
  @book.close
1374
1374
  book2 = Workbook.open(@simple_file1)
1375
- book2.sheet(1)[1,1].Value.should_not == @old_value
1375
+ book2.sheet(1)[1,1].should_not == @old_value
1376
1376
  end
1377
1377
 
1378
1378
  it "should force to read-only" do
@@ -1381,11 +1381,11 @@ describe Workbook do
1381
1381
  book.should == @book
1382
1382
  book.filename.should == @book.filename
1383
1383
  book.excel.should == @book.excel
1384
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1384
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1385
1385
  end
1386
1386
  @book.close
1387
1387
  book2 = Workbook.open(@simple_file1)
1388
- book2.sheet(1)[1,1].Value.should == @old_value
1388
+ book2.sheet(1)[1,1].should == @old_value
1389
1389
  end
1390
1390
 
1391
1391
  it "should force to read-only" do
@@ -1394,11 +1394,11 @@ describe Workbook do
1394
1394
  book.should == @book
1395
1395
  book.filename.should == @book.filename
1396
1396
  book.excel.should == @book.excel
1397
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1397
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1398
1398
  end
1399
1399
  @book.close
1400
1400
  book2 = Workbook.open(@simple_file1)
1401
- book2.sheet(1)[1,1].Value.should == @old_value
1401
+ book2.sheet(1)[1,1].should == @old_value
1402
1402
  end
1403
1403
 
1404
1404
  it "should open not writable" do
@@ -1407,11 +1407,11 @@ describe Workbook do
1407
1407
  book.should == @book
1408
1408
  book.filename.should == @book.filename
1409
1409
  book.excel.should == @book.excel
1410
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1410
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1411
1411
  end
1412
1412
  @book.close
1413
1413
  book2 = Workbook.open(@simple_file1)
1414
- book2.sheet(1)[1,1].Value.should == @old_value
1414
+ book2.sheet(1)[1,1].should == @old_value
1415
1415
  end
1416
1416
  end
1417
1417
 
@@ -1419,8 +1419,8 @@ describe Workbook do
1419
1419
 
1420
1420
  before do
1421
1421
  @book = Workbook.open(@simple_file1)
1422
- @book.sheet(1)[1,1] = @book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1423
- @old_value = @book.sheet(1)[1,1].Value
1422
+ @book.sheet(1)[1,1] = @book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1423
+ @old_value = @book.sheet(1)[1,1]
1424
1424
  end
1425
1425
 
1426
1426
  it "should open as read-write by default" do
@@ -1429,10 +1429,10 @@ describe Workbook do
1429
1429
  book.should == @book
1430
1430
  book.filename.should == @book.filename
1431
1431
  book.excel.should == @book.excel
1432
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1432
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1433
1433
  end
1434
1434
  @book.Saved.should be false
1435
- @book.sheet(1)[1,1].Value.should_not == @old_value
1435
+ @book.sheet(1)[1,1].should_not == @old_value
1436
1436
  end
1437
1437
 
1438
1438
  it "should open as read-write" do
@@ -1441,10 +1441,10 @@ describe Workbook do
1441
1441
  book.should == @book
1442
1442
  book.filename.should == @book.filename
1443
1443
  book.excel.should == @book.excel
1444
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1444
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1445
1445
  end
1446
1446
  @book.Saved.should be false
1447
- @book.sheet(1)[1,1].Value.should_not == @old_value
1447
+ @book.sheet(1)[1,1].should_not == @old_value
1448
1448
  end
1449
1449
 
1450
1450
  it "should open as read-write" do
@@ -1453,10 +1453,10 @@ describe Workbook do
1453
1453
  book.should == @book
1454
1454
  book.filename.should == @book.filename
1455
1455
  book.excel.should == @book.excel
1456
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1456
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1457
1457
  end
1458
1458
  @book.Saved.should be false
1459
- @book.sheet(1)[1,1].Value.should_not == @old_value
1459
+ @book.sheet(1)[1,1].should_not == @old_value
1460
1460
  end
1461
1461
 
1462
1462
  it "should force to read-write" do
@@ -1465,10 +1465,10 @@ describe Workbook do
1465
1465
  book.should == @book
1466
1466
  book.filename.should == @book.filename
1467
1467
  book.excel.should == @book.excel
1468
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1468
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1469
1469
  end
1470
1470
  @book.Saved.should be false
1471
- @book.sheet(1)[1,1].Value.should_not == @old_value
1471
+ @book.sheet(1)[1,1].should_not == @old_value
1472
1472
  end
1473
1473
 
1474
1474
  it "should force to read-write" do
@@ -1477,10 +1477,10 @@ describe Workbook do
1477
1477
  book.should == @book
1478
1478
  book.filename.should == @book.filename
1479
1479
  book.excel.should == @book.excel
1480
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1480
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1481
1481
  end
1482
1482
  @book.Saved.should be false
1483
- @book.sheet(1)[1,1].Value.should_not == @old_value
1483
+ @book.sheet(1)[1,1].should_not == @old_value
1484
1484
  end
1485
1485
 
1486
1486
  it "should force to read-only" do
@@ -1489,7 +1489,7 @@ describe Workbook do
1489
1489
  end
1490
1490
  @book.Saved.should be false
1491
1491
  @book.ReadOnly.should be false
1492
- @book.sheet(1)[1,1].Value.should == @old_value
1492
+ @book.sheet(1)[1,1].should == @old_value
1493
1493
  end
1494
1494
 
1495
1495
  it "should force to read-only with writable false" do
@@ -1498,7 +1498,7 @@ describe Workbook do
1498
1498
  end
1499
1499
  @book.Saved.should be false
1500
1500
  @book.ReadOnly.should be false
1501
- @book.sheet(1)[1,1].Value.should == @old_value
1501
+ @book.sheet(1)[1,1].should == @old_value
1502
1502
  end
1503
1503
 
1504
1504
  it "should open not writable" do
@@ -1507,13 +1507,13 @@ describe Workbook do
1507
1507
  book.should == @book
1508
1508
  book.filename.should == @book.filename
1509
1509
  book.excel.should == @book.excel
1510
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1510
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1511
1511
  end
1512
1512
  @book.Saved.should be false
1513
- @book.sheet(1)[1,1].Value.should_not == @old_value
1513
+ @book.sheet(1)[1,1].should_not == @old_value
1514
1514
  @book.close(:if_unsaved => :forget)
1515
1515
  book2 = Workbook.open(@simple_file1)
1516
- book2.sheet(1)[1,1].Value.should_not == @old_value
1516
+ book2.sheet(1)[1,1].should_not == @old_value
1517
1517
  end
1518
1518
  end
1519
1519
 
@@ -1521,8 +1521,8 @@ describe Workbook do
1521
1521
 
1522
1522
  before do
1523
1523
  @book = Workbook.open(@simple_file1, :read_only => true)
1524
- @book.sheet(1)[1,1] = @book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1525
- @old_value = @book.sheet(1)[1,1].Value
1524
+ @book.sheet(1)[1,1] = @book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1525
+ @old_value = @book.sheet(1)[1,1]
1526
1526
  end
1527
1527
 
1528
1528
  it "should open as read-only by default" do
@@ -1531,14 +1531,14 @@ describe Workbook do
1531
1531
  book.should == @book
1532
1532
  book.filename.should == @book.filename
1533
1533
  book.excel.should == @book.excel
1534
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1534
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1535
1535
  end
1536
1536
  @book.Saved.should be false
1537
1537
  @book.ReadOnly.should be true
1538
- @book.sheet(1)[1,1].Value.should_not == @old_value
1538
+ @book.sheet(1)[1,1].should_not == @old_value
1539
1539
  @book.close
1540
1540
  book2 = Workbook.open(@simple_file1)
1541
- book2.sheet(1)[1,1].Value.should_not == @old_value
1541
+ book2.sheet(1)[1,1].should_not == @old_value
1542
1542
  end
1543
1543
 
1544
1544
  it "should open as read-only" do
@@ -1551,13 +1551,13 @@ describe Workbook do
1551
1551
  Workbook.unobtrusively(@simple_file1, :writable => true) do |book|
1552
1552
  book.Readonly.should be true
1553
1553
  book.Saved.should be false
1554
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1554
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1555
1555
  end
1556
1556
  @book.ReadOnly.should be true
1557
- @book.sheet(1)[1,1].Value.should_not == @old_value
1557
+ @book.sheet(1)[1,1].should_not == @old_value
1558
1558
  @book.close
1559
1559
  book2 = Workbook.open(@simple_file1)
1560
- book2.sheet(1)[1,1].Value.should_not == @old_value
1560
+ book2.sheet(1)[1,1].should_not == @old_value
1561
1561
  end
1562
1562
 
1563
1563
  it "should force to read-only" do
@@ -1566,14 +1566,14 @@ describe Workbook do
1566
1566
  book.should == @book
1567
1567
  book.filename.should == @book.filename
1568
1568
  book.excel.should == @book.excel
1569
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1569
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1570
1570
  end
1571
1571
  @book.Saved.should be false
1572
1572
  @book.ReadOnly.should be true
1573
- @book.sheet(1)[1,1].Value.should_not == @old_value
1573
+ @book.sheet(1)[1,1].should_not == @old_value
1574
1574
  @book.close
1575
1575
  book2 = Workbook.open(@simple_file1)
1576
- book2.sheet(1)[1,1].Value.should_not == @old_value
1576
+ book2.sheet(1)[1,1].should_not == @old_value
1577
1577
  end
1578
1578
 
1579
1579
  it "should force to read-only" do
@@ -1582,14 +1582,14 @@ describe Workbook do
1582
1582
  book.should == @book
1583
1583
  book.filename.should == @book.filename
1584
1584
  book.excel.should == @book.excel
1585
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1585
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1586
1586
  end
1587
1587
  @book.Saved.should be false
1588
1588
  @book.ReadOnly.should be true
1589
- @book.sheet(1)[1,1].Value.should_not == @old_value
1589
+ @book.sheet(1)[1,1].should_not == @old_value
1590
1590
  @book.close
1591
1591
  book2 = Workbook.open(@simple_file1)
1592
- book2.sheet(1)[1,1].Value.should_not == @old_value
1592
+ book2.sheet(1)[1,1].should_not == @old_value
1593
1593
  end
1594
1594
 
1595
1595
  it "should open not writable" do
@@ -1598,14 +1598,14 @@ describe Workbook do
1598
1598
  book.should == @book
1599
1599
  book.filename.should == @book.filename
1600
1600
  book.excel.should == @book.excel
1601
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1601
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1602
1602
  end
1603
1603
  @book.Saved.should be false
1604
1604
  @book.ReadOnly.should be true
1605
- @book.sheet(1)[1,1].Value.should_not == @old_value
1605
+ @book.sheet(1)[1,1].should_not == @old_value
1606
1606
  @book.close
1607
1607
  book2 = Workbook.open(@simple_file1)
1608
- book2.sheet(1)[1,1].Value.should_not == @old_value
1608
+ book2.sheet(1)[1,1].should_not == @old_value
1609
1609
  end
1610
1610
  end
1611
1611
 
@@ -1639,94 +1639,94 @@ describe Workbook do
1639
1639
 
1640
1640
  it "should write in the outer and inner block" do
1641
1641
  Workbook.unobtrusively(@simple_file1) do |book|
1642
- @old_value = book.sheet(1)[1,1].Value
1642
+ @old_value = book.sheet(1)[1,1]
1643
1643
  book.ReadOnly.should be false
1644
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1644
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1645
1645
  book.Saved.should be false
1646
- book.sheet(1)[1,1].Value.should_not == @old_value
1646
+ book.sheet(1)[1,1].should_not == @old_value
1647
1647
  Workbook.unobtrusively(@simple_file1) do |book2|
1648
1648
  book2.should == book
1649
1649
  book2.ReadOnly.should be false
1650
1650
  book2.Saved.should be false
1651
- book2.sheet(1)[1,1].Value.should_not == @old_value
1652
- book2.sheet(1)[1,1] = book2.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1653
- book2.sheet(1)[1,1].Value.should == @old_value
1651
+ book2.sheet(1)[1,1].should_not == @old_value
1652
+ book2.sheet(1)[1,1] = book2.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1653
+ book2.sheet(1)[1,1].should == @old_value
1654
1654
  end
1655
1655
  book.should be_alive
1656
1656
  book.Saved.should be false
1657
- book.sheet(1)[1,1].Value.should == @old_value
1657
+ book.sheet(1)[1,1].should == @old_value
1658
1658
  end
1659
1659
  book = Workbook.open(@simple_file1)
1660
- book.sheet(1)[1,1].Value.should == @old_value
1660
+ book.sheet(1)[1,1].should == @old_value
1661
1661
  end
1662
1662
  =begin
1663
1663
  it "should write in the outer and not in the inner block" do
1664
1664
  Workbook.unobtrusively(@simple_file1, :if_unsaved => :forget) do |book|
1665
- @old_value = book.sheet(1)[1,1].Value
1665
+ @old_value = book.sheet(1)[1,1]
1666
1666
  book.ReadOnly.should be false
1667
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1667
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1668
1668
  book.Saved.should be false
1669
- book.sheet(1)[1,1].Value.should_not == @old_value
1669
+ book.sheet(1)[1,1].should_not == @old_value
1670
1670
  Workbook.unobtrusively(@simple_file1, :if_unsaved => :forget, :read_only => true) do |book2|
1671
1671
  book2.should == book
1672
1672
  book2.ReadOnly.should be true
1673
1673
  book2.Saved.should be true
1674
- book2.sheet(1)[1,1] = book2.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1675
- #book2.sheet(1)[1,1].Value.should_not == @old_value
1674
+ book2.sheet(1)[1,1] = book2.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1675
+ #book2.sheet(1)[1,1].should_not == @old_value
1676
1676
  end
1677
1677
  book.should be_alive
1678
1678
  book.Saved.should be false
1679
- book.sheet(1)[1,1].Value.should_not == @old_value
1679
+ book.sheet(1)[1,1].should_not == @old_value
1680
1680
  end
1681
1681
  book = Workbook.open(@simple_file1)
1682
- book.sheet(1)[1,1].Value.should_not == @old_value
1682
+ book.sheet(1)[1,1].should_not == @old_value
1683
1683
  end
1684
1684
  =end
1685
1685
  it "should write in the outer and not in the inner block" do
1686
1686
  Workbook.unobtrusively(@simple_file1) do |book|
1687
- @old_value = book.sheet(1)[1,1].Value
1687
+ @old_value = book.sheet(1)[1,1]
1688
1688
  book.ReadOnly.should be false
1689
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1689
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1690
1690
  book.Saved.should be false
1691
- book.sheet(1)[1,1].Value.should_not == @old_value
1691
+ book.sheet(1)[1,1].should_not == @old_value
1692
1692
  Workbook.unobtrusively(@simple_file1, :writable => false) do |book2|
1693
1693
  book2.should == book
1694
1694
  book2.ReadOnly.should be false
1695
1695
  book2.Saved.should be false
1696
- book2.sheet(1)[1,1].Value.should_not == @old_value
1697
- book2.sheet(1)[1,1] = book2.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1698
- book2.sheet(1)[1,1].Value.should == @old_value
1696
+ book2.sheet(1)[1,1].should_not == @old_value
1697
+ book2.sheet(1)[1,1] = book2.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1698
+ book2.sheet(1)[1,1].should == @old_value
1699
1699
  end
1700
1700
  book.should be_alive
1701
1701
  book.Saved.should be false
1702
- book.sheet(1)[1,1].Value.should == @old_value
1702
+ book.sheet(1)[1,1].should == @old_value
1703
1703
  end
1704
1704
  book = Workbook.open(@simple_file1)
1705
- book.sheet(1)[1,1].Value.should == @old_value
1705
+ book.sheet(1)[1,1].should == @old_value
1706
1706
  end
1707
1707
  =begin
1708
1708
  it "should be read-only in the outer and write in the inner block" do
1709
1709
  Workbook.unobtrusively(@simple_file1, :read_only => true, :if_unsaved => :save) do |book|
1710
- @old_value = book.sheet(1)[1,1].Value
1710
+ @old_value = book.sheet(1)[1,1]
1711
1711
  book.ReadOnly.should be true
1712
- book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1712
+ book.sheet(1)[1,1] = book.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1713
1713
  book.Saved.should be false
1714
- book.sheet(1)[1,1].Value.should_not == @old_value
1714
+ book.sheet(1)[1,1].should_not == @old_value
1715
1715
  Workbook.unobtrusively(@simple_file1, :if_unsaved => :save) do |book2|
1716
1716
  book2.should == book
1717
1717
  book2.ReadOnly.should be true
1718
1718
  book2.Saved.should be false
1719
- book2.sheet(1)[1,1].Value.should_not == @old_value
1720
- book2.sheet(1)[1,1] = book2.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1721
- book2.sheet(1)[1,1].Value.should == @old_value
1719
+ book2.sheet(1)[1,1].should_not == @old_value
1720
+ book2.sheet(1)[1,1] = book2.sheet(1)[1,1] == "foo" ? "bar" : "foo"
1721
+ book2.sheet(1)[1,1].should == @old_value
1722
1722
  end
1723
1723
  book.should be_alive
1724
1724
  book.Saved.should be false
1725
1725
  book.ReadOnly.should be true
1726
- book.sheet(1)[1,1].Value.should == @old_value
1726
+ book.sheet(1)[1,1].should == @old_value
1727
1727
  end
1728
1728
  book = Workbook.open(@simple_file1)
1729
- book.sheet(1)[1,1].Value.should == @old_value
1729
+ book.sheet(1)[1,1].should == @old_value
1730
1730
  end
1731
1731
  =end
1732
1732
  end
@@ -1772,31 +1772,31 @@ describe Workbook do
1772
1772
 
1773
1773
  it "should write and remain read_only and open the workbook in another Excel" do
1774
1774
  book1 = Workbook.open(@simple_file1, :read_only => true)
1775
- old_value = book1.sheet(1)[1,1].Value
1775
+ old_value = book1.sheet(1)[1,1]
1776
1776
  Workbook.unobtrusively(@simple_file1) do |book|
1777
1777
  sheet = book.sheet(1)
1778
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
1778
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
1779
1779
  book.excel.should == book1.excel
1780
1780
  end
1781
1781
  book1.ReadOnly.should be true
1782
1782
  book1.close
1783
1783
  book2 = Workbook.open(@simple_file1)
1784
- book2.sheet(1)[1,1].Value.should == old_value
1784
+ book2.sheet(1)[1,1].should == old_value
1785
1785
  end
1786
1786
 
1787
1787
  it "should write and remain read_only and open the workbook in the same Excel" do
1788
1788
  book1 = Workbook.open(@simple_file1, :read_only => true)
1789
- old_value = book1.sheet(1)[1,1].Value
1789
+ old_value = book1.sheet(1)[1,1]
1790
1790
  Workbook.unobtrusively(@simple_file1, :writable => true) do |book|
1791
1791
  book.ReadOnly.should be true
1792
1792
  sheet = book.sheet(1)
1793
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
1793
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
1794
1794
  book.excel.should == book1.excel
1795
1795
  end
1796
1796
  book1.ReadOnly.should be true
1797
1797
  book1.close
1798
1798
  book2 = Workbook.open(@simple_file1)
1799
- book2.sheet(1)[1,1].Value.should == old_value
1799
+ book2.sheet(1)[1,1].should == old_value
1800
1800
  end
1801
1801
 
1802
1802
  end
@@ -1995,18 +1995,18 @@ describe Workbook do
1995
1995
  @book.Saved.should be true
1996
1996
  @book.should be_alive
1997
1997
  sheet = @book.sheet(1)
1998
- old_cell_value = sheet[1,1].Value
1998
+ old_cell_value = sheet[1,1]
1999
1999
  unobtrusively_ok?
2000
2000
  @book.Saved.should be true
2001
2001
  @book.should be_alive
2002
2002
  sheet = @book.sheet(1)
2003
- sheet[1,1].Value.should_not == old_cell_value
2003
+ sheet[1,1].should_not == old_cell_value
2004
2004
  end
2005
2005
 
2006
2006
  it "should let the unsaved book unsaved" do
2007
2007
  sheet = @book.sheet(1)
2008
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2009
- old_cell_value = sheet[1,1].Value
2008
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2009
+ old_cell_value = sheet[1,1]
2010
2010
  @book.Saved.should be false
2011
2011
  unobtrusively_ok?
2012
2012
  @book.should be_alive
@@ -2014,7 +2014,7 @@ describe Workbook do
2014
2014
  @book.close(:if_unsaved => :forget)
2015
2015
  @book2 = Workbook.open(@simple_file1)
2016
2016
  sheet2 = @book2.sheet(1)
2017
- sheet2[1,1].Value.should_not == old_cell_value
2017
+ sheet2[1,1].should_not == old_cell_value
2018
2018
  end
2019
2019
 
2020
2020
  it "should modify unobtrusively the second, writable book" do
@@ -2022,8 +2022,8 @@ describe Workbook do
2022
2022
  @book.ReadOnly.should be false
2023
2023
  @book2.ReadOnly.should be true
2024
2024
  sheet = @book2.sheet(1)
2025
- old_cell_value = sheet[1,1].Value
2026
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2025
+ old_cell_value = sheet[1,1]
2026
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2027
2027
  unobtrusively_ok?
2028
2028
  @book2.should be_alive
2029
2029
  @book2.Saved.should be false
@@ -2031,7 +2031,7 @@ describe Workbook do
2031
2031
  @book.close
2032
2032
  new_book = Workbook.open(@simple_file1)
2033
2033
  sheet2 = new_book.sheet(1)
2034
- sheet2[1,1].Value.should_not == old_cell_value
2034
+ sheet2[1,1].should_not == old_cell_value
2035
2035
  end
2036
2036
  end
2037
2037
 
@@ -2048,21 +2048,21 @@ describe Workbook do
2048
2048
 
2049
2049
  it "should let the closed book closed by default" do
2050
2050
  sheet = @book.sheet(1)
2051
- old_cell_value = sheet[1,1].Value
2051
+ old_cell_value = sheet[1,1]
2052
2052
  @book.close
2053
2053
  @book.should_not be_alive
2054
2054
  unobtrusively_ok?
2055
2055
  @book.should_not be_alive
2056
2056
  new_book = Workbook.open(@simple_file1)
2057
2057
  sheet = new_book.sheet(1)
2058
- sheet[1,1].Value.should_not == old_cell_value
2058
+ sheet[1,1].should_not == old_cell_value
2059
2059
  end
2060
2060
 
2061
2061
  # The bold reanimation of the @book
2062
2062
  it "should use the excel of the book and keep open the book" do
2063
2063
  excel = Excel.new(:reuse => false)
2064
2064
  sheet = @book.sheet(1)
2065
- old_cell_value = sheet[1,1].Value
2065
+ old_cell_value = sheet[1,1]
2066
2066
  @book.close
2067
2067
  @book.should_not be_alive
2068
2068
  Workbook.unobtrusively(@simple_file, :keep_open => true) do |book|
@@ -2071,21 +2071,21 @@ describe Workbook do
2071
2071
  book.excel.should_not == excel
2072
2072
  sheet = book.sheet(1)
2073
2073
  cell = sheet[1,1]
2074
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2074
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2075
2075
  book.Saved.should be false
2076
2076
  end
2077
2077
  @book.should be_alive
2078
2078
  @book.close
2079
2079
  new_book = Workbook.open(@simple_file1)
2080
2080
  sheet = new_book.sheet(1)
2081
- sheet[1,1].Value.should_not == old_cell_value
2081
+ sheet[1,1].should_not == old_cell_value
2082
2082
  end
2083
2083
 
2084
2084
  # book shall be reanimated
2085
2085
  it "should use the excel of the book and keep open the book" do
2086
2086
  excel = Excel.new(:reuse => false)
2087
2087
  sheet = @book.sheet(1)
2088
- old_cell_value = sheet[1,1].Value
2088
+ old_cell_value = sheet[1,1]
2089
2089
  @book.close
2090
2090
  @book.should_not be_alive
2091
2091
  Workbook.unobtrusively(@simple_file, :if_closed => :new) do |book|
@@ -2095,38 +2095,38 @@ describe Workbook do
2095
2095
  book.excel.should_not == excel
2096
2096
  sheet = book.sheet(1)
2097
2097
  cell = sheet[1,1]
2098
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2098
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2099
2099
  book.Saved.should be false
2100
2100
  end
2101
2101
  @book.should_not be_alive
2102
2102
  new_book = Workbook.open(@simple_file1)
2103
2103
  sheet = new_book.sheet(1)
2104
- sheet[1,1].Value.should_not == old_cell_value
2104
+ sheet[1,1].should_not == old_cell_value
2105
2105
  end
2106
2106
 
2107
2107
  it "should use another excel if the Excels are closed" do
2108
2108
  sheet = @book.sheet(1)
2109
- old_cell_value = sheet[1,1].Value
2109
+ old_cell_value = sheet[1,1]
2110
2110
  @book.close
2111
2111
  @book.should_not be_alive
2112
2112
  Workbook.unobtrusively(@simple_file, :keep_open => true) do |book|
2113
2113
  book.should be_a Workbook
2114
2114
  sheet = book.sheet(1)
2115
2115
  cell = sheet[1,1]
2116
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2116
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2117
2117
  book.Saved.should be false
2118
2118
  end
2119
2119
  @book.should be_alive
2120
2120
  @book.close
2121
2121
  new_book = Workbook.open(@simple_file1)
2122
2122
  sheet = new_book.sheet(1)
2123
- sheet[1,1].Value.should_not == old_cell_value
2123
+ sheet[1,1].should_not == old_cell_value
2124
2124
  end
2125
2125
 
2126
2126
  it "should use another excel if the Excels are closed" do
2127
2127
  excel = Excel.new(:reuse => false)
2128
2128
  sheet = @book.sheet(1)
2129
- old_cell_value = sheet[1,1].Value
2129
+ old_cell_value = sheet[1,1]
2130
2130
  @book.close
2131
2131
  @book.should_not be_alive
2132
2132
  Excel.kill_all
@@ -2136,33 +2136,33 @@ describe Workbook do
2136
2136
  book.excel.should_not == excel
2137
2137
  sheet = book.sheet(1)
2138
2138
  cell = sheet[1,1]
2139
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2139
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2140
2140
  book.Saved.should be false
2141
2141
  end
2142
2142
  @book.should_not be_alive
2143
2143
  new_book = Workbook.open(@simple_file1)
2144
2144
  sheet = new_book.sheet(1)
2145
- sheet[1,1].Value.should_not == old_cell_value
2145
+ sheet[1,1].should_not == old_cell_value
2146
2146
  end
2147
2147
 
2148
2148
  it "should modify unobtrusively the copied file" do
2149
2149
  sheet = @book.sheet(1)
2150
- old_cell_value = sheet[1,1].Value
2150
+ old_cell_value = sheet[1,1]
2151
2151
  File.delete simple_save_file rescue nil
2152
2152
  @book.save_as(@simple_save_file)
2153
2153
  @book.close
2154
2154
  Workbook.unobtrusively(@simple_save_file) do |book|
2155
2155
  sheet = book.sheet(1)
2156
2156
  cell = sheet[1,1]
2157
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2157
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2158
2158
  end
2159
2159
  old_book = Workbook.open(@simple_file1)
2160
2160
  old_sheet = old_book.sheet(1)
2161
- old_sheet[1,1].Value.should == old_cell_value
2161
+ old_sheet[1,1].should == old_cell_value
2162
2162
  old_book.close
2163
2163
  new_book = Workbook.open(@simple_save_file)
2164
2164
  new_sheet = new_book.sheet(1)
2165
- new_sheet[1,1].Value.should_not == old_cell_value
2165
+ new_sheet[1,1].should_not == old_cell_value
2166
2166
  new_book.close
2167
2167
  end
2168
2168
  end
@@ -2259,7 +2259,7 @@ describe Workbook do
2259
2259
  @book.ReadOnly.should be true
2260
2260
  @book.Saved.should be true
2261
2261
  sheet = @book.sheet(1)
2262
- old_cell_value = sheet[1,1].Value
2262
+ old_cell_value = sheet[1,1]
2263
2263
  unobtrusively_ok?
2264
2264
  @book.should be_alive
2265
2265
  @book.Saved.should be true
@@ -2267,20 +2267,20 @@ describe Workbook do
2267
2267
  @book.close
2268
2268
  book2 = Workbook.open(@simple_file1)
2269
2269
  sheet2 = book2.sheet(1)
2270
- sheet2[1,1].Value.should == old_cell_value
2270
+ sheet2[1,1].should == old_cell_value
2271
2271
  end
2272
2272
 
2273
2273
  it "should let the unsaved book unsaved" do
2274
2274
  @book.ReadOnly.should be true
2275
2275
  sheet = @book.sheet(1)
2276
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2276
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2277
2277
  @book.Saved.should be false
2278
2278
  @book.should be_alive
2279
2279
  Workbook.unobtrusively(@simple_file1) do |book|
2280
2280
  book.should be_a Workbook
2281
2281
  sheet = book.sheet(1)
2282
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2283
- @cell_value = sheet[1,1].Value
2282
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2283
+ @cell_value = sheet[1,1]
2284
2284
  book.should be_alive
2285
2285
  book.Saved.should be false
2286
2286
  end
@@ -2291,7 +2291,7 @@ describe Workbook do
2291
2291
  book2 = Workbook.open(@simple_file1)
2292
2292
  sheet2 = book2.sheet(1)
2293
2293
  # modifies unobtrusively the saved version, not the unsaved version
2294
- sheet2[1,1].Value.should == @cell_value
2294
+ sheet2[1,1].should == @cell_value
2295
2295
  end
2296
2296
 
2297
2297
  it "should open unobtrusively by default the writable book" do
@@ -2299,13 +2299,13 @@ describe Workbook do
2299
2299
  @book.ReadOnly.should be true
2300
2300
  book2.Readonly.should be false
2301
2301
  sheet = @book.sheet(1)
2302
- cell_value = sheet[1,1].Value
2302
+ cell_value = sheet[1,1]
2303
2303
  Workbook.unobtrusively(@simple_file1, :if_closed => :new) do |book|
2304
2304
  book.should be_a Workbook
2305
2305
  book.excel.should == book2.excel
2306
2306
  book.excel.should_not == @book.excel
2307
2307
  sheet = book.sheet(1)
2308
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2308
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2309
2309
  book.should be_alive
2310
2310
  book.Saved.should be false
2311
2311
  end
@@ -2315,7 +2315,7 @@ describe Workbook do
2315
2315
  book2.close
2316
2316
  book3 = Workbook.open(@simple_file1)
2317
2317
  new_sheet = book3.sheet(1)
2318
- new_sheet[1,1].Value.should_not == cell_value
2318
+ new_sheet[1,1].should_not == cell_value
2319
2319
  book3.close
2320
2320
  end
2321
2321
 
@@ -2327,7 +2327,7 @@ describe Workbook do
2327
2327
  @book.ReadOnly.should be true
2328
2328
  book2.Readonly.should be true
2329
2329
  sheet = @book.sheet(1)
2330
- cell_value = sheet[1,1].Value
2330
+ cell_value = sheet[1,1]
2331
2331
  Workbook.unobtrusively(@simple_file1, :writable => true, :if_closed => :new, :rw_change_excel => :new) do |book|
2332
2332
  book.should be_a Workbook
2333
2333
  book.ReadOnly.should be false
@@ -2336,7 +2336,7 @@ describe Workbook do
2336
2336
  book.excel.should_not == excel1
2337
2337
  book.excel.should_not == excel2
2338
2338
  sheet = book.sheet(1)
2339
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2339
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2340
2340
  book.should be_alive
2341
2341
  book.Saved.should be false
2342
2342
  end
@@ -2346,7 +2346,7 @@ describe Workbook do
2346
2346
  book2.close
2347
2347
  book3 = Workbook.open(@simple_file1)
2348
2348
  new_sheet = book3.sheet(1)
2349
- new_sheet[1,1].Value.should_not == cell_value
2349
+ new_sheet[1,1].should_not == cell_value
2350
2350
  book3.close
2351
2351
  end
2352
2352
 
@@ -2357,13 +2357,13 @@ describe Workbook do
2357
2357
  @book.ReadOnly.should be true
2358
2358
  book2.Readonly.should be true
2359
2359
  sheet = @book.sheet(1)
2360
- cell_value = sheet[1,1].Value
2360
+ cell_value = sheet[1,1]
2361
2361
  Workbook.unobtrusively(@simple_file1, :writable => true, :if_closed => :new, :rw_change_excel => :current) do |book|
2362
2362
  book.should be_a Workbook
2363
2363
  book.excel.should == book2.excel
2364
2364
  book.ReadOnly.should be false
2365
2365
  sheet = book.sheet(1)
2366
- sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
2366
+ sheet[1,1] = sheet[1,1] == "foo" ? "bar" : "foo"
2367
2367
  book.should be_alive
2368
2368
  book.Saved.should be false
2369
2369
  end
@@ -2373,7 +2373,7 @@ describe Workbook do
2373
2373
  book2.close
2374
2374
  book3 = Workbook.open(@simple_file1)
2375
2375
  new_sheet = book3.sheet(1)
2376
- new_sheet[1,1].Value.should_not == cell_value
2376
+ new_sheet[1,1].should_not == cell_value
2377
2377
  book3.close
2378
2378
  end
2379
2379
  =end
@@ -2383,7 +2383,7 @@ describe Workbook do
2383
2383
  @book.ReadOnly.should be true
2384
2384
  book2.Readonly.should be true
2385
2385
  sheet = @book.sheet(1)
2386
- cell_value = sheet[1,1].Value
2386
+ cell_value = sheet[1,1]
2387
2387
  Workbook.unobtrusively(@simple_file1, :if_closed => :new, :read_only => true) do |book|
2388
2388
  book.should be_a Workbook
2389
2389
  book.excel.should == book2.excel
@@ -2439,7 +2439,7 @@ describe Workbook do
2439
2439
  book.Saved.should be true
2440
2440
  sheet = book.sheet(1)
2441
2441
  cell = sheet[1,1]
2442
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2442
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2443
2443
  @book1.Saved.should be false
2444
2444
  book.Saved.should be false
2445
2445
  sleep 1
@@ -2487,11 +2487,11 @@ describe Workbook do
2487
2487
 
2488
2488
  it "should yield the block result with an unmodified book" do
2489
2489
  sheet1 = @book1.sheet(1)
2490
- cell1 = sheet1[1,1].Value
2490
+ cell1 = sheet1[1,1]
2491
2491
  result =
2492
2492
  Workbook.unobtrusively(@simple_file1) do |book|
2493
2493
  sheet = book.sheet(1)
2494
- cell = sheet[1,1].Value
2494
+ cell = sheet[1,1]
2495
2495
  end
2496
2496
  result.should == cell1
2497
2497
  end
@@ -2519,7 +2519,7 @@ describe Workbook do
2519
2519
  @book1.Readonly.should == false
2520
2520
  @book2.Readonly.should == true
2521
2521
  old_sheet = @book1.sheet(1)
2522
- @old_cell_value = old_sheet[1,1].Value
2522
+ @old_cell_value = old_sheet[1,1]
2523
2523
  @book1.close
2524
2524
  @book2.close
2525
2525
  @book1.should_not be_alive
@@ -2533,12 +2533,12 @@ describe Workbook do
2533
2533
  book.ReadOnly.should == false
2534
2534
  sheet = book.sheet(1)
2535
2535
  cell = sheet[1,1]
2536
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2536
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2537
2537
  book.Saved.should be false
2538
2538
  end
2539
2539
  new_book = Workbook.open(@simple_file1)
2540
2540
  sheet = new_book.sheet(1)
2541
- sheet[1,1].Value.should_not == @old_cell_value
2541
+ sheet[1,1].should_not == @old_cell_value
2542
2542
  end
2543
2543
 
2544
2544
  it "should open unobtrusively the closed book in the new Excel" do
@@ -2548,12 +2548,12 @@ describe Workbook do
2548
2548
  book.ReadOnly.should == false
2549
2549
  sheet = book.sheet(1)
2550
2550
  cell = sheet[1,1]
2551
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2551
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2552
2552
  book.Saved.should be false
2553
2553
  end
2554
2554
  new_book = Workbook.open(@simple_file1)
2555
2555
  sheet = new_book.sheet(1)
2556
- sheet[1,1].Value.should_not == @old_cell_value
2556
+ sheet[1,1].should_not == @old_cell_value
2557
2557
  end
2558
2558
 
2559
2559
  it "should open unobtrusively the closed book in a new Excel if the Excel is not alive anymore" do
@@ -2564,12 +2564,12 @@ describe Workbook do
2564
2564
  book.excel.should_not == @book2.excel
2565
2565
  sheet = book.sheet(1)
2566
2566
  cell = sheet[1,1]
2567
- sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
2567
+ sheet[1,1] = cell == "foo" ? "bar" : "foo"
2568
2568
  book.Saved.should be false
2569
2569
  end
2570
2570
  new_book = Workbook.open(@simple_file1)
2571
2571
  sheet = new_book.sheet(1)
2572
- sheet[1,1].Value.should_not == @old_cell_value
2572
+ sheet[1,1].should_not == @old_cell_value
2573
2573
  end
2574
2574
  end
2575
2575
  end