robust_excel_ole 0.5.1 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/Changelog +13 -0
  2. data/README.rdoc +70 -21
  3. data/README_detail.rdoc +60 -27
  4. data/examples/edit_sheets/example_access_sheets_and_cells.rb +2 -2
  5. data/examples/edit_sheets/example_adding_sheets.rb +2 -2
  6. data/examples/edit_sheets/example_concating.rb +2 -3
  7. data/examples/edit_sheets/example_copying.rb +2 -3
  8. data/examples/edit_sheets/example_expanding.rb +2 -3
  9. data/examples/edit_sheets/example_naming.rb +2 -3
  10. data/examples/edit_sheets/example_ranges.rb +2 -2
  11. data/examples/edit_sheets/example_saving.rb +2 -3
  12. data/examples/open_save_close/example_control_to_excel.rb +3 -3
  13. data/examples/open_save_close/example_default_excel.rb +4 -4
  14. data/examples/open_save_close/example_force_excel.rb +2 -2
  15. data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +2 -2
  16. data/examples/open_save_close/example_if_obstructed_forget.rb +2 -2
  17. data/examples/open_save_close/example_if_obstructed_save.rb +2 -2
  18. data/examples/open_save_close/example_if_unsaved_accept.rb +2 -2
  19. data/examples/open_save_close/example_if_unsaved_forget.rb +2 -2
  20. data/examples/open_save_close/example_if_unsaved_forget_more.rb +4 -5
  21. data/examples/open_save_close/example_read_only.rb +2 -2
  22. data/examples/open_save_close/example_rename_cells.rb +3 -3
  23. data/examples/open_save_close/example_reuse.rb +2 -2
  24. data/examples/open_save_close/example_simple.rb +3 -4
  25. data/examples/open_save_close/example_unobtrusively.rb +2 -2
  26. data/lib/robust_excel_ole/book.rb +84 -78
  27. data/lib/robust_excel_ole/bookstore.rb +5 -1
  28. data/lib/robust_excel_ole/excel.rb +165 -188
  29. data/lib/robust_excel_ole/reo_common.rb +4 -0
  30. data/lib/robust_excel_ole/sheet.rb +15 -6
  31. data/lib/robust_excel_ole/version.rb +1 -1
  32. data/spec/book_spec.rb +104 -77
  33. data/spec/book_specs/book_close_spec.rb +9 -8
  34. data/spec/book_specs/book_misc_spec.rb +367 -26
  35. data/spec/book_specs/book_open_spec.rb +375 -94
  36. data/spec/book_specs/book_save_spec.rb +137 -112
  37. data/spec/book_specs/book_sheet_spec.rb +1 -1
  38. data/spec/book_specs/book_subclass_spec.rb +2 -1
  39. data/spec/book_specs/book_unobtr_spec.rb +87 -96
  40. data/spec/bookstore_spec.rb +8 -5
  41. data/spec/cell_spec.rb +1 -1
  42. data/spec/data/another_workbook.xls +0 -0
  43. data/spec/data/book_with_blank.xls +0 -0
  44. data/spec/data/workbook.xls +0 -0
  45. data/spec/excel_spec.rb +484 -72
  46. data/spec/range_spec.rb +1 -1
  47. data/spec/sheet_spec.rb +47 -1
  48. metadata +4 -5
data/Changelog CHANGED
@@ -1,10 +1,23 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.6] - 2016-03-08
5
+
6
+ ## [0.5.2] - 2016-17-07
7
+
8
+ ### Changed
9
+ - Book: open: option :update_links
10
+ - Book: open: options :default_excel, :force_excel => :current instead of :reuse
11
+ (:active, :reuse as alias)
12
+ - Book: open: options: deleted :displayalerts
13
+ - Excel: create, current: with options :visible, :displayalerts
14
+ - Excel: create, current, new: new options-value :displayalerts => :if_visible
15
+
4
16
  ## [0.5.1] - 2016-18-06
5
17
 
6
18
  ### Added
7
19
  - Book#open :force_excel => :active
20
+ - Excel#workbooks_visible
8
21
 
9
22
  ### Changed
10
23
  - Book: open: :default_excel, :force_excel => :active, (:reuse as alias), bug fix in :default
@@ -2,13 +2,14 @@
2
2
 
3
3
  robust_excel_ole helps to automate modifying and reading Excel files.
4
4
  This is done by sending VBA methods via Win32OLE.
5
- Moreover, robust_excel_ole implements a management system of Excel files and Excel instances and keeps track of all workbooks.
5
+ Moreover, robust_excel_ole implements a management system and keeps track of Excel files and Excel instances
6
6
 
7
7
  Goals:
8
8
  - support both fully automated operations as well as simultaneous user interactions during the automation
9
- - be able to cope with all cases of Excel (and user) behaviour, encapsulate errors
9
+ - robust Excel AUtomation: be able to deal with all cases of Excel (and user) behaviour, encapsulate errors
10
10
  - provide convenient methods for frequent (common) tasks
11
11
  - support the use of simultaneously running Excel instances
12
+ - comprehensive wrapping of Excel using Win32OLE
12
13
  - allow the presence of referenced libraries and provide some support for that
13
14
  - support EXCEL 2010, EXCEL 2007
14
15
 
@@ -41,9 +42,9 @@ The semantics is similar to, e.g., +File.open+.
41
42
  Options are
42
43
 
43
44
  +:default_excel+, +:force_excel+, +:if_absent+, +:if_unsaved+, +:if_obstructed+,
44
- +:read_only+, +:check_compatibility, +:visible+, +:displayalerts+.
45
+ +:read_only+, +:visible+, +:check_compatibility, and +:update_links+.
45
46
 
46
- Valid values for +:default_excel+ are +:active+ (or +:reuse+), +:new+ or some Excel instance, for +:force_excel+ : +:active (or +:reuse+), +: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
+ Valid values for +:default_excel+ are +:current+ (or +:active+, or +:reuse+), +:new+ or some Excel instance, for +:force_excel+ : +:current+ (or +:active+, or +:reuse+), +: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+. The others are Boolean.
47
48
 
48
49
  Here are a few examples:
49
50
 
@@ -65,7 +66,7 @@ Opening a workbook in a given Excel instance, no matter if the workbook was open
65
66
 
66
67
  book = Book.open('workbook.xls', :force_excel => excel1)
67
68
 
68
- Opening a workbook in a new Excel instance and make it visible.
69
+ Opening a workbook in a new Excel instance and make the window of the workbook visible.
69
70
 
70
71
  book = Book.open('workbook.xls', :force_excel => :new, :visible => true)
71
72
 
@@ -137,11 +138,11 @@ If a workbook is blocking the workbook that should be saved, then the former one
137
138
 
138
139
  The method +unobtrusively+ enables the user to read or modify a workbook, no matter if it is open in some Excel instance, if it is saved or unsaved, and if it is writable or not. When opening a workbook unobtrusively, its status remains unchanged. This status includes, whether the workbook is opened or closed, saved or unsaved, readonly or writable.
139
140
 
140
- Some options determine the Excel instance in which a closed workbook is opened. The options +:active+ (or +: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.
141
+ Some options determine the Excel instance in which a closed workbook is opened. The option +:current+ (or +:active+, or +: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.
141
142
 
142
- 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.
143
+ 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 +:check_compatiblity.
143
144
 
144
- Book.unobtrusively('workbook.xls', :active, :read_only => false, :keep_open => false) do |book|
145
+ Book.unobtrusively('workbook.xls', :current, :read_only => false, :keep_open => false) do |book|
145
146
  # some modification
146
147
  sheet = book[0]
147
148
  sheet[1,1] = "c"
@@ -188,17 +189,17 @@ Bring the window of a workbook to the foreground, make it available for keyboard
188
189
  book.activate
189
190
 
190
191
 
191
- === Making a workbook visible or invisible
192
+ === Making the window of the workbook visible
192
193
 
193
- Open a workbook and make the Excel instance visible.
194
+ Open a workbook and make the Excel instance and the window of the workbook visible.
194
195
 
195
196
  book = Book.open('workbook.xls', :visivble => true)
196
197
 
197
- Make the workbook invisible.
198
+ Make the window of the workbook invisible.
198
199
 
199
200
  book.visible = false
200
201
 
201
- Make the workbook visible
202
+ Make the window of the workbook visible.
202
203
 
203
204
  book.visible = true
204
205
 
@@ -356,26 +357,74 @@ Creating a new Excel.
356
357
 
357
358
  excel1 = Excel.create
358
359
 
359
- Getting a running Excel instance and reusing it.
360
+ or
361
+
362
+ excel1 = Excel.new(:reuse => false)
363
+
364
+ Resusing a runnin Excel instance.
360
365
 
361
366
  excel2 = Excel.current
362
367
 
363
- Reusing a running Excel instance, making it visible and turning on displayalerts.
368
+ or
364
369
 
365
- excel2 = Excel.new(:reuse => true, :visible => true, :displayalerts => true).
370
+ excel2 = Excel.new(:reuse => true)
371
+
372
+ Options are +:reuse+ (+true+, +false+), +:visible+ (+true+, +false+) and +:displayalerts+ (+true+, +false+, +:if_visible+).
366
373
 
367
374
  Promoting an Excel instance represented as WIN32OLE object to an Excel object
368
375
 
369
- excel = Excel.new(:reuse => win32ole_object)
376
+ excel = Excel.new(win32ole_object)
377
+
378
+ === Making a Excel visible or invisible
379
+
380
+ Creating a new Excel and making it visible.
381
+
382
+ excel1 = Excel.create(:visible => true)
383
+
384
+ or
385
+
386
+ excel1 = Excel.new(:reuse => false, :visible => true)
387
+
388
+ Reusing a Excel and making it invisible.
389
+
390
+ excel2 = Excel.current(:reuse => false, :visible => false)
391
+
392
+ or
393
+
394
+ excel2 = Excel.new(:reuse => false, :visible => false)
395
+
396
+ === Enabling or disabling DisplayAlerts
397
+
398
+ Enabling DisplayAlerts.
399
+
400
+ excel3 = Excel.new(:reuse => true, :displayalerts => true)
401
+
402
+ Disabling DisplayAlerts.
403
+
404
+ excel3 = Excel.current(:reuse => true, :displayalerts => false)
405
+
406
+ Enabling DisplayAlerts whenever the Excel instance is visible.
407
+
408
+ excel3 = Excel.current(:reuse => true, :displayalerts => :if_visible)
409
+
410
+ === Making all workbooks visible or invisible
411
+
412
+ Making all workbooks visible.
413
+
414
+ excel1.workbooks_visible true
415
+
416
+ Making all workbooks invisible.
417
+
418
+ excel1.workbooks_visible false
370
419
 
371
420
  === Closing an Excel
372
421
 
373
422
  excel = Excel.current
374
423
  excel.close
375
424
 
376
- The options are +:if_unsaved+ and +:hard+ . Example:
425
+ The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +:raise+, +:save+, +:forget+ and +:keep_open+.
377
426
 
378
- Closing the Excel instance, saving unsaved wrkbooks and terminating the Excel process
427
+ Closing the Excel instance, saving unsaved workbooks and terminating the Excel process hard.
379
428
 
380
429
  excel.close(:if_unsaved => :save, :hard => true)
381
430
 
@@ -383,11 +432,11 @@ Closing the Excel instance, saving unsaved wrkbooks and terminating the Excel pr
383
432
 
384
433
  Excel.close_all
385
434
 
386
- The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +raise+, +save+, and +forget+. Example:
435
+ The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +:raise+, +:save+, and +:forget+. Example:
387
436
 
388
- Closing all Excel instances, not saving unsaved workbooks and terminating the Excel processes
437
+ Closing all Excel instances, saving unsaved workbooks and terminating the Excel processes softly.
389
438
 
390
- Excel.close_all(:if_unsaved => :forget, :hard => :true)
439
+ Excel.close_all(:if_unsaved => :save, :hard => false)
391
440
 
392
441
  === Terminating all Excel processes
393
442
 
@@ -42,22 +42,21 @@ The semantics is similar to, e.g., +File.open+.
42
42
  Options are the following:
43
43
 
44
44
  +:default_excel+:: open the workbook in the Excel instance where it was opened before most recently,
45
- if the book was opened before and this Excel instance is alive. Otherwise open it in the active (+:active+ or +:reuse+), a new (+:new+) or a given Excel instance (default: +reuse+)
46
- +:force_excel+:: open the workbook in the active, a new or given Excel instance
45
+ if the book was opened before and this Excel instance is alive. Otherwise open it in the current (+:current+, or +:active+, or +:reuse+), a new (+:new+) or a given Excel instance (default: +:current+)
46
+ +:force_excel+:: open the workbook in the current (+:current+, or +:active+, or +:reuse+), a new (+:new+) or given Excel instance
47
47
  +:if_absent+:: specify behaviour if the workbook with the given file name does not exist if the workbook does not exist (default: +create+)
48
48
  +:if_unsaved+:: specify behaviour if the workbook was unsaved (default: +new_excel+)
49
49
  +:if_obstructed+:: specidy behaviour if the workbook is blocked by another book (default: +new_excel+)
50
50
  +:read_only+:: open in read-only mode (default: +false+)
51
51
  +:check_compatibility:: check compatibility when saving
52
- +:displayalerts+:: allow display alerts in Excel (default: +false+)
53
- +:visible+:: make visibe in Excel (default: +false+)
52
+ +:visible+:: makes the window of the workbook visible or invisible (default: +true+)
54
53
 
55
54
  The option +:defaut_excel+ :
56
55
 
57
56
  If the workbook was open before, then open it in the Excel instance where it was open before most recently. If the workbook cannot be reopened, i.e., the book was not opened before, or the Excel is not alive anymore,
58
57
  then
59
58
 
60
- +:active+ (or :reuse+:): Connect to a running Excel, if it exists, otherwise open a new Excel.
59
+ +:current+ (or +:active+, or +:reuse+:): Connect to the current (the first opened) Excel instance, if it exists, otherwise open a new Excel.
61
60
  +:new+:: Open in a new Excel.
62
61
  [instance]:: Open in a given Excel instance.
63
62
 
@@ -65,6 +64,7 @@ The option +:force_excel :
65
64
 
66
65
  No matter if the workbook was open before, or the Excel instance is alive
67
66
 
67
+ +:current+ (or +:active+, or +:reuse+): Open the current (the first opened) Excel instance
68
68
  +:new+:: Open in a new Excel instance.
69
69
  [instance]:: Open in a given Excel instance.
70
70
 
@@ -95,8 +95,6 @@ If a workbook is open and a new workbook with same name and a different path is
95
95
  +:close_if_saved+:: Close the old workbook and open the new workbook, if the old workbook is saved, otherwise raise an exception.
96
96
  +:new_excel+:: Open the new workbook in a new Excel instance.
97
97
 
98
- The values :displayalerts and :visible are reached to the class Excel that controls opening and closing Excel instances.
99
-
100
98
  Here are a few examples:
101
99
 
102
100
  Opening a workbook in the Excel instance where it was opened before most recently, if it was opened before and this Excel instance is alive. Otherwise opening it in a running Excel, if it exists, or in a new Excel.
@@ -213,11 +211,11 @@ If a workbook is blocking the workbook that should be saved, then the former one
213
211
 
214
212
  The method +unobtrusively+ enables the user to read or modify a workbook, no matter if it is open in some Excel instance, if it is saved or unsaved, and if it is writable or not. When opening a workbook unobtrusively, its status remains unchanged. This status includes, whether the workbook is opened or closed, saved or unsaved, readonly or writable.
215
213
 
216
- One option chooses the Excel instance in which a closed workbook is opened. The options +:active+ (or +:reuse) (default) indicates that the closed workbook is opened in the Excel instance of the workbook, if it exists, or 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.
214
+ One option chooses the Excel instance in which a closed workbook is opened. The option +:current+ (or +:active+, or +:reuse) (default) indicates that the closed workbook is opened in the Excel instance of the workbook, if it exists, or 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.
217
215
 
218
216
  Options are the following:
219
217
 
220
- +:active (or +:reuse+:): (default) : open a closed workbook in the Excel instance of the workbook, if it exists, otherwise reuse another Excel
218
+ +:current+ (or +:active, or +:reuse+:): (default) : open a closed workbook in the Excel instance where it was opened most recently, if such an Excel instance exists, otherwise open it in the current (first opened) Excel instance
221
219
  +:hidden+:: : open a closed workbook in one separate Excel instance that is not visible and has no displayalerts
222
220
  <excel-instance> : open a closed workbooks in the given Excel instance
223
221
 
@@ -227,8 +225,7 @@ Options are the following:
227
225
  false (default) open it as writable in another running excel instance, if it exists,
228
226
  otherwise open in a new excel instance
229
227
  +:keep_open+:: let the workbook open after unobtrusively opening (default: false)
230
- +:visible+:: change the Excel into visible or invisible
231
- +:displayalerts+:: change the Excel into enable or disable displayalerts
228
+ +:visible+:: make the window of the workbook visible (default: false)
232
229
  +:check_compatibility+:: checks compatibility when saving
233
230
 
234
231
  Book.unobtrusively('workbook.xls') do |book|
@@ -277,23 +274,23 @@ Bring the focus to a workbook. Make it available for keyboard inputs and make th
277
274
 
278
275
  book.activate
279
276
 
280
- === Making a workbook visible or invisible
277
+ === Make the window of the workbook visible.
281
278
 
282
279
  Open a workbook and make the Excel instance visible.
283
280
 
284
281
  book = Book.open('workbook.xls', :visivble => true)
285
282
 
286
- Make the workbook invisible.
283
+ Make the window of the workbook visible.
287
284
 
288
285
  book.visible = false
289
286
 
290
- Make the workbook visible
287
+ Makes the window of the workbook visible.
291
288
 
292
289
  book.visible = true
293
290
 
294
291
  === Making an Excel visible or invisible, and enable and disable DisplayAlerts.
295
292
 
296
- Make an Excel visible
293
+ Make an Excel visible.
297
294
 
298
295
  book.excel.visible = true
299
296
 
@@ -449,40 +446,76 @@ Creating a new Excel.
449
446
 
450
447
  excel1 = Excel.create
451
448
 
452
- Getting a running Excel instance and reusing it.
453
- Connecting to the first opened Excel instance. If this Excel instance is being closed, then Excel creates a new Excel instance that has the same Hwnd
449
+ or
450
+
451
+ excel1 = Excel.new(:reuse => false)
452
+
453
+ Resusing a runnin Excel instance.
454
454
 
455
455
  excel2 = Excel.current
456
456
 
457
- Reusing a running Excel instance, making it visible and turning on displayalerts.
457
+ or
458
458
 
459
- excel2 = Excel.new(:reuse => true, :visible => true, :displayalerts => true).
459
+ excel2 = Excel.new(:reuse => true)
460
+
461
+ Options are +:reuse+ (+true+, +false+), +:visible+ (+true+, +false+) and +:displayalerts+ (+true+, +false+, +:if_visible+).
460
462
 
461
463
  Promoting an Excel instance represented as WIN32OLE object to an Excel object
462
464
 
463
- excel = Excel.new(:reuse => win32ole_object)
465
+ excel = Excel.new(win32ole_object)
466
+
467
+ === Making a Excel visible or invisible
468
+
469
+ Creating a new Excel and making it visible.
470
+
471
+ excel1 = Excel.create(:visible => true)
472
+
473
+ or
474
+
475
+ excel1 = Excel.new(:reuse => false, :visible => true)
476
+
477
+ Reusing a Excel and making it invisible.
464
478
 
479
+ excel2 = Excel.current(:reuse => false, :visible => false)
480
+
481
+ or
482
+
483
+ excel2 = Excel.new(:reuse => false, :visible => false)
484
+
485
+ === Enabling or disabling DisplayAlerts
486
+
487
+ Enabling DisplayAlerts.
488
+
489
+ excel3 = Excel.new(:reuse => true, :displayalerts => true)
490
+
491
+ Disabling DisplayAlerts.
492
+
493
+ excel3 = Excel.current(:reuse => true, :displayalerts => false)
494
+
495
+ Enabling DisplayAlerts whenever the Excel instance is visible.
496
+
497
+ excel3 = Excel.current(:reuse => true, :displayalerts => :if_visible)
465
498
 
466
499
  === Closing an Excel
467
500
 
468
501
  excel = Excel.current
469
502
  excel.close
470
503
 
471
- Closing the Excel instance and terminating the Excel process
504
+ The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +:raise+, +:save+, +:forget+ and +:keep_open+.
472
505
 
473
- excel.close(:hard => true)
506
+ Closing the Excel instance, saving unsaved workbooks and terminating the Excel process hard.
507
+
508
+ excel.close(:if_unsaved => :save, :hard => true)
474
509
 
475
510
  === Closing all Excel instances.
476
511
 
477
512
  Excel.close_all
478
513
 
479
- Closing the Excel instances and terminating the Excel processes
480
-
481
- Excel.close_all(:hard => true)
514
+ The options are +:if_unsaved+ and +:hard+ . Values for :if_unsaved+ are +:raise+, +:save+, and +:forget+. Example:
482
515
 
483
- === Terminating all Excel processes
516
+ Closing all Excel instances, saving unsaved workbooks and terminating the Excel processes softly.
484
517
 
485
- Excel.kill_all
518
+ Excel.close_all(:if_unsaved => :save, :hard => false)
486
519
 
487
520
  === Recreating an Excel instance
488
521
 
@@ -1,8 +1,8 @@
1
1
  # example_access_sheets_and_cells.rb:
2
2
  # access sheets, print cells, rows, and columns of a sheet
3
3
 
4
- require File.join(File.dirname(__FILE__), '../../lib/general')
5
- require File.join(File.dirname(__FILE__), '../../spec/helpers/create_temporary_dir')
4
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
5
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
6
6
  require "fileutils"
7
7
 
8
8
  include RobustExcelOle
@@ -1,8 +1,8 @@
1
1
  # example_adding_sheets.rb:
2
2
  # adding new and copied at various positions with various sheet names
3
3
 
4
- require File.join(File.dirname(__FILE__), '../../lib/general')
5
- require File.join(File.dirname(__FILE__), '../../spec/helpers/create_temporary_dir')
4
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
5
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
6
6
  require "fileutils"
7
7
 
8
8
  include RobustExcelOle
@@ -2,9 +2,8 @@
2
2
  # each named cell gets the value of cell right to it appended to its own value
3
3
  # the new workbook's name is extended by the suffix "_concat"
4
4
 
5
- require 'rubygems'
6
- #require 'general'
7
- require File.join(File.dirname(__FILE__), '../../lib/general')
5
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
6
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
8
7
  require "fileutils"
9
8
 
10
9
  include RobustExcelOle
@@ -3,9 +3,8 @@
3
3
  # unnamed cells shall not be copied
4
4
  # if a sheet does not contain any named cell, then the sheet shall not be copied
5
5
 
6
- require 'rubygems'
7
- #require 'general'
8
- require File.join(File.dirname(__FILE__), '../../lib/general')
6
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
7
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
9
8
  require "fileutils"
10
9
 
11
10
  include RobustExcelOle
@@ -5,9 +5,8 @@
5
5
  # the sheet's name shall be the name of the Excel name
6
6
  # in addition to that, the cell B2 shall be named "name" and get the sheet name as its value
7
7
 
8
- require 'rubygems'
9
- #require 'general'
10
- require File.join(File.dirname(__FILE__), '../../lib/general')
8
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
9
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
11
10
  require "fileutils"
12
11
 
13
12
  include RobustExcelOle
@@ -3,9 +3,8 @@
3
3
  # the contents of each cell is copied
4
4
  # the new workbook's name is extended by the suffix "_named"
5
5
 
6
- require 'rubygems'
7
- #require 'general'
8
- require File.join(File.dirname(__FILE__), '../../lib/general')
6
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
7
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
9
8
  require "fileutils"
10
9
 
11
10
  include RobustExcelOle
@@ -1,8 +1,8 @@
1
1
  # example_ranges.rb:
2
2
  # access row and column ranges of a sheet.
3
3
 
4
- require File.join(File.dirname(__FILE__), '../../lib/general')
5
- require File.join(File.dirname(__FILE__), '../../spec/helpers/create_temporary_dir')
4
+ require File.expand_path('../../lib/robust_excel_ole', File.dirname(__FILE__))
5
+ require File.join(File.dirname(File.expand_path(__FILE__)), '../../spec/helpers/create_temporary_dir')
6
6
  require "fileutils"
7
7
 
8
8
  include RobustExcelOle