robust_excel_ole 1.14 → 1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog +7 -1
- data/README.rdoc +2 -5
- data/docs/README_excel.rdoc +1 -1
- data/docs/README_open.rdoc +27 -18
- data/lib/robust_excel_ole/cell.rb +1 -1
- data/lib/robust_excel_ole/excel.rb +43 -32
- data/lib/robust_excel_ole/general.rb +6 -6
- data/lib/robust_excel_ole/range.rb +4 -4
- data/lib/robust_excel_ole/range_owners.rb +5 -5
- data/lib/robust_excel_ole/version.rb +1 -1
- data/lib/robust_excel_ole/workbook.rb +90 -122
- data/lib/robust_excel_ole/worksheet.rb +15 -10
- data/spec/data/more_data/workbook.xls +0 -0
- data/spec/excel_spec.rb +96 -94
- data/spec/general_spec.rb +4 -4
- data/spec/reo_common_spec.rb +15 -11
- data/spec/workbook_spec.rb +4 -4
- data/spec/workbook_specs/workbook_misc_spec.rb +18 -19
- data/spec/workbook_specs/workbook_open_spec.rb +7 -7
- data/spec/workbook_specs/workbook_unobtr_spec.rb +416 -112
- metadata +2 -2
@@ -18,7 +18,6 @@ module RobustExcelOle
|
|
18
18
|
attr_accessor :stored_filename
|
19
19
|
attr_accessor :color_if_modified
|
20
20
|
attr_accessor :was_open
|
21
|
-
attr_reader :workbook
|
22
21
|
|
23
22
|
alias ole_object ole_workbook
|
24
23
|
|
@@ -29,8 +28,8 @@ module RobustExcelOle
|
|
29
28
|
:if_unsaved => :raise,
|
30
29
|
:if_obstructed => :raise,
|
31
30
|
:if_absent => :raise,
|
32
|
-
:if_exists => :raise
|
33
|
-
|
31
|
+
:if_exists => :raise
|
32
|
+
#:check_compatibility => false
|
34
33
|
}.freeze
|
35
34
|
|
36
35
|
CORE_DEFAULT_OPEN_OPTS = {
|
@@ -100,7 +99,7 @@ module RobustExcelOle
|
|
100
99
|
# if readonly is true, then prefer a book that is given in force_excel if this option is set
|
101
100
|
forced_excel =
|
102
101
|
(options[:force][:excel].nil? || options[:force][:excel] == :current) ?
|
103
|
-
(excel_class.new(:reuse => true) if
|
102
|
+
(excel_class.new(:reuse => true) if !::JRUBY_BUG_CONNECT) : excel_of(options[:force][:excel])
|
104
103
|
begin
|
105
104
|
book = if File.exists?(file)
|
106
105
|
bookstore.fetch(file, :prefer_writable => !(options[:read_only]),
|
@@ -110,7 +109,8 @@ module RobustExcelOle
|
|
110
109
|
trace "#{$!.message}"
|
111
110
|
end
|
112
111
|
if book
|
113
|
-
|
112
|
+
# hack (unless condition): calling Worksheet[]= causes calling Worksheet#workbook which calls Workbook#new(ole_workbook)
|
113
|
+
book.was_open = book.alive? unless file_or_workbook.is_a? WIN32OLE
|
114
114
|
# drop the fetched workbook if it shall be opened in another Excel instance
|
115
115
|
# or the workbook is an unsaved workbook that should not be accepted
|
116
116
|
if (options[:force][:excel].nil? || options[:force][:excel] == :current || forced_excel == book.excel) &&
|
@@ -151,7 +151,6 @@ module RobustExcelOle
|
|
151
151
|
end
|
152
152
|
set_options(filename, options)
|
153
153
|
bookstore.store(self)
|
154
|
-
@workbook = @excel.workbook = self
|
155
154
|
r1c1_letters = @ole_workbook.Worksheets.Item(1).Cells.Item(1,1).Address(true,true,XlR1C1).gsub(/[0-9]/,'') #('ReferenceStyle' => XlR1C1).gsub(/[0-9]/,'')
|
156
155
|
address_class.new(r1c1_letters)
|
157
156
|
if block
|
@@ -232,43 +231,46 @@ module RobustExcelOle
|
|
232
231
|
|
233
232
|
# @private
|
234
233
|
def ensure_workbook(filename, options)
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
ensure_excel(options)
|
240
|
-
workbooks = @excel.Workbooks
|
241
|
-
@ole_workbook = workbooks.Item(File.basename(filename)) rescue nil if @ole_workbook.nil?
|
242
|
-
if @ole_workbook
|
243
|
-
@was_open = true
|
244
|
-
manage_blocking_or_unsaved_workbook(filename,options)
|
245
|
-
else
|
246
|
-
if excel_option.nil? || excel_option == :current &&
|
247
|
-
(!JRUBY_BUG_CONNECT || filename[0] != '/')
|
248
|
-
connect(filename,options)
|
249
|
-
else
|
250
|
-
open_or_create_workbook(filename,options)
|
251
|
-
end
|
252
|
-
end
|
234
|
+
return if (@ole_workbook && alive? && (options[:read_only].nil? || @ole_workbook.ReadOnly == options[:read_only]))
|
235
|
+
if options[:if_unsaved]==:accept &&
|
236
|
+
((options[:read_only]==true && self.ReadOnly==false) || (options[:read_only]==false && self.ReadOnly==true))
|
237
|
+
raise OptionInvalid, ":if_unsaved:accept and change of read-only mode is not possible"
|
253
238
|
end
|
239
|
+
filename = @stored_filename ? @stored_filename : filename
|
240
|
+
manage_nonexisting_file(filename,options)
|
241
|
+
excel_option = options[:force][:excel].nil? ? options[:default][:excel] : options[:force][:excel]
|
242
|
+
ensure_excel(options)
|
243
|
+
workbooks = @excel.Workbooks
|
244
|
+
@ole_workbook = workbooks.Item(File.basename(filename)) rescue nil if @ole_workbook.nil?
|
245
|
+
if @ole_workbook
|
246
|
+
@was_open = true if @was_open.nil? # necessary?
|
247
|
+
manage_blocking_or_unsaved_workbook(filename,options)
|
248
|
+
open_or_create_workbook(filename,options) if @ole_workbook.ReadOnly != options[:read_only]
|
249
|
+
else
|
250
|
+
if excel_option.nil? || excel_option == :current &&
|
251
|
+
(!::JRUBY_BUG_CONNECT || filename[0] != '/')
|
252
|
+
workbooks_number_before_connect = @excel.Workbooks.Count
|
253
|
+
connect(filename,options)
|
254
|
+
@was_open = @excel.Workbooks.Count == workbooks_number_before_connect
|
255
|
+
else
|
256
|
+
open_or_create_workbook(filename,options)
|
257
|
+
end
|
258
|
+
end
|
254
259
|
end
|
255
260
|
|
256
261
|
# @private
|
257
262
|
def set_options(filename, options)
|
263
|
+
# changing read-only mode
|
258
264
|
if (!options[:read_only].nil?) && options[:read_only] != @ole_workbook.ReadOnly
|
259
|
-
|
260
|
-
@excel.with_displayalerts(false) { @ole_workbook.Close }
|
261
|
-
@ole_workbook = nil
|
262
|
-
open_or_create_workbook(filename, options)
|
265
|
+
ensure_workbook(filename, options)
|
263
266
|
end
|
264
267
|
retain_saved do
|
265
268
|
self.visible = options[:force][:visible].nil? ? @excel.Visible : options[:force][:visible]
|
266
269
|
@excel.calculation = options[:calculation] unless options[:calculation].nil?
|
267
270
|
@ole_workbook.CheckCompatibility = options[:check_compatibility] unless options[:check_compatibility].nil?
|
268
|
-
end
|
271
|
+
end
|
269
272
|
end
|
270
273
|
|
271
|
-
|
272
274
|
private
|
273
275
|
|
274
276
|
# @private
|
@@ -299,9 +301,6 @@ module RobustExcelOle
|
|
299
301
|
end
|
300
302
|
end
|
301
303
|
@excel = excel_class.new(ole_excel)
|
302
|
-
excels_number_after = excel_class.excels_number
|
303
|
-
workbooks_number_after = ole_excel.Workbooks.Count
|
304
|
-
@was_open = (excels_number_after==excels_number) && (workbooks_number_after==workbooks_number)
|
305
304
|
end
|
306
305
|
|
307
306
|
# @private
|
@@ -410,11 +409,13 @@ module RobustExcelOle
|
|
410
409
|
end
|
411
410
|
|
412
411
|
# @private
|
413
|
-
def open_or_create_workbook(filename, options)
|
414
|
-
return if @ole_workbook && options[:if_unsaved] != :alert && options[:if_unsaved] != :excel
|
412
|
+
def open_or_create_workbook(filename, options)
|
413
|
+
return if @ole_workbook && options[:if_unsaved] != :alert && options[:if_unsaved] != :excel &&
|
414
|
+
(options[:read_only].nil? || options[:read_only]==@ole_workbook.ReadOnly )
|
415
415
|
begin
|
416
416
|
abs_filename = General.absolute_path(filename)
|
417
417
|
begin
|
418
|
+
@was_open = false if @was_open.nil?
|
418
419
|
workbooks = @excel.Workbooks
|
419
420
|
rescue WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException => msg
|
420
421
|
raise UnexpectedREOError, "cannot access workbooks: #{msg.message} #{msg.backtrace}"
|
@@ -467,7 +468,7 @@ module RobustExcelOle
|
|
467
468
|
workaround_condition = @excel.Version.split('.').first.to_i == 12 && workbooks.Count == 0
|
468
469
|
if workaround_condition
|
469
470
|
workbooks.Add
|
470
|
-
@excel.calculation = options[:calculation].nil? ? @excel.calculation : options[:calculation]
|
471
|
+
@excel.calculation = options[:calculation].nil? ? @excel.properties[:calculation] : options[:calculation]
|
471
472
|
end
|
472
473
|
begin
|
473
474
|
# @excel.with_displayalerts(update_links_opt == :alert ? true : @excel.displayalerts) do
|
@@ -545,20 +546,20 @@ module RobustExcelOle
|
|
545
546
|
end
|
546
547
|
end
|
547
548
|
|
548
|
-
def
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
unobtrusively(
|
549
|
+
def for_reading(opts = { }, &block)
|
550
|
+
unobtrusively({:writable => false}.merge(opts), &block)
|
551
|
+
end
|
552
|
+
|
553
|
+
def for_modifying(opts = { }, &block)
|
554
|
+
unobtrusively({:writable => true}.merge(opts), &block)
|
554
555
|
end
|
555
556
|
|
556
|
-
def self.
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
unobtrusively(
|
557
|
+
def self.for_reading(arg, opts = { }, &block)
|
558
|
+
unobtrusively(arg, {:writable => false}.merge(opts), &block)
|
559
|
+
end
|
560
|
+
|
561
|
+
def self.for_modifying(arg, opts = { }, &block)
|
562
|
+
unobtrusively(arg, {:writable => true}.merge(opts), &block)
|
562
563
|
end
|
563
564
|
|
564
565
|
# allows to read or modify a workbook such that its state remains unchanged
|
@@ -570,32 +571,48 @@ module RobustExcelOle
|
|
570
571
|
# @option opts [Boolean] :writable true (default)/false changes of the workbook shall be saved/not saved
|
571
572
|
# @option opts [Boolean] :keep_open whether the workbook shall be kept open after unobtrusively opening (default: false)
|
572
573
|
# @return [Workbook] a workbook
|
573
|
-
def self.unobtrusively(file_or_workbook, opts = { })
|
574
|
-
opts = process_options(opts, :use_defaults => false)
|
575
|
-
raise OptionInvalid, 'contradicting options' if opts[:writable] && opts[:read_only]
|
576
|
-
opts = opts.merge({:force => {:excel => opts[:if_closed]}, :if_closed => :current,
|
577
|
-
:if_unsaved => :accept, :keep_open => false})
|
578
|
-
opts = opts.merge({:read_only => opts[:read_only]}) unless opts[:read_only].nil?
|
574
|
+
def self.unobtrusively(file_or_workbook, opts = { }, &block)
|
579
575
|
file = (file_or_workbook.is_a? WIN32OLE) ? file_or_workbook.Fullname.tr('\\','/') : file_or_workbook
|
576
|
+
unobtrusively_opening(file, opts, nil, &block)
|
577
|
+
end
|
578
|
+
|
579
|
+
def unobtrusively(opts = { }, &block)
|
580
|
+
file = @stored_filename
|
581
|
+
self.class.unobtrusively_opening(file, opts, alive?, &block)
|
582
|
+
end
|
583
|
+
|
584
|
+
@private
|
585
|
+
def self.unobtrusively_opening(file, opts, book_is_alive, &block)
|
586
|
+
opts = process_options(opts)
|
587
|
+
opts = {:if_closed => :current, :keep_open => false}.merge(opts)
|
588
|
+
raise OptionInvalid, 'contradicting options' if opts[:writable] && opts[:read_only]
|
589
|
+
if book_is_alive.nil?
|
590
|
+
prefer_writable = ((!(opts[:read_only]) || opts[:writable] == true) &&
|
591
|
+
!(opts[:read_only].nil? && opts[:writable] == false))
|
592
|
+
known_book = bookstore.fetch(file, :prefer_writable => prefer_writable)
|
593
|
+
end
|
594
|
+
excel_opts = if (book_is_alive==false || (book_is_alive.nil? && (known_book.nil? || !known_book.alive?)))
|
595
|
+
{:force => {:excel => opts[:if_closed]}}
|
596
|
+
else
|
597
|
+
{:force => {:excel => opts[:force][:excel]}, :default => {:excel => opts[:default][:excel]}}
|
598
|
+
end
|
599
|
+
open_opts = excel_opts.merge({:if_unsaved => :accept})
|
580
600
|
begin
|
581
|
-
book = open(file)
|
601
|
+
book = open(file, open_opts)
|
582
602
|
was_visible = book.visible
|
583
603
|
was_writable = book.writable
|
584
604
|
was_saved = book.saved
|
585
605
|
was_check_compatibility = book.check_compatibility
|
586
|
-
was_calculation = book.excel.calculation
|
587
|
-
book.set_options(file,opts)
|
588
|
-
if !was_saved && ((opts[:writable] && !was_writable) || (opts[:read_only] && was_writable))
|
589
|
-
raise NotImplementedREOError, 'unsaved read-only workbook shall be written'
|
590
|
-
end
|
606
|
+
was_calculation = book.excel.properties[:calculation]
|
607
|
+
book.set_options(file,opts)
|
591
608
|
yield book
|
592
609
|
ensure
|
593
610
|
if book && book.alive?
|
594
|
-
do_not_write =
|
595
|
-
book.save unless
|
596
|
-
# open and close if the read_only mode has changed
|
611
|
+
do_not_write = opts[:read_only] || opts[:writable]==false
|
612
|
+
book.save unless book.saved || do_not_write || !book.writable
|
597
613
|
if (opts[:read_only] && was_writable) || (!opts[:read_only] && !was_writable)
|
598
|
-
book
|
614
|
+
book.set_options(file, opts.merge({:read_only => !was_writable,
|
615
|
+
:if_unsaved => (opts[:writable]==false ? :forget : :save)}))
|
599
616
|
end
|
600
617
|
if book.was_open
|
601
618
|
book.visible = was_visible
|
@@ -608,60 +625,6 @@ module RobustExcelOle
|
|
608
625
|
end
|
609
626
|
end
|
610
627
|
|
611
|
-
# allows to read or modify a workbook such that its state remains unchanged
|
612
|
-
# state comprises: open, saved, writable, visible, calculation mode, check compatibility
|
613
|
-
# @param [String] file_or_workbook a file name or WIN32OLE workbook
|
614
|
-
# @param [Hash] opts the options
|
615
|
-
# @option opts [Variant] :if_closed :current (default), :new or an Excel instance
|
616
|
-
# @option opts [Boolean] :read_only true/false (default), open the workbook in read-only/read-write modus (save changes)
|
617
|
-
# @option opts [Boolean] :writable true (default)/false changes of the workbook shall be saved/not saved
|
618
|
-
# @option opts [Boolean] :keep_open whether the workbook shall be kept open after unobtrusively opening (default: false)
|
619
|
-
# @return [Workbook] a workbook
|
620
|
-
=begin
|
621
|
-
def self.unobtrusively(file_or_workbook, opts = { })
|
622
|
-
book = new(file_or_workbook)
|
623
|
-
book.unobtrusively(opts)
|
624
|
-
end
|
625
|
-
=end
|
626
|
-
|
627
|
-
def unobtrusively(opts = { })
|
628
|
-
opts = process_options(opts, :use_defaults => false)
|
629
|
-
raise OptionInvalid, 'contradicting options' if opts[:writable] && opts[:read_only]
|
630
|
-
opts = opts.merge({:force => {:excel => opts[:if_closed]}, :if_closed => :current,
|
631
|
-
:if_unsaved => :accept, :keep_open => false})
|
632
|
-
opts = opts.merge({:read_only => opts[:read_only]}) unless opts[:read_only].nil?
|
633
|
-
file = stored_filename
|
634
|
-
begin
|
635
|
-
book = open(file, opts)
|
636
|
-
was_visible = book.visible
|
637
|
-
was_saved = book.saved
|
638
|
-
was_writable = book.was_writable
|
639
|
-
was_check_compatibility = book.CheckCompatibility
|
640
|
-
was_calculation = book.excel.calculation
|
641
|
-
if !was_saved && ((opts[:writable] && !was_writable) || (opts[:read_only] && was_writable))
|
642
|
-
raise NotImplementedREOError, 'unsaved read-only workbook shall be written'
|
643
|
-
end
|
644
|
-
yield book
|
645
|
-
ensure
|
646
|
-
if book && book.alive?
|
647
|
-
do_not_write = (opts[:read_only] || (opts[:read_only].nil? && opts[:writable] == false))
|
648
|
-
book.save unless book.saved || do_not_write || book.ReadOnly
|
649
|
-
# open and close if the read_only mode has changed
|
650
|
-
if (opts[:read_only] && was_writable) || (!opts[:read_only] && !was_writable)
|
651
|
-
book = open(file, :read_only => !was_writable, :if_unsaved => :forget)
|
652
|
-
end
|
653
|
-
if book.was_open
|
654
|
-
book.visible = was_visible
|
655
|
-
book.CheckCompatibility = was_check_compatibility
|
656
|
-
book.excel.calculation = was_calculation
|
657
|
-
end
|
658
|
-
book.Saved = (was_saved || !book.was_open)
|
659
|
-
book.close unless book.was_open || opts[:keep_open]
|
660
|
-
end
|
661
|
-
end
|
662
|
-
end
|
663
|
-
|
664
|
-
|
665
628
|
# reopens a closed workbook
|
666
629
|
# @options options
|
667
630
|
def reopen(options = { })
|
@@ -857,7 +820,7 @@ module RobustExcelOle
|
|
857
820
|
last_sheet_local = last_sheet
|
858
821
|
after_or_before, base_sheet = opts.to_a.first || [:after, last_sheet_local]
|
859
822
|
begin
|
860
|
-
if
|
823
|
+
if !::JRUBY_BUG_COPYSHEETS
|
861
824
|
if sheet
|
862
825
|
sheet.Copy({ after_or_before.to_s => base_sheet.ole_worksheet })
|
863
826
|
else
|
@@ -990,7 +953,7 @@ module RobustExcelOle
|
|
990
953
|
end
|
991
954
|
|
992
955
|
def calculation
|
993
|
-
@excel.calculation if @ole_workbook
|
956
|
+
@excel.properties[:calculation] if @ole_workbook
|
994
957
|
end
|
995
958
|
|
996
959
|
# @private
|
@@ -1000,7 +963,7 @@ module RobustExcelOle
|
|
1000
963
|
|
1001
964
|
# returns true, if the workbook is visible, false otherwise
|
1002
965
|
def visible
|
1003
|
-
@excel.
|
966
|
+
@excel.Visible && @ole_workbook.Windows(@ole_workbook.Name).Visible
|
1004
967
|
end
|
1005
968
|
|
1006
969
|
# makes both the Excel instance and the window of the workbook visible, or the window invisible
|
@@ -1046,6 +1009,11 @@ module RobustExcelOle
|
|
1046
1009
|
self.class.bookstore
|
1047
1010
|
end
|
1048
1011
|
|
1012
|
+
# @private
|
1013
|
+
def workbook
|
1014
|
+
self
|
1015
|
+
end
|
1016
|
+
|
1049
1017
|
# @private
|
1050
1018
|
def to_s
|
1051
1019
|
self.filename.to_s
|
@@ -1109,7 +1077,7 @@ module RobustExcelOle
|
|
1109
1077
|
def method_missing(name, *args)
|
1110
1078
|
if name.to_s[0,1] =~ /[A-Z]/
|
1111
1079
|
raise ObjectNotAlive, 'method missing: workbook not alive' unless alive?
|
1112
|
-
if JRUBY_BUG_ERRORMESSAGE
|
1080
|
+
if ::JRUBY_BUG_ERRORMESSAGE
|
1113
1081
|
begin
|
1114
1082
|
@ole_workbook.send(name, *args)
|
1115
1083
|
rescue Java::OrgRacobCom::ComFailException
|
@@ -12,6 +12,7 @@ module RobustExcelOle
|
|
12
12
|
class Worksheet < RangeOwners
|
13
13
|
|
14
14
|
attr_reader :ole_worksheet
|
15
|
+
attr_reader :workbook
|
15
16
|
|
16
17
|
def initialize(win32_worksheet)
|
17
18
|
@ole_worksheet = win32_worksheet
|
@@ -27,12 +28,17 @@ module RobustExcelOle
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def workbook
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
return @workbook unless @workbook.nil?
|
32
|
+
begin
|
33
|
+
ole_workbook = self.Parent
|
34
|
+
saved_status = ole_workbook.Saved
|
35
|
+
ole_workbook.Saved = true unless saved_status
|
36
|
+
@workbook = workbook_class.new(ole_workbook)
|
37
|
+
ole_workbook.Saved = saved_status
|
38
|
+
rescue
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
@workbook
|
36
42
|
end
|
37
43
|
|
38
44
|
# sheet name
|
@@ -40,7 +46,7 @@ module RobustExcelOle
|
|
40
46
|
def name
|
41
47
|
@ole_worksheet.Name
|
42
48
|
rescue
|
43
|
-
raise WorksheetREOError, "name
|
49
|
+
raise WorksheetREOError, "name could not be determined"
|
44
50
|
end
|
45
51
|
|
46
52
|
# sets sheet name
|
@@ -206,8 +212,7 @@ module RobustExcelOle
|
|
206
212
|
|
207
213
|
# @private
|
208
214
|
def to_s
|
209
|
-
'#<Worksheet: ' + name.to_s + ">"
|
210
|
-
#'#<Worksheet: ' + ('not alive ' unless workbook.alive?).to_s + name.to_s + " #{File.basename(workbook.stored_filename)} >"
|
215
|
+
'#<Worksheet: ' + (workbook.nil? ? 'not alive ' : (name + ' ' + File.basename(workbook.stored_filename)).to_s) + ">"
|
211
216
|
end
|
212
217
|
|
213
218
|
# @private
|
@@ -220,7 +225,7 @@ module RobustExcelOle
|
|
220
225
|
# @private
|
221
226
|
def method_missing(name, *args)
|
222
227
|
if name.to_s[0,1] =~ /[A-Z]/
|
223
|
-
if JRUBY_BUG_ERRORMESSAGE
|
228
|
+
if ::JRUBY_BUG_ERRORMESSAGE
|
224
229
|
begin
|
225
230
|
@ole_worksheet.send(name, *args)
|
226
231
|
rescue Java::OrgRacobCom::ComFailException
|
Binary file
|
data/spec/excel_spec.rb
CHANGED
@@ -271,16 +271,16 @@ module RobustExcelOle
|
|
271
271
|
ole_excel = WIN32OLE.new("Excel.Application")
|
272
272
|
reo_excel = Excel.new(ole_excel)
|
273
273
|
reo_excel.ole_excel.Hwnd.should == ole_excel.Hwnd
|
274
|
-
reo_excel.
|
275
|
-
reo_excel.displayalerts.should == :if_visible
|
274
|
+
reo_excel.Visible.should == false
|
275
|
+
reo_excel.properties[:displayalerts].should == :if_visible
|
276
276
|
end
|
277
277
|
|
278
278
|
it "lifts an Excel instance given as WIN32OLE object and set options" do
|
279
279
|
app = WIN32OLE.new('Excel.Application')
|
280
280
|
ole_excel = WIN32OLE.connect("Excel.Application")
|
281
281
|
reo_excel = Excel.new(ole_excel, {:displayalerts => true, :visible => true})
|
282
|
-
ole_excel.
|
283
|
-
ole_excel.
|
282
|
+
ole_excel.Visible.should == true
|
283
|
+
ole_excel.DisplayAlerts.should == true
|
284
284
|
end
|
285
285
|
|
286
286
|
|
@@ -889,6 +889,8 @@ module RobustExcelOle
|
|
889
889
|
# "Yes" is to the left of "No", which is the default. --> language independent
|
890
890
|
@excel.should be_alive
|
891
891
|
@key_sender.puts "{enter}"
|
892
|
+
@key_sender.puts "{enter}"
|
893
|
+
@key_sender.puts "{enter}"
|
892
894
|
result = @excel.close(:if_unsaved => :alert)
|
893
895
|
@excel.should_not be_alive
|
894
896
|
result.should == 1
|
@@ -920,6 +922,7 @@ module RobustExcelOle
|
|
920
922
|
@book.saved.should be false
|
921
923
|
@key_sender.puts "{left}{enter}"
|
922
924
|
@key_sender.puts "{left}{enter}"
|
925
|
+
@key_sender.puts "{left}{enter}"
|
923
926
|
expect{
|
924
927
|
@excel.close(:if_unsaved => :alert)
|
925
928
|
}.to raise_error(ExcelREOError, "user canceled or runtime error")
|
@@ -1254,55 +1257,55 @@ module RobustExcelOle
|
|
1254
1257
|
excel2 = Excel.create
|
1255
1258
|
excel1.focus
|
1256
1259
|
excel1.Visible.should be true
|
1257
|
-
excel1.visible.should be true
|
1260
|
+
excel1.properties[:visible].should be true
|
1258
1261
|
end
|
1259
1262
|
|
1260
1263
|
it "should set default values" do
|
1261
1264
|
excel1 = Excel.new
|
1262
1265
|
excel1.Visible.should be false
|
1263
1266
|
excel1.DisplayAlerts.should be false
|
1264
|
-
excel1.visible.should be false
|
1265
|
-
excel1.displayalerts.should == :if_visible
|
1267
|
+
excel1.properties[:visible].should be false
|
1268
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1266
1269
|
end
|
1267
1270
|
|
1268
1271
|
it "should set visible true" do
|
1269
1272
|
excel1 = Excel.new(:visible => true)
|
1270
1273
|
excel1.Visible.should be true
|
1271
1274
|
excel1.DisplayAlerts.should be true
|
1272
|
-
excel1.visible.should be true
|
1273
|
-
excel1.displayalerts.should == :if_visible
|
1275
|
+
excel1.properties[:visible].should be true
|
1276
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1274
1277
|
end
|
1275
1278
|
|
1276
1279
|
it "should set visible false" do
|
1277
1280
|
excel1 = Excel.new(:visible => false)
|
1278
1281
|
excel1.Visible.should be false
|
1279
1282
|
excel1.DisplayAlerts.should be false
|
1280
|
-
excel1.visible.should be false
|
1281
|
-
excel1.displayalerts.should == :if_visible
|
1283
|
+
excel1.properties[:visible].should be false
|
1284
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1282
1285
|
end
|
1283
1286
|
|
1284
1287
|
it "should set displayalerts true" do
|
1285
1288
|
excel1 = Excel.new(:displayalerts => true)
|
1286
1289
|
excel1.Visible.should be false
|
1287
1290
|
excel1.DisplayAlerts.should be true
|
1288
|
-
excel1.visible.should be false
|
1289
|
-
excel1.displayalerts.should be true
|
1291
|
+
excel1.properties[:visible].should be false
|
1292
|
+
excel1.properties[:displayalerts].should be true
|
1290
1293
|
end
|
1291
1294
|
|
1292
1295
|
it "should set displayalerts false" do
|
1293
1296
|
excel1 = Excel.new(:displayalerts => false)
|
1294
1297
|
excel1.Visible.should be false
|
1295
1298
|
excel1.DisplayAlerts.should be false
|
1296
|
-
excel1.visible.should be false
|
1297
|
-
excel1.displayalerts.should be false
|
1299
|
+
excel1.properties[:visible].should be false
|
1300
|
+
excel1.properties[:displayalerts].should be false
|
1298
1301
|
end
|
1299
1302
|
|
1300
1303
|
it "should use values of the current Excel when reusing" do
|
1301
1304
|
excel1 = Excel.create
|
1302
1305
|
excel1.Visible.should be false
|
1303
1306
|
excel1.DisplayAlerts.should be false
|
1304
|
-
excel1.visible.should be false
|
1305
|
-
excel1.displayalerts.should == :if_visible
|
1307
|
+
excel1.properties[:visible].should be false
|
1308
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1306
1309
|
excel1.Visible = true
|
1307
1310
|
excel1.DisplayAlerts = true
|
1308
1311
|
excel1.Visible.should be true
|
@@ -1316,49 +1319,49 @@ module RobustExcelOle
|
|
1316
1319
|
excel1 = Excel.create
|
1317
1320
|
excel2 = Excel.current
|
1318
1321
|
excel2.Visible.should be false
|
1319
|
-
excel2.visible.should be false
|
1322
|
+
excel2.properties[:visible].should be false
|
1320
1323
|
excel2.DisplayAlerts.should be false
|
1321
|
-
excel2.displayalerts.should == :if_visible
|
1324
|
+
excel2.properties[:displayalerts].should == :if_visible
|
1322
1325
|
end
|
1323
1326
|
|
1324
1327
|
it "should take Visible and DisplayAlerts from the connected Excel" do
|
1325
1328
|
excel1 = Excel.create
|
1326
1329
|
excel2 = Excel.current(:visible => true)
|
1327
1330
|
excel2.Visible.should be true
|
1328
|
-
excel2.visible.should be true
|
1331
|
+
excel2.properties[:visible].should be true
|
1329
1332
|
excel2.DisplayAlerts.should be true
|
1330
|
-
excel2.displayalerts.should == :if_visible
|
1333
|
+
excel2.properties[:displayalerts].should == :if_visible
|
1331
1334
|
end
|
1332
1335
|
|
1333
1336
|
it "should set Excel visible and invisible with current" do
|
1334
1337
|
excel1 = Excel.new(:reuse => false, :visible => true)
|
1335
1338
|
excel1.Visible.should be true
|
1336
|
-
excel1.visible.should be true
|
1339
|
+
excel1.properties[:visible].should be true
|
1337
1340
|
excel1.DisplayAlerts.should be true
|
1338
|
-
excel1.displayalerts.should == :if_visible
|
1341
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1339
1342
|
excel1.visible = false
|
1340
1343
|
excel1.Visible.should be false
|
1341
|
-
excel1.visible.should be false
|
1344
|
+
excel1.properties[:visible].should be false
|
1342
1345
|
excel1.DisplayAlerts.should be false
|
1343
|
-
excel1.displayalerts.should == :if_visible
|
1346
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1344
1347
|
excel2 = Excel.current(:visible => true)
|
1345
1348
|
excel2.Visible.should be true
|
1346
|
-
excel2.visible.should be true
|
1347
|
-
excel2.displayalerts.should == :if_visible
|
1349
|
+
excel2.properties[:visible].should be true
|
1350
|
+
excel2.properties[:displayalerts].should == :if_visible
|
1348
1351
|
excel2.DisplayAlerts.should be true
|
1349
1352
|
end
|
1350
1353
|
|
1351
1354
|
it "should set Excel visible and invisible" do
|
1352
1355
|
excel = Excel.new(:reuse => false, :visible => true)
|
1353
1356
|
excel.Visible.should be true
|
1354
|
-
excel.visible.should be true
|
1357
|
+
excel.properties[:visible].should be true
|
1355
1358
|
excel.DisplayAlerts.should be true
|
1356
|
-
excel.displayalerts.should == :if_visible
|
1359
|
+
excel.properties[:displayalerts].should == :if_visible
|
1357
1360
|
excel.visible = false
|
1358
1361
|
excel.Visible.should be false
|
1359
|
-
excel.visible.should be false
|
1362
|
+
excel.properties[:visible].should be false
|
1360
1363
|
excel.DisplayAlerts.should be false
|
1361
|
-
excel.displayalerts.should == :if_visible
|
1364
|
+
excel.properties[:displayalerts].should == :if_visible
|
1362
1365
|
excel7 = Excel.current
|
1363
1366
|
excel7.should === excel
|
1364
1367
|
excel7.Visible.should be false
|
@@ -1366,117 +1369,117 @@ module RobustExcelOle
|
|
1366
1369
|
excel1 = Excel.create(:visible => true)
|
1367
1370
|
excel1.should_not == excel
|
1368
1371
|
excel1.Visible.should be true
|
1369
|
-
excel1.visible.should be true
|
1372
|
+
excel1.properties[:visible].should be true
|
1370
1373
|
excel1.DisplayAlerts.should be true
|
1371
|
-
excel1.displayalerts.should == :if_visible
|
1374
|
+
excel1.properties[:displayalerts].should == :if_visible
|
1372
1375
|
excel2 = Excel.create(:visible => false)
|
1373
1376
|
excel2.Visible.should be false
|
1374
|
-
excel2.visible.should be false
|
1377
|
+
excel2.properties[:visible].should be false
|
1375
1378
|
excel2.DisplayAlerts.should be false
|
1376
|
-
excel2.displayalerts.should == :if_visible
|
1379
|
+
excel2.properties[:displayalerts].should == :if_visible
|
1377
1380
|
excel3 = Excel.current
|
1378
1381
|
excel3.should === excel
|
1379
1382
|
excel3.Visible.should be false
|
1380
|
-
excel3.visible.should be false
|
1383
|
+
excel3.properties[:visible].should be false
|
1381
1384
|
excel3.DisplayAlerts.should be false
|
1382
|
-
excel3.displayalerts.should == :if_visible
|
1385
|
+
excel3.properties[:displayalerts].should == :if_visible
|
1383
1386
|
excel4 = Excel.current(:visible => true)
|
1384
1387
|
excel4.should === excel
|
1385
1388
|
excel4.Visible.should be true
|
1386
|
-
excel4.visible.should be true
|
1389
|
+
excel4.properties[:visible].should be true
|
1387
1390
|
excel4.DisplayAlerts.should be true
|
1388
|
-
excel4.displayalerts.should == :if_visible
|
1391
|
+
excel4.properties[:displayalerts].should == :if_visible
|
1389
1392
|
excel5 = Excel.current(:visible => false)
|
1390
1393
|
excel5.should === excel
|
1391
1394
|
excel5.Visible.should be false
|
1392
|
-
excel5.visible.should be false
|
1395
|
+
excel5.properties[:visible].should be false
|
1393
1396
|
excel5.DisplayAlerts.should be false
|
1394
|
-
excel5.displayalerts.should == :if_visible
|
1397
|
+
excel5.properties[:displayalerts].should == :if_visible
|
1395
1398
|
end
|
1396
1399
|
|
1397
1400
|
it "should enable or disable Excel DispayAlerts" do
|
1398
1401
|
excel = Excel.new(:reuse => false, :displayalerts => true)
|
1399
1402
|
excel.DisplayAlerts.should be true
|
1400
|
-
excel.displayalerts.should be true
|
1403
|
+
excel.properties[:displayalerts].should be true
|
1401
1404
|
excel.Visible.should be false
|
1402
|
-
excel.visible.should be false
|
1405
|
+
excel.properties[:visible].should be false
|
1403
1406
|
excel6 = Excel.current
|
1404
1407
|
excel6.should === excel
|
1405
1408
|
excel6.DisplayAlerts.should be true
|
1406
|
-
excel6.displayalerts.should be true
|
1409
|
+
excel6.properties[:displayalerts].should be true
|
1407
1410
|
excel6.Visible.should be false
|
1408
|
-
excel6.visible.should be false
|
1411
|
+
excel6.properties[:visible].should be false
|
1409
1412
|
excel.displayalerts = false
|
1410
1413
|
excel.DisplayAlerts.should be false
|
1411
|
-
excel.displayalerts.should be false
|
1414
|
+
excel.properties[:displayalerts].should be false
|
1412
1415
|
excel.Visible.should be false
|
1413
|
-
excel.visible.should be false
|
1416
|
+
excel.properties[:visible].should be false
|
1414
1417
|
excel7 = Excel.current
|
1415
1418
|
excel7.should === excel
|
1416
1419
|
excel7.DisplayAlerts.should be false
|
1417
|
-
excel7.displayalerts.should be false
|
1420
|
+
excel7.properties[:displayalerts].should be false
|
1418
1421
|
excel7.Visible.should be false
|
1419
|
-
excel7.visible.should be false
|
1422
|
+
excel7.properties[:visible].should be false
|
1420
1423
|
excel1 = Excel.create(:displayalerts => true)
|
1421
1424
|
excel1.should_not == excel
|
1422
1425
|
excel1.DisplayAlerts.should be true
|
1423
|
-
excel1.displayalerts.should be true
|
1426
|
+
excel1.properties[:displayalerts].should be true
|
1424
1427
|
excel1.Visible.should be false
|
1425
|
-
excel1.visible.should be false
|
1428
|
+
excel1.properties[:visible].should be false
|
1426
1429
|
excel2 = Excel.create(:displayalerts => false)
|
1427
1430
|
excel2.DisplayAlerts.should be false
|
1428
|
-
excel2.displayalerts.should be false
|
1431
|
+
excel2.properties[:displayalerts].should be false
|
1429
1432
|
excel2.Visible.should be false
|
1430
|
-
excel2.visible.should be false
|
1433
|
+
excel2.properties[:visible].should be false
|
1431
1434
|
excel3 = Excel.current
|
1432
1435
|
excel3.should === excel
|
1433
1436
|
excel3.DisplayAlerts.should be false
|
1434
|
-
excel3.displayalerts.should be false
|
1437
|
+
excel3.properties[:displayalerts].should be false
|
1435
1438
|
excel3.Visible.should be false
|
1436
|
-
excel3.visible.should be false
|
1439
|
+
excel3.properties[:visible].should be false
|
1437
1440
|
excel4 = Excel.current(:displayalerts => true)
|
1438
1441
|
excel4.should === excel
|
1439
1442
|
excel4.DisplayAlerts.should be true
|
1440
|
-
excel4.displayalerts.should be true
|
1443
|
+
excel4.properties[:displayalerts].should be true
|
1441
1444
|
excel4.Visible.should be false
|
1442
|
-
excel4.visible.should be false
|
1445
|
+
excel4.properties[:visible].should be false
|
1443
1446
|
excel5 = Excel.current(:displayalerts => false)
|
1444
1447
|
excel5.should === excel
|
1445
1448
|
excel5.DisplayAlerts.should be false
|
1446
|
-
excel5.displayalerts.should be false
|
1449
|
+
excel5.properties[:displayalerts].should be false
|
1447
1450
|
excel5.Visible.should be false
|
1448
|
-
excel5.visible.should be false
|
1451
|
+
excel5.properties[:visible].should be false
|
1449
1452
|
end
|
1450
1453
|
|
1451
1454
|
it "should set Excel visible and displayalerts" do
|
1452
1455
|
excel = Excel.new(:reuse => false, :visible => true, :displayalerts => true)
|
1453
1456
|
excel.DisplayAlerts.should be true
|
1454
|
-
excel.displayalerts.should be true
|
1457
|
+
excel.properties[:displayalerts].should be true
|
1455
1458
|
excel.Visible.should be true
|
1456
|
-
excel.visible.should be true
|
1459
|
+
excel.properties[:visible].should be true
|
1457
1460
|
excel6 = Excel.current
|
1458
1461
|
excel6.should === excel
|
1459
1462
|
excel6.DisplayAlerts.should be true
|
1460
|
-
excel6.displayalerts.should be true
|
1463
|
+
excel6.properties[:displayalerts].should be true
|
1461
1464
|
excel6.Visible.should be true
|
1462
|
-
excel6.visible.should be true
|
1465
|
+
excel6.properties[:visible].should be true
|
1463
1466
|
excel.displayalerts = false
|
1464
1467
|
excel.DisplayAlerts.should be false
|
1465
|
-
excel.displayalerts.should be false
|
1468
|
+
excel.properties[:displayalerts].should be false
|
1466
1469
|
excel.Visible.should be true
|
1467
|
-
excel.visible.should be true
|
1470
|
+
excel.properties[:visible].should be true
|
1468
1471
|
excel7 = Excel.current
|
1469
1472
|
excel7.should === excel
|
1470
1473
|
excel7.DisplayAlerts.should be false
|
1471
|
-
excel7.displayalerts.should be false
|
1474
|
+
excel7.properties[:displayalerts].should be false
|
1472
1475
|
excel7.Visible.should be true
|
1473
|
-
excel7.visible.should be true
|
1476
|
+
excel7.properties[:visible].should be true
|
1474
1477
|
excel2 = Excel.new(:reuse => false, :visible => true, :displayalerts => true)
|
1475
1478
|
excel2.visible = false
|
1476
1479
|
excel2.DisplayAlerts.should be true
|
1477
|
-
excel2.displayalerts.should be true
|
1480
|
+
excel2.properties[:displayalerts].should be true
|
1478
1481
|
excel2.Visible.should be false
|
1479
|
-
excel2.visible.should be false
|
1482
|
+
excel2.properties[:visible].should be false
|
1480
1483
|
excel3 = Excel.new(:reuse => false, :visible => true, :displayalerts => false)
|
1481
1484
|
excel3.Visible.should be true
|
1482
1485
|
excel3.DisplayAlerts.should be false
|
@@ -1488,21 +1491,21 @@ module RobustExcelOle
|
|
1488
1491
|
excel3.DisplayAlerts.should be false
|
1489
1492
|
excel4 = Excel.create(:visible => true, :displayalerts => true)
|
1490
1493
|
excel4.DisplayAlerts.should be true
|
1491
|
-
excel4.displayalerts.should be true
|
1494
|
+
excel4.properties[:displayalerts].should be true
|
1492
1495
|
excel4.Visible.should be true
|
1493
|
-
excel4.visible.should be true
|
1496
|
+
excel4.properties[:visible].should be true
|
1494
1497
|
excel5 = Excel.current(:visible => true, :displayalerts => false)
|
1495
1498
|
excel5.should === excel
|
1496
1499
|
excel5.DisplayAlerts.should be false
|
1497
|
-
excel5.displayalerts.should be false
|
1500
|
+
excel5.properties[:displayalerts].should be false
|
1498
1501
|
excel5.Visible.should be true
|
1499
|
-
excel5.visible.should be true
|
1502
|
+
excel5.properties[:visible].should be true
|
1500
1503
|
excel6 = Excel.current(:visible => false, :displayalerts => true)
|
1501
1504
|
excel6.should === excel
|
1502
1505
|
excel6.DisplayAlerts.should be true
|
1503
|
-
excel6.displayalerts.should be true
|
1506
|
+
excel6.properties[:displayalerts].should be true
|
1504
1507
|
excel6.Visible.should be false
|
1505
|
-
excel6.visible.should be false
|
1508
|
+
excel6.properties[:visible].should be false
|
1506
1509
|
end
|
1507
1510
|
|
1508
1511
|
it "should work with displayalerts == if_visible" do
|
@@ -1623,17 +1626,17 @@ module RobustExcelOle
|
|
1623
1626
|
|
1624
1627
|
it "should create and reuse Excel with calculation mode" do
|
1625
1628
|
excel1 = Excel.create(:calculation => :manual)
|
1626
|
-
excel1.calculation.should == :manual
|
1629
|
+
excel1.properties[:calculation].should == :manual
|
1627
1630
|
excel2 = Excel.create(:calculation => :automatic)
|
1628
|
-
excel2.calculation.should == :automatic
|
1631
|
+
excel2.properties[:calculation].should == :automatic
|
1629
1632
|
excel3 = Excel.current
|
1630
|
-
excel3.calculation.should == :manual
|
1633
|
+
excel3.properties[:calculation].should == :manual
|
1631
1634
|
excel4 = Excel.current(:calculation => :automatic)
|
1632
|
-
excel4.calculation.should == :automatic
|
1635
|
+
excel4.properties[:calculation].should == :automatic
|
1633
1636
|
excel5 = Excel.new(:reuse => false)
|
1634
|
-
excel5.calculation.should == nil
|
1637
|
+
excel5.properties[:calculation].should == nil
|
1635
1638
|
excel6 = Excel.new(:reuse => false, :calculation => :manual)
|
1636
|
-
excel6.calculation.should == :manual
|
1639
|
+
excel6.properties[:calculation].should == :manual
|
1637
1640
|
end
|
1638
1641
|
|
1639
1642
|
=begin
|
@@ -1657,11 +1660,11 @@ module RobustExcelOle
|
|
1657
1660
|
old_calculation_mode = @excel1.Calculation
|
1658
1661
|
old_calculatebeforesave = @excel1.CalculateBeforeSave
|
1659
1662
|
@excel1.calculation = :automatic
|
1660
|
-
@excel1.calculation.should == :automatic
|
1663
|
+
@excel1.properties[:calculation].should == :automatic
|
1661
1664
|
@excel1.Calculation.should == old_calculation_mode
|
1662
1665
|
@excel1.CalculateBeforeSave.should == old_calculatebeforesave
|
1663
1666
|
@excel1.calculation = :manual
|
1664
|
-
@excel1.calculation.should == :manual
|
1667
|
+
@excel1.properties[:calculation].should == :manual
|
1665
1668
|
@excel1.Calculation.should == old_calculation_mode
|
1666
1669
|
@excel1.CalculateBeforeSave.should == old_calculatebeforesave
|
1667
1670
|
end
|
@@ -1673,7 +1676,7 @@ module RobustExcelOle
|
|
1673
1676
|
book1 = Workbook.open(@simple_file1, :visible => false)
|
1674
1677
|
expect( book1.Windows(1).Visible ).to be true # false
|
1675
1678
|
expect { excel1.calculation = :manual
|
1676
|
-
}.to change{ excel1.calculation
|
1679
|
+
}.to change{ excel1.properties[:calculation]
|
1677
1680
|
}.from( :automatic
|
1678
1681
|
).to( :manual )
|
1679
1682
|
end
|
@@ -1683,7 +1686,7 @@ module RobustExcelOle
|
|
1683
1686
|
book1 = Workbook.open(@simple_file1, :visible => false)
|
1684
1687
|
expect( book1.Windows(1).Visible ).to be true # false
|
1685
1688
|
expect { excel1.calculation = :automatic
|
1686
|
-
}.to change{ excel1.calculation
|
1689
|
+
}.to change{ excel1.properties[:calculation]
|
1687
1690
|
}.from( :manual
|
1688
1691
|
).to( :automatic )
|
1689
1692
|
end
|
@@ -1694,7 +1697,7 @@ module RobustExcelOle
|
|
1694
1697
|
book = Workbook.open(@simple_file, :visible => true)
|
1695
1698
|
old_calculation_mode = @excel1.Calculation
|
1696
1699
|
@excel1.with_calculation(:manual) do
|
1697
|
-
@excel1.calculation.should == :manual
|
1700
|
+
@excel1.properties[:calculation].should == :manual
|
1698
1701
|
@excel1.Calculation.should == XlCalculationManual
|
1699
1702
|
@excel1.CalculateBeforeSave.should be false
|
1700
1703
|
book.Saved.should be true
|
@@ -1702,7 +1705,7 @@ module RobustExcelOle
|
|
1702
1705
|
@excel1.Calculation.should == old_calculation_mode
|
1703
1706
|
@excel1.CalculateBeforeSave.should be false
|
1704
1707
|
@excel1.with_calculation(:automatic) do
|
1705
|
-
@excel1.calculation.should == :automatic
|
1708
|
+
@excel1.properties[:calculation].should == :automatic
|
1706
1709
|
@excel1.Calculation.should == XlCalculationAutomatic
|
1707
1710
|
@excel1.CalculateBeforeSave.should be false
|
1708
1711
|
book.Saved.should be false
|
@@ -1717,7 +1720,7 @@ module RobustExcelOle
|
|
1717
1720
|
book.Saved.should be true
|
1718
1721
|
book.Windows(book.Name).Visible = true
|
1719
1722
|
@excel1.calculation = :manual
|
1720
|
-
@excel1.calculation.should == :manual
|
1723
|
+
@excel1.properties[:calculation].should == :manual
|
1721
1724
|
@excel1.Calculation.should == XlCalculationManual
|
1722
1725
|
@excel1.CalculateBeforeSave.should be false
|
1723
1726
|
book.Saved.should be true
|
@@ -1728,7 +1731,7 @@ module RobustExcelOle
|
|
1728
1731
|
book = Workbook.open(@simple_file, :visible => true)
|
1729
1732
|
book.Saved.should be true
|
1730
1733
|
@excel1.calculation = :automatic
|
1731
|
-
@excel1.calculation.should == :automatic
|
1734
|
+
@excel1.properties[:calculation].should == :automatic
|
1732
1735
|
@excel1.Calculation.should == XlCalculationAutomatic
|
1733
1736
|
@excel1.CalculateBeforeSave.should be false
|
1734
1737
|
book.Saved.should be true
|
@@ -1741,7 +1744,7 @@ module RobustExcelOle
|
|
1741
1744
|
book.Saved.should be false
|
1742
1745
|
book.Windows(book.Name).Visible = true
|
1743
1746
|
@excel1.calculation = :manual
|
1744
|
-
@excel1.calculation.should == :manual
|
1747
|
+
@excel1.properties[:calculation].should == :manual
|
1745
1748
|
@excel1.Calculation.should == XlCalculationManual
|
1746
1749
|
@excel1.CalculateBeforeSave.should be false
|
1747
1750
|
book.Saved.should be false
|
@@ -1753,7 +1756,7 @@ module RobustExcelOle
|
|
1753
1756
|
book.sheet(1)[1,1] = "foo"
|
1754
1757
|
book.Saved.should be false
|
1755
1758
|
@excel1.calculation = :automatic
|
1756
|
-
@excel1.calculation.should == :automatic
|
1759
|
+
@excel1.properties[:calculation].should == :automatic
|
1757
1760
|
@excel1.Calculation.should == XlCalculationAutomatic
|
1758
1761
|
@excel1.CalculateBeforeSave.should be false
|
1759
1762
|
book.Saved.should be false
|
@@ -1770,7 +1773,7 @@ module RobustExcelOle
|
|
1770
1773
|
@excel1 = Excel.new
|
1771
1774
|
b = Workbook.open(@simple_file, :visible => true)
|
1772
1775
|
@excel1.Calculation = XlCalculationManual
|
1773
|
-
@excel1.calculation.should == :manual
|
1776
|
+
@excel1.properties[:calculation].should == :manual
|
1774
1777
|
@excel1.Calculation.should == XlCalculationManual
|
1775
1778
|
end
|
1776
1779
|
|
@@ -1778,7 +1781,7 @@ module RobustExcelOle
|
|
1778
1781
|
@excel1 = Excel.new
|
1779
1782
|
b = Workbook.open(@simple_file, :visible => true)
|
1780
1783
|
@excel1.Calculation = XlCalculationAutomatic
|
1781
|
-
@excel1.calculation.should == :automatic
|
1784
|
+
@excel1.properties[:calculation].should == :automatic
|
1782
1785
|
@excel1.Calculation.should == XlCalculationAutomatic
|
1783
1786
|
end
|
1784
1787
|
|
@@ -2096,7 +2099,6 @@ module RobustExcelOle
|
|
2096
2099
|
end
|
2097
2100
|
|
2098
2101
|
end
|
2099
|
-
|
2100
2102
|
|
2101
2103
|
describe "namevalue_glob, set_namevalue_glob" do
|
2102
2104
|
|