robust_excel_ole 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +1 -0
  2. data/Changelog +15 -0
  3. data/README.rdoc +128 -63
  4. data/README_detail.rdoc +130 -60
  5. data/examples/edit_sheets/example_access_sheets_and_cells.rb +1 -1
  6. data/examples/edit_sheets/example_adding_sheets.rb +2 -2
  7. data/examples/edit_sheets/example_copying.rb +1 -1
  8. data/examples/edit_sheets/example_expanding.rb +1 -1
  9. data/examples/edit_sheets/example_ranges.rb +1 -1
  10. data/examples/edit_sheets/example_saving.rb +2 -2
  11. data/examples/open_save_close/example_control_to_excel.rb +1 -1
  12. data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +2 -2
  13. data/examples/open_save_close/example_if_obstructed_save.rb +2 -2
  14. data/examples/open_save_close/example_if_unsaved_accept.rb +1 -1
  15. data/examples/open_save_close/example_if_unsaved_forget.rb +2 -2
  16. data/examples/open_save_close/example_if_unsaved_forget_more.rb +3 -3
  17. data/examples/open_save_close/example_read_only.rb +1 -1
  18. data/examples/open_save_close/example_rename_cells.rb +1 -1
  19. data/examples/open_save_close/example_simple.rb +1 -1
  20. data/examples/open_save_close/example_unobtrusively.rb +3 -3
  21. data/lib/robust_excel_ole.rb +1 -0
  22. data/lib/robust_excel_ole/book.rb +249 -193
  23. data/lib/robust_excel_ole/bookstore.rb +1 -1
  24. data/lib/robust_excel_ole/cell.rb +1 -1
  25. data/lib/robust_excel_ole/excel.rb +125 -4
  26. data/lib/robust_excel_ole/general.rb +1 -92
  27. data/lib/robust_excel_ole/range.rb +1 -1
  28. data/lib/robust_excel_ole/reo_common.rb +37 -0
  29. data/lib/robust_excel_ole/sheet.rb +77 -24
  30. data/lib/robust_excel_ole/version.rb +1 -1
  31. data/spec/book_spec.rb +112 -82
  32. data/spec/book_specs/book_close_spec.rb +44 -1
  33. data/spec/book_specs/book_misc_spec.rb +97 -92
  34. data/spec/book_specs/book_open_spec.rb +40 -8
  35. data/spec/book_specs/book_save_spec.rb +77 -7
  36. data/spec/book_specs/book_sheet_spec.rb +290 -66
  37. data/spec/book_specs/book_unobtr_spec.rb +99 -73
  38. data/spec/bookstore_spec.rb +1 -1
  39. data/spec/cell_spec.rb +2 -2
  40. data/spec/data/another_workbook.xls +0 -0
  41. data/spec/data/workbook.xls +0 -0
  42. data/spec/excel_spec.rb +174 -23
  43. data/spec/general_spec.rb +3 -18
  44. data/spec/range_spec.rb +3 -3
  45. data/spec/reo_common_spec.rb +104 -0
  46. data/spec/sheet_spec.rb +101 -60
  47. metadata +6 -4
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ vendor/bundle
7
7
  .DS_Store
8
8
  doc/*
9
9
  *.sublime-workspace
10
+ .yardoc
data/Changelog CHANGED
@@ -1,6 +1,21 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.5.0] - 2016-31-05
5
+
6
+ ### Added
7
+ - Book: sheet, add_empty_sheet, copy_sheet
8
+ rangeval, set_rangeval, nameval, set_nameval
9
+ open: option check_compatibility
10
+ - Sheet: last_sheet, first_sheet, rangeval, nameval
11
+ - Excel: with_calculaiton, rangeval, set_rangeval, nameval, set_nameval, [], []=
12
+
13
+ ### Changed
14
+ - Book: book.sheet(<sheet_name>) replaces book[<sheet-name>]
15
+ add_or_copy_sheet replaces add_sheet
16
+ name_val, set_name_val replaces n_value, set_n_value
17
+
18
+
4
19
  ## [0.4] - 2016-03-16
5
20
 
6
21
  ### Added
@@ -41,7 +41,7 @@ The semantics is similar to, e.g., +File.open+.
41
41
  Options are
42
42
 
43
43
  +:default_excel+, +:force_excel+, +:if_absent+, +:if_unsaved+, +:if_obstructed+,
44
- +:read_only+, +:visible+, +:displayalerts+.
44
+ +:read_only+, +:check_compatibility, +:visible+, +:displayalerts+.
45
45
 
46
46
  Valid values for +:default_excel+ are +:reuse+, +:new+ or some Excel instance, for +:force_excel+ : +:new+ or some Excel instance, for +:if_unsaved+ : +:raise+, +:accept+, +:forget+, +:alert+ and +:new_excel+, for +:if_obstructed+ : +:raise+, +:save+, +:close_if_saved+, +:forget+, +:alert+ and +:new_excel+ , for +:if_absent+ : +:raise+ and +:create+.
47
47
 
@@ -125,7 +125,7 @@ The method +unobtrusively+ enables the user to read or modify a workbook, no mat
125
125
 
126
126
  Some options determine the Excel instance in which a closed workbook is opened. The options +:reuse (default) indicates that the closed workbook is opened in the Excel instance where the workbooks is opened, if such an Excel instance exists, otherwise that another Excel instance is reused. The option +:hidden+ provokes that the closed workbook is opened in a separate Excel instance that is not visible and has no DisplayAlerts. Any following closed workbook would be opened in this Excel instance as well when using this option. Moreover, an Excel instance can be given directly where to open the closed workbook.
127
127
 
128
- Further options are +:read_only+, +:readonly_excel+, and +:keep_open. The option +:readonly_excel+ chooses whether a book that is opened in read only mode. If the workbook is opened as read only, then the option +:readonly_excel+ determines whether to close the workbook and open it as writable in the Excel instance where it was open so far, or to open it as writable in another running Excel instance, if such an instance exists, or to open it in a new Excel instance. Moreover, there are the options +:visible+ and +:displayalerts+.
128
+ Further options are +:read_only+, +:readonly_excel+, and +:keep_open. The option +:readonly_excel+ chooses whether a book that is opened in read only mode. If the workbook is opened as read only, then the option +:readonly_excel+ determines whether to close the workbook and open it as writable in the Excel instance where it was open so far, or to open it as writable in another running Excel instance, if such an instance exists, or to open it in a new Excel instance. Moreover, there are the options +:visible+, +:displayalerts+ and +:check_compatiblity.
129
129
 
130
130
  Book.unobtrusively('workbook.xls', :reuse, :read_only => false, :keep_open => false) do |book|
131
131
  # some modification
@@ -147,25 +147,25 @@ This method finds out whether the Excel workbook that is referenced by the Book
147
147
 
148
148
  if book.alive? then sheet = book[0] end
149
149
 
150
- === Setting and getting the contents of a range.
150
+ === Getting and setting the contents of a range in a workbook.
151
151
 
152
- Setting:
152
+ Getting the contents of a range.
153
153
 
154
- book["name"] = "value"
154
+ book["name"]
155
+ => "value"
155
156
 
156
157
  or
157
158
 
158
- book.set_nvalue("name") = "value"
159
+ book.nameval("name")
160
+ => "value"
159
161
 
160
- Getting:
162
+ Setting the contents of a range.
161
163
 
162
- book["name"]
163
- => "value"
164
+ book["name"] = "value"
164
165
 
165
166
  or
166
167
 
167
- book.nvalue("name")
168
- => "value"
168
+ book.set_nameval("name") = "value"
169
169
 
170
170
  === Activating a workbook.
171
171
 
@@ -201,13 +201,21 @@ Enable DisplayAlerts.
201
201
 
202
202
  === Accessing a sheet.
203
203
 
204
- A sheet object can be accessed with a Book#[] method via an integer number.
204
+ Accessing the first sheet.
205
205
 
206
- sheet = book[0]
206
+ sheet = book.sheet(1)
207
+
208
+ or
207
209
 
208
- Accessing a sheet object with the sheet name.
210
+ sheet = book.first_sheet
209
211
 
210
- sheet = book['Sheet1']
212
+ Accessing the last sheet.
213
+
214
+ sheet = book.last_sheet
215
+
216
+ Accessing a sheet with the sheet name.
217
+
218
+ sheet = book.sheet('Sheet1')
211
219
 
212
220
  Accessing sheet objects using the methods Book#each.
213
221
 
@@ -240,8 +248,8 @@ Reading a cell from a sheet object.
240
248
 
241
249
  Reading a cell from a range object.
242
250
 
243
- row_range[0] => first cell in row_range
244
- column_range[1] => second cell in column_range
251
+ row_range[1] => first cell in row_range
252
+ column_range[2] => second cell in column_range
245
253
 
246
254
  Methods to a cell are just delegated. Example:
247
255
 
@@ -270,49 +278,63 @@ Accessing a range of a column.
270
278
 
271
279
  Naming or renaming a cell range given its address.
272
280
 
273
- book.add_name(1,1,"name")
281
+ book.set_name(1,1,"name")
282
+
283
+ === Getting and setting the contents of a named range in a worksheet
284
+
285
+ Getting the value of a range.
286
+
287
+ sheet[name]
288
+
289
+ or
290
+
291
+ sheet.nameval(name)
292
+
293
+ Setting the value of a range.
274
294
 
275
- === Reading and modifying a Value of a named range
295
+ book[name] = value
276
296
 
277
- Returning the value of a range, e.g. a cell, that has a with a defined name.
297
+ or
278
298
 
279
- book.nvalue(name)
299
+ book.set_nameval(name,value)
280
300
 
281
- or
301
+ === Getting and setting the contents of a named range in a Worksheet directly
282
302
 
283
- book[name]
303
+ Getting the value of a range.
284
304
 
285
- Setting the value of a range, e.g. a cell, that has a with a defined name.
305
+ sheet.rangeval(name)
286
306
 
287
- book.set_nvalue(name,value)
307
+ Setting the value of a range.
288
308
 
289
- or
309
+ book.set_rangeval(name,value)
290
310
 
291
- book[name] = value
311
+ === Copying or Adding an sheet.
292
312
 
293
- === Adding a sheet.
313
+ Adding (appending) an empty sheet.
294
314
 
295
- Adding a new sheet.
315
+ book.add_empty_sheet
296
316
 
297
- book.add_sheet
317
+ Adding an empty sheet and naming it.
298
318
 
299
- Adding a new sheet with a name.
319
+ book.add_empty_sheet(:as => 'sheet_name')
300
320
 
301
- book.add_sheet(:as => 'new_sheet')
321
+ Adding an empty sheet with a name before another sheet.
302
322
 
303
- Adding a new sheet with a name before another sheet.
323
+ book.add_empty_sheet(:as => 'new_name', :before => another_sheet)
304
324
 
305
- book.add_sheet(:as => 'new_sheet2', :before => another_sheet)
325
+ Copying a sheet and adding (appending) it.
306
326
 
307
- Adding a copy of a sheet with a name after another sheet.
327
+ book.copy_sheet sheet
308
328
 
309
- book.add_sheet(sheet, :as => 'sheet_copy', :after => another_sheet)
329
+ Copying a sheet after a another sheet and naming it.
310
330
 
311
- === Value of a named cell or range
331
+ book.copy_sheet(sheet, :as => 'new_name', :after => another_sheet)
312
332
 
313
- Returning the value of a cell or range that has a with a defined name.
333
+ Copying a sheet, if a sheet is given, adding an empty sheet, if no sheet is given.
314
334
 
315
- sheet.nvalue(name)
335
+ book.add_or_copy_sheet
336
+
337
+ book.add_or_copy_sheet(sheet, :as => 'new_name', :after => another_sheet)
316
338
 
317
339
  === Creating and reusing an Excel instance.
318
340
 
@@ -332,6 +354,48 @@ Promoting an Excel instance represented as WIN32OLE object to an Excel object
332
354
 
333
355
  excel = Excel.new(:reuse => win32ole_object)
334
356
 
357
+ === Closing an Excel
358
+
359
+ excel = Excel.current
360
+ excel.close
361
+
362
+ The options are +:if_unsaved+ and +:hard+ . Example:
363
+
364
+ Closing the Excel instance, saving unsaved wrkbooks and terminating the Excel process
365
+
366
+ excel.close(:if_unsaved => :save, :hard => true)
367
+
368
+ === Closing all Excel instances.
369
+
370
+ Excel.close_all
371
+
372
+ The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +raise+, +save+, and +forget+. Example:
373
+
374
+ Closing all Excel instances, not saving unsaved workbooks and terminating the Excel processes
375
+
376
+ Excel.close_all(:if_unsaved => :forget, :hard => :true)
377
+
378
+ === Terminating all Excel processes
379
+
380
+ Excel.kill_all
381
+
382
+ === Recreating an Excel instance
383
+
384
+ Reopening the closed Excel instance. This includes reopening all workbooks that were open in that Excel instance.
385
+
386
+ excel.close
387
+ excel.recreate
388
+
389
+ The options are :reopen_workbooks, :visible and :displayalerts.
390
+
391
+ excel.recreate(:reopen_workbooks => true, :visible => true, :displayalerts => true)
392
+
393
+ === Providing Excel instances
394
+
395
+ Providing all Excel instances (opened via RobustExcelOle) as objects of the class Excel
396
+
397
+ Excel.excel_objects
398
+
335
399
  === Making Excel visible or invisible
336
400
 
337
401
  Making Excel visible.
@@ -361,47 +425,48 @@ Turning on and off in a block.
361
425
  book = Book.open('workbook.xls')
362
426
  end
363
427
 
364
- === Closing an Excel
365
-
366
- excel = Excel.current
367
- excel.close
368
-
369
- The options are +:if_unsaved+ and +:hard+ . Example:
428
+ === Setting Calculation mode.
370
429
 
371
- Closing the Excel instance, saving unsaved wrkbooks and terminating the Excel process
430
+ Setting calculation mode to manual. Options are +:manual+ and +:automatic+
431
+ The calculation mode is not reset after the block.
372
432
 
373
- excel.close(:if_unsaved => :save, :hard => true)
433
+ excel = Excel.create
434
+ book = Book.open('workbook.xls')
435
+ excel.with_calculation(:manual) do
436
+ # do something
437
+ end
374
438
 
375
- === Closing all Excel instances.
439
+ === Getting and setting the contents of a named range in an Excel application
376
440
 
377
- Excel.close_all
441
+ excel = Excel.create
442
+ book = Book.open('another_workbook.xls')
378
443
 
379
- The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +raise+, +save+, and +forget+. Example:
444
+ Getting the value of a range.
380
445
 
381
- Closing all Excel instances, not saving unsaved workbooks and terminating the Excel processes
446
+ excel[name]
447
+
448
+ or
382
449
 
383
- Excel.close_all(:if_unsaved => :forget, :hard => :true)
450
+ excel.nameval(name)
384
451
 
385
- === Terminating all Excel processes
452
+ Setting the value of a range.
386
453
 
387
- Excel.kill_all
454
+ excel[name] = value
388
455
 
389
- === Recreating an Excel instance
456
+ or
390
457
 
391
- Reopening the closed Excel instance. This includes reopening all workbooks that were open in that Excel instance.
458
+ excel.set_nameval(name,value)
392
459
 
393
- excel.close
394
- excel.recreate
460
+ === Getting and setting the contents of a named range in an Excel application directly
395
461
 
396
- The options are :reopen_workbooks, :visible and :displayalerts.
462
+ Getting the value of a range.
397
463
 
398
- excel.recreate(:reopen_workbooks => true, :visible => true, :displayalerts => true)
464
+ excel.rangeval(name)
399
465
 
400
- === Providing Excel instances
466
+ Setting the value of a range.
401
467
 
402
- Providing all Excel instances (opened via RobustExcelOle) as objects of the class Excel
468
+ excel.set_rangeval(name,value)
403
469
 
404
- Excel.excel_objects
405
470
 
406
471
  === Examples
407
472
 
@@ -47,6 +47,7 @@ Options are the following:
47
47
  +:if_unsaved+:: specify behaviour if the workbook was unsaved (default: +new_excel+)
48
48
  +:if_obstructed+:: specidy behaviour if the workbook is blocked by another book (default: +new_excel+)
49
49
  +:read_only+:: open in read-only mode (default: +false+)
50
+ +:check_compatibility:: check compatibility when saving
50
51
  +:displayalerts+:: allow display alerts in Excel (default: +false+)
51
52
  +:visible+:: make visibe in Excel (default: +false+)
52
53
 
@@ -188,9 +189,10 @@ Options are the following:
188
189
  true: close it and open it as writable in the excel instance where it was open so far
189
190
  false (default) open it as writable in another running excel instance, if it exists,
190
191
  otherwise open in a new excel instance
191
- +:keep_open+:: let the workbook open after unobtrusively opening (default: false)
192
- +:visible+:: change the Excel into visible or invisible
193
- +:displayalerts+:: change the Excel into enable or disable displayalerts
192
+ +:keep_open+:: let the workbook open after unobtrusively opening (default: false)
193
+ +:visible+:: change the Excel into visible or invisible
194
+ +:displayalerts+:: change the Excel into enable or disable displayalerts
195
+ +:check_compatibility+:: checks compatibility when saving
194
196
 
195
197
  Book.unobtrusively('workbook.xls') do |book|
196
198
  # some modification
@@ -211,25 +213,26 @@ The methods +for_reading+ and +for_modifying+ indicate unobtrusively reading or
211
213
 
212
214
  book.alive?
213
215
 
214
- === Setting and getting the contents of a range.
216
+ === Getting and setting the contents of a range.
215
217
 
216
- Setting:
217
218
 
218
- book["name"] = "value"
219
+ Getting the contents of a range.
220
+
221
+ book["name"]
222
+ => "value"
219
223
 
220
224
  or
221
225
 
222
- book.set_nvalue("name") = "value"
226
+ book.nameval("name")
227
+ => "value"
223
228
 
224
- Getting:
229
+ Setting the contents of a range.
225
230
 
226
- book["name"]
227
- => "value"
231
+ book["name"] = "value"
228
232
 
229
233
  or
230
234
 
231
- book.nvalue("name")
232
- => "value"
235
+ book.set_nameval("name") = "value"
233
236
 
234
237
  === Activating a workbook.
235
238
 
@@ -266,13 +269,21 @@ Options: +true+ -> enable DisplayAlerts , +false+ -> Disable DisplayAlerts
266
269
 
267
270
  === Accessing a sheet.
268
271
 
269
- A sheet object can be accessed with a Book#[] method via an integer number.
272
+ Accessing the first sheet.
270
273
 
271
- sheet = book[0]
274
+ sheet = book.sheet(1)
272
275
 
273
- Accessing a sheet object with the sheet name.
276
+ or
274
277
 
275
- sheet = book['Sheet1']
278
+ sheet = book.first_sheet
279
+
280
+ Accessing the last sheet.
281
+
282
+ sheet = book.last_sheet
283
+
284
+ Accessing a sheet with the sheet name.
285
+
286
+ sheet = book.sheet('Sheet1')
276
287
 
277
288
  Accessing sheet objects using the methods Book#each.
278
289
 
@@ -280,6 +291,7 @@ Accessing sheet objects using the methods Book#each.
280
291
  # do something with sheet
281
292
  end
282
293
 
294
+
283
295
  === Accessing a row or a column.
284
296
 
285
297
  A sheet object is enumerable. Use the methods Sheet#each_column, Sheet#each_row or Sheet#each.
@@ -305,7 +317,7 @@ Reading a cell from a sheet object.
305
317
 
306
318
  Reading a cell from a range object.
307
319
 
308
- row_range[0] => first cell in row_range
320
+ row_range[1] => first cell in row_range
309
321
  column_range[1] => second cell in column_range
310
322
 
311
323
  Methods to cell are just delegated as VBA methods. Example:
@@ -336,49 +348,63 @@ Accessing a range of a column.
336
348
 
337
349
  Naming or renaming a cell range given its address.
338
350
 
339
- book.add_name(1,1,"name")
351
+ book.set_name(1,1,"name")
352
+
353
+ === Getting and setting the contents of a named range
340
354
 
341
- === Reading and modifying a Value of a named range
355
+ Getting the value of a range.
342
356
 
343
- Returning the value of a range, e.g. a cell, that has a with a defined name.
357
+ sheet[name]
358
+
359
+ or
360
+
361
+ sheet.nameval(name)
344
362
 
345
- book.nvalue(name)
363
+ Setting the value of a range.
346
364
 
347
- or
365
+ book[name] = value
348
366
 
349
- book[name]
367
+ or
350
368
 
351
- Setting the value of a range, e.g. a cell, that has a with a defined name.
369
+ book.set_nameval(name,value)
352
370
 
353
- book.set_nvalue(name,value)
371
+ === Getting and setting the contents of a named range directly
354
372
 
355
- or
373
+ Getting the value of a range.
356
374
 
357
- book[name] = value
375
+ sheet.rangeval(name)
358
376
 
359
- === Adding a sheet.
377
+ Setting the value of a range.
360
378
 
361
- Adding a new sheet.
379
+ book.set_rangeval(name,value)
362
380
 
363
- book.add_sheet
381
+ === Copying or Adding an sheet.
364
382
 
365
- Adding a new sheet with a name.
383
+ Adding (appending) an empty sheet.
366
384
 
367
- book.add_sheet(:as => 'new_sheet')
385
+ book.add_empty_sheet
368
386
 
369
- Adding a new sheet with a name before another sheet.
387
+ Adding an empty sheet and naming it.
370
388
 
371
- book.add_sheet(:as => 'new_sheet2', :before => another_sheet)
389
+ book.add_empty_sheet(:as => 'sheet_name')
372
390
 
373
- Adding a copy of a sheet with a name after another sheet.
391
+ Adding an empty sheet with a name before another sheet.
374
392
 
375
- book.add_sheet(sheet, :as => 'sheet_copy', :after => another_sheet)
393
+ book.add_empty_sheet(:as => 'new_name', :before => another_sheet)
376
394
 
377
- === Value of a named cell or range
395
+ Copying a sheet and adding (appending) it.
378
396
 
379
- Returning the value of a cell or range that has a with a defined name.
397
+ book.copy_sheet sheet
380
398
 
381
- sheet.nvalue(name)
399
+ Copying a sheet after a another sheet and naming it.
400
+
401
+ book.copy_sheet(sheet, :as => 'new_name', :after => another_sheet)
402
+
403
+ Copying a sheet, if a sheet is given, adding an empty sheet, if no sheet is given.
404
+
405
+ book.add_or_copy_sheet
406
+
407
+ book.add_or_copy_sheet(sheet, :as => 'new_name', :after => another_sheet)
382
408
 
383
409
  === Creating and reusing an Excel instance.
384
410
 
@@ -398,6 +424,46 @@ Promoting an Excel instance represented as WIN32OLE object to an Excel object
398
424
 
399
425
  excel = Excel.new(:reuse => win32ole_object)
400
426
 
427
+
428
+ === Closing an Excel
429
+
430
+ excel = Excel.current
431
+ excel.close
432
+
433
+ Closing the Excel instance and terminating the Excel process
434
+
435
+ excel.close(:hard => true)
436
+
437
+ === Closing all Excel instances.
438
+
439
+ Excel.close_all
440
+
441
+ Closing the Excel instances and terminating the Excel processes
442
+
443
+ Excel.close_all(:hard => true)
444
+
445
+ === Terminating all Excel processes
446
+
447
+ Excel.kill_all
448
+
449
+ === Recreating an Excel instance
450
+
451
+ Reopening the closed Excel instance. This includes reopening all workbooks that were open in that Excel instance.
452
+
453
+ excel.close
454
+ excel.recreate
455
+
456
+ Options are :visible and :displayalerts
457
+
458
+ excel.recreate(:visible => true, :displayalerts => true)
459
+
460
+ === Providing Excel instances
461
+
462
+ Providing all Excel instances (opened via RobustExcelOle) as objects of the class Excel
463
+
464
+ Excel.excel_objects
465
+
466
+
401
467
  === Making Excel visible or invisible
402
468
 
403
469
  Making Excel visible.
@@ -427,43 +493,47 @@ Turning on and off in a block.
427
493
  book = Book.open('workbook.xls')
428
494
  end
429
495
 
430
- === Closing an Excel
431
-
432
- excel = Excel.current
433
- excel.close
496
+ === Setting Calculation mode.
434
497
 
435
- Closing the Excel instance and terminating the Excel process
498
+ Setting calculation mode to manual. Options are +:manual+ and +:automatic+
499
+ The calculation mode is not reset after the block.
436
500
 
437
- excel.close(:hard => true)
501
+ excel = Excel.create
502
+ book = Book.open('workbook.xls')
503
+ excel.with_calculation(:manual) do
504
+ # do something
505
+ end
438
506
 
439
- === Closing all Excel instances.
507
+ === Getting and setting the contents of a named range in an Excel application
440
508
 
441
- Excel.close_all
509
+ excel = Excel.create
510
+ book = Book.open('another_workbook.xls')
442
511
 
443
- Closing the Excel instances and terminating the Excel processes
512
+ Getting the value of a range.
444
513
 
445
- Excel.close_all(:hard => true)
514
+ excel[name]
515
+
516
+ or
446
517
 
447
- === Terminating all Excel processes
518
+ excel.nameval(name)
448
519
 
449
- Excel.kill_all
520
+ Setting the value of a range.
450
521
 
451
- === Recreating an Excel instance
522
+ excel[name] = value
452
523
 
453
- Reopening the closed Excel instance. This includes reopening all workbooks that were open in that Excel instance.
524
+ or
454
525
 
455
- excel.close
456
- excel.recreate
526
+ excel.set_nameval(name,value)
457
527
 
458
- Options are :visible and :displayalerts
528
+ === Getting and setting the contents of a named range in an Excel application directly
459
529
 
460
- excel.recreate(:visible => true, :displayalerts => true)
530
+ Getting the value of a range.
461
531
 
462
- === Providing Excel instances
532
+ excel.rangeval(name)
463
533
 
464
- Providing all Excel instances (opened via RobustExcelOle) as objects of the class Excel
534
+ Setting the value of a range.
465
535
 
466
- Excel.excel_objects
536
+ excel.set_rangeval(name,value)
467
537
 
468
538
 
469
539
  === Examples