robust_excel_ole 1.13 → 1.18
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 +47 -4
- data/README.rdoc +52 -47
- data/___dummy_workbook.xls +0 -0
- data/docs/README_excel.rdoc +9 -3
- data/docs/README_open.rdoc +86 -44
- data/docs/README_ranges.rdoc +90 -81
- data/docs/README_save_close.rdoc +9 -9
- data/docs/README_sheet.rdoc +17 -17
- data/examples/example_ruby_library.rb +27 -0
- data/extconf.rb +7 -0
- data/lib/robust_excel_ole.rb +7 -4
- data/lib/robust_excel_ole/{address.rb → address_tool.rb} +23 -22
- data/lib/robust_excel_ole/{reo_common.rb → base.rb} +3 -92
- data/lib/robust_excel_ole/bookstore.rb +14 -77
- data/lib/robust_excel_ole/cell.rb +30 -18
- data/lib/robust_excel_ole/excel.rb +138 -92
- data/lib/robust_excel_ole/general.rb +40 -15
- data/lib/robust_excel_ole/range.rb +42 -19
- data/lib/robust_excel_ole/range_owners.rb +40 -25
- data/lib/robust_excel_ole/vba_objects.rb +30 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- data/lib/robust_excel_ole/workbook.rb +320 -319
- data/lib/robust_excel_ole/worksheet.rb +51 -25
- data/robust_excel_ole.gemspec +1 -0
- data/spec/address_tool_spec.rb +175 -0
- data/spec/{reo_common_spec.rb → base_spec.rb} +19 -34
- data/spec/bookstore_spec.rb +3 -3
- data/spec/cell_spec.rb +67 -25
- data/spec/data/more_data/workbook.xls +0 -0
- data/spec/excel_spec.rb +137 -369
- data/spec/general_spec.rb +21 -27
- data/spec/range_spec.rb +57 -3
- data/spec/workbook_spec.rb +11 -79
- data/spec/workbook_specs/workbook_misc_spec.rb +29 -40
- data/spec/workbook_specs/workbook_open_spec.rb +599 -31
- data/spec/workbook_specs/workbook_unobtr_spec.rb +760 -93
- data/spec/worksheet_spec.rb +36 -4
- metadata +12 -7
- data/spec/address_spec.rb +0 -174
data/spec/general_spec.rb
CHANGED
@@ -41,28 +41,41 @@ module RobustExcelOle
|
|
41
41
|
@book1 = Workbook.open(@simple_file)
|
42
42
|
end
|
43
43
|
|
44
|
-
it "should
|
44
|
+
it "should type-lift an Excel" do
|
45
45
|
excel = @book1.excel.ole_excel.to_reo
|
46
46
|
excel.class.should == RobustExcelOle::Excel
|
47
47
|
excel.should be_alive
|
48
48
|
end
|
49
49
|
|
50
|
-
it "should
|
50
|
+
it "should type-lift a workbook" do
|
51
51
|
workbook = @book1.ole_workbook.to_reo
|
52
52
|
workbook.should be_a Workbook
|
53
53
|
workbook.should be_alive
|
54
54
|
end
|
55
55
|
|
56
|
-
it "should
|
56
|
+
it "should type-lift a worksheet" do
|
57
57
|
worksheet = @book1.sheet(1).ole_worksheet.to_reo
|
58
58
|
worksheet.should be_kind_of Worksheet
|
59
59
|
worksheet.name.should == "Sheet1"
|
60
60
|
end
|
61
61
|
|
62
|
-
it "should
|
63
|
-
range = @book1.sheet(1).range([1,1]).ole_range.to_reo
|
62
|
+
it "should type-lift a range" do
|
63
|
+
range = @book1.sheet(1).range([1..2,1]).ole_range.to_reo
|
64
64
|
range.should be_kind_of Range
|
65
|
-
range.Value.should == "foo"
|
65
|
+
range.Value.should == [["foo"],["foo"]]
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should type-lift a cell" do
|
69
|
+
cell = @book1.sheet(1).range([1,1]).ole_range.to_reo
|
70
|
+
cell.should be_kind_of Cell
|
71
|
+
cell.Value.should == "foo"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not do anything with a REO object" do
|
75
|
+
@book1.to_reo.should == @book1
|
76
|
+
@book1.sheet(1).to_reo.should == @book1.sheet(1)
|
77
|
+
@book1.excel.to_reo.should == @book1.excel
|
78
|
+
@book1.sheet(1).range([1,1]).to_reo.should == @book1.sheet(1).range([1,1])
|
66
79
|
end
|
67
80
|
|
68
81
|
end
|
@@ -81,8 +94,7 @@ module RobustExcelOle
|
|
81
94
|
["ActiveCell", "ActiveSheet", "ActiveWorkbook", "Application", "Calculate", "Cells", "Columns",
|
82
95
|
"DisplayAlerts", "Evaluate", "Hwnd", "Name", "Names", "Quit", "Range", "Ready", "Save",
|
83
96
|
"Sheets", "UserName", "Value", "Visible", "Workbooks", "Worksheets"]
|
84
|
-
@excel_methods = ["alive?", "workbook_class", "close", "
|
85
|
-
"with_displayalerts"]
|
97
|
+
@excel_methods = ["alive?", "workbook_class", "close", "properties", "recreate", "with_displayalerts"]
|
86
98
|
@ole_sheet_methods = []
|
87
99
|
# ["Activate", "Calculate", "Copy", "Name", "Select", "Evaluate", "Protect", "Unprotect"]
|
88
100
|
@sheet_methods = ["workbook_class", "col_range", "each", "each_column", "each_column_with_index",
|
@@ -152,9 +164,8 @@ module RobustExcelOle
|
|
152
164
|
|
153
165
|
it "should return the right absolute paths" do
|
154
166
|
absolute_path("C:/abc").should == "C:\\abc"
|
155
|
-
absolute_path("C:\\abc").should == "C:\\abc"
|
167
|
+
#absolute_path("C:\\abc").should == "C:\\abc"
|
156
168
|
Dir.chdir "C:/windows"
|
157
|
-
# does not work under jruby
|
158
169
|
absolute_path("C:abc").downcase.should == Dir.pwd.gsub("/","\\").downcase + "\\abc"
|
159
170
|
absolute_path("C:abc").upcase.should == File.expand_path("abc").gsub("/","\\").upcase
|
160
171
|
end
|
@@ -224,22 +235,5 @@ module RobustExcelOle
|
|
224
235
|
end
|
225
236
|
end
|
226
237
|
|
227
|
-
describe "Object methods" do
|
228
|
-
|
229
|
-
before do
|
230
|
-
@book = Workbook.open(@simple_file)
|
231
|
-
@sheet = @book.sheet(1)
|
232
|
-
end
|
233
|
-
|
234
|
-
before do
|
235
|
-
@book.close
|
236
|
-
end
|
237
|
-
|
238
|
-
it "should raise an error when asking excel of a sheet" do
|
239
|
-
expect{
|
240
|
-
@sheet.excel
|
241
|
-
}.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Workbook")
|
242
|
-
end
|
243
|
-
end
|
244
238
|
end
|
245
239
|
end
|
data/spec/range_spec.rb
CHANGED
@@ -18,20 +18,74 @@ describe RobustExcelOle::Range do
|
|
18
18
|
@book = Workbook.open(@dir + '/workbook.xls', :force_excel => :new)
|
19
19
|
@sheet = @book.sheet(2)
|
20
20
|
@range = RobustExcelOle::Range.new(@sheet.ole_worksheet.UsedRange.Rows(1))
|
21
|
+
@range2 = @sheet.range([1..2,1..3])
|
21
22
|
end
|
22
23
|
|
23
24
|
after do
|
24
|
-
@book.close
|
25
|
+
@book.close(:if_unsaved => :forget)
|
25
26
|
Excel.kill_all
|
26
27
|
rm_tmp(@dir)
|
27
28
|
end
|
28
29
|
|
30
|
+
describe "#[]" do
|
31
|
+
|
32
|
+
it "should yield a cell" do
|
33
|
+
@range[0].should be_kind_of RobustExcelOle::Cell
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should yield the value of the first cell" do
|
37
|
+
@range2[0].Value.should == 'simple'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should cash the cells in the range" do
|
41
|
+
cell = @range2[0]
|
42
|
+
cell.v.should == 'simple'
|
43
|
+
@range2.Cells.Item(1).Value = 'foo'
|
44
|
+
cell.v.should == 'foo'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
29
48
|
describe "#each" do
|
49
|
+
|
30
50
|
it "items is RobustExcelOle::Cell" do
|
31
|
-
@
|
51
|
+
@range2.each do |cell|
|
32
52
|
cell.should be_kind_of RobustExcelOle::Cell
|
33
53
|
end
|
34
54
|
end
|
55
|
+
|
56
|
+
it "should work with [] doing cashing synchonized, from #[] to #each" do
|
57
|
+
i = 0
|
58
|
+
@range2.each do |cell|
|
59
|
+
cell.v.should == 'simple' if i == 0
|
60
|
+
cell.v.should == 'file' if i == 1
|
61
|
+
cell.v.should == 'sheet2' if i == 2
|
62
|
+
i += 1
|
63
|
+
end
|
64
|
+
@range2[0].Value = 'foo'
|
65
|
+
@range2[1].Value = 'bar'
|
66
|
+
@range2[2].Value = 'simple'
|
67
|
+
i = 0
|
68
|
+
@range2.each do |cell|
|
69
|
+
cell.v.should == 'foo' if i == 0
|
70
|
+
cell.v.should == 'bar' if i == 1
|
71
|
+
cell.v.should == 'simple' if i == 2
|
72
|
+
i += 1
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should work with [] doing cashing synchonized, from #each to #[]" do
|
77
|
+
@range2[0].Value.should == 'simple'
|
78
|
+
@range2[1].Value.should == 'file'
|
79
|
+
@range2[2].Value.should == 'sheet2'
|
80
|
+
i = 0
|
81
|
+
@range2.each do |cell|
|
82
|
+
cell.Value = 'foo' if i == 0
|
83
|
+
cell.Value = 'bar' if i == 1
|
84
|
+
cell.Value = 'simple' if i == 2
|
85
|
+
i += 1
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
35
89
|
end
|
36
90
|
|
37
91
|
describe "#values" do
|
@@ -335,7 +389,7 @@ describe RobustExcelOle::Range do
|
|
335
389
|
#end
|
336
390
|
|
337
391
|
context "unknown method" do
|
338
|
-
it { expect { @range.hogehogefoo}.to raise_error }
|
392
|
+
it { expect { @range.hogehogefoo}.to raise_error(NoMethodError) }
|
339
393
|
end
|
340
394
|
end
|
341
395
|
end
|
data/spec/workbook_spec.rb
CHANGED
@@ -625,16 +625,16 @@ describe Workbook do
|
|
625
625
|
old_cell_value = sheet[1,1].Value
|
626
626
|
sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
|
627
627
|
book.Saved.should be false
|
628
|
-
new_book = Workbook.open(@simple_file1, :read_only => false, :if_unsaved => :
|
628
|
+
new_book = Workbook.open(@simple_file1, :read_only => false, :if_unsaved => :forget)
|
629
629
|
new_book.ReadOnly.should be false
|
630
630
|
new_book.should be_alive
|
631
|
-
book.
|
632
|
-
new_book.should == book
|
631
|
+
book.should_not be_alive
|
633
632
|
new_sheet = new_book.sheet(1)
|
634
633
|
new_cell_value = new_sheet[1,1].Value
|
635
634
|
new_cell_value.should == old_cell_value
|
636
635
|
end
|
637
636
|
|
637
|
+
|
638
638
|
context "with block" do
|
639
639
|
it 'block parameter should be instance of Workbook' do
|
640
640
|
Workbook.open(@simple_file) do |book|
|
@@ -669,7 +669,7 @@ describe Workbook do
|
|
669
669
|
end
|
670
670
|
end
|
671
671
|
|
672
|
-
describe "
|
672
|
+
describe "type-lifting" do
|
673
673
|
|
674
674
|
context "with standard" do
|
675
675
|
|
@@ -681,7 +681,7 @@ describe Workbook do
|
|
681
681
|
@book.close
|
682
682
|
end
|
683
683
|
|
684
|
-
it "should
|
684
|
+
it "should type-lift a win32ole workbook object to a workbook object with an open workbook" do
|
685
685
|
workbook = @book.ole_workbook
|
686
686
|
book1 = Workbook.new(workbook)
|
687
687
|
book1.should be_a Workbook
|
@@ -927,31 +927,6 @@ describe Workbook do
|
|
927
927
|
after do
|
928
928
|
@book.close
|
929
929
|
end
|
930
|
-
|
931
|
-
it "should open unobtrusively the book in a new Excel such that the book is writable" do
|
932
|
-
book2 = Workbook.open(@simple_file1, :force => {:excel => :new}, :read_only => true)
|
933
|
-
@book.ReadOnly.should be true
|
934
|
-
book2.Readonly.should be true
|
935
|
-
sheet = @book.sheet(1)
|
936
|
-
cell_value = sheet[1,1].Value
|
937
|
-
Workbook.unobtrusively(@simple_file1, :rw_change_excel => :new, :if_closed => :current, :writable => true) do |book|
|
938
|
-
book.should be_a Workbook
|
939
|
-
book.excel.should_not == book2.excel
|
940
|
-
book.excel.should_not == @book.excel
|
941
|
-
sheet = book.sheet(1)
|
942
|
-
sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
|
943
|
-
book.should be_alive
|
944
|
-
book.Saved.should be false
|
945
|
-
end
|
946
|
-
@book.Saved.should be true
|
947
|
-
@book.ReadOnly.should be true
|
948
|
-
@book.close
|
949
|
-
book2.close
|
950
|
-
book3 = Workbook.open(@simple_file1)
|
951
|
-
new_sheet = book3.sheet(1)
|
952
|
-
new_sheet[1,1].Value.should_not == cell_value
|
953
|
-
book3.close
|
954
|
-
end
|
955
930
|
end
|
956
931
|
|
957
932
|
context "with a virgin Workbook class" do
|
@@ -1001,7 +976,7 @@ describe Workbook do
|
|
1001
976
|
|
1002
977
|
before do
|
1003
978
|
@book1 = Workbook.open(@simple_file1)
|
1004
|
-
@book2 = Workbook.open(@simple_file1, :
|
979
|
+
@book2 = Workbook.open(@simple_file1, :force_excel => :new)
|
1005
980
|
@book1.Readonly.should == false
|
1006
981
|
@book2.Readonly.should == true
|
1007
982
|
old_sheet = @book1.sheet(1)
|
@@ -1013,9 +988,9 @@ describe Workbook do
|
|
1013
988
|
end
|
1014
989
|
|
1015
990
|
it "should open unobtrusively the closed book in the most recent Excel where it was open before" do
|
1016
|
-
Workbook.unobtrusively(@
|
1017
|
-
book.excel.
|
1018
|
-
book.excel.
|
991
|
+
Workbook.unobtrusively(@simple_file1, :if_closed => :current) do |book|
|
992
|
+
book.excel.should == @book2.excel
|
993
|
+
book.excel.should_not == @book1.excel
|
1019
994
|
book.ReadOnly.should == false
|
1020
995
|
sheet = book.sheet(1)
|
1021
996
|
cell = sheet[1,1]
|
@@ -1027,52 +1002,9 @@ describe Workbook do
|
|
1027
1002
|
sheet[1,1].Value.should_not == @old_cell_value
|
1028
1003
|
end
|
1029
1004
|
|
1030
|
-
it "should open unobtrusively the closed book in the new hidden Excel" do
|
1031
|
-
Workbook.unobtrusively(@simple_file, :if_closed => :current) do |book|
|
1032
|
-
book.excel.should_not == @book2.excel
|
1033
|
-
book.excel.should == @book1.excel
|
1034
|
-
book.ReadOnly.should == false
|
1035
|
-
sheet = book.sheet(1)
|
1036
|
-
cell = sheet[1,1]
|
1037
|
-
sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
|
1038
|
-
book.Saved.should be false
|
1039
|
-
end
|
1040
|
-
new_book = Workbook.open(@simple_file1)
|
1041
|
-
sheet = new_book.sheet(1)
|
1042
|
-
sheet[1,1].Value.should_not == @old_cell_value
|
1043
|
-
end
|
1044
1005
|
end
|
1045
1006
|
end
|
1046
|
-
|
1047
|
-
=begin
|
1048
|
-
context "with :hidden" do
|
1049
|
-
|
1050
|
-
before do
|
1051
|
-
@book1 = Workbook.open(@simple_file1)
|
1052
|
-
@book1.close
|
1053
|
-
end
|
1054
1007
|
|
1055
|
-
it "should create a new hidden Excel instance and use this afterwards" do
|
1056
|
-
hidden_excel = nil
|
1057
|
-
Workbook.unobtrusively(@simple_file1, :hidden) do |book|
|
1058
|
-
book.should be_a Workbook
|
1059
|
-
book.should be_alive
|
1060
|
-
book.excel.Visible.should be false
|
1061
|
-
book.excel.DisplayAlerts.should be false
|
1062
|
-
hidden_excel = book.excel
|
1063
|
-
end
|
1064
|
-
Workbook.unobtrusively(@different_file, :hidden) do |book|
|
1065
|
-
book.should be_a Workbook
|
1066
|
-
book.should be_alive
|
1067
|
-
book.excel.Visible.should be false
|
1068
|
-
book.excel.DisplayAlerts.should be false
|
1069
|
-
book.excel.should == hidden_excel
|
1070
|
-
end
|
1071
|
-
end
|
1072
|
-
end
|
1073
|
-
end
|
1074
|
-
=end
|
1075
|
-
|
1076
1008
|
describe "for_reading, for_modifying" do
|
1077
1009
|
|
1078
1010
|
context "open unobtrusively for reading and modifying" do
|
@@ -1109,8 +1041,8 @@ describe Workbook do
|
|
1109
1041
|
sheet[1,1] = cell.Value == "foo" ? "bar" : "foo"
|
1110
1042
|
book.excel.should_not == @book.excel
|
1111
1043
|
book.excel.should_not == new_excel
|
1112
|
-
book.excel.visible.should be false
|
1113
|
-
book.excel.displayalerts.should == :if_visible
|
1044
|
+
book.excel.properties[:visible].should be false
|
1045
|
+
book.excel.properties[:displayalerts].should == :if_visible
|
1114
1046
|
end
|
1115
1047
|
new_book = Workbook.open(@simple_file1, :visible => true)
|
1116
1048
|
sheet = new_book.sheet(1)
|
@@ -59,25 +59,25 @@ describe Workbook do
|
|
59
59
|
@book.Windows(@book.Name).Visible.should be true
|
60
60
|
@book.visible.should be true
|
61
61
|
@book.ReadOnly.should be false
|
62
|
-
@book.CheckCompatibility.should be
|
62
|
+
@book.CheckCompatibility.should be true
|
63
63
|
@book.for_this_workbook(:visible => false)
|
64
64
|
@book.excel.Visible.should be true
|
65
65
|
@book.Windows(@book.Name).Visible.should be false
|
66
66
|
@book.visible.should be false
|
67
67
|
@book.ReadOnly.should be false
|
68
|
-
@book.CheckCompatibility.should be
|
68
|
+
@book.CheckCompatibility.should be true
|
69
69
|
@book.for_this_workbook(:read_only => true)
|
70
70
|
@book.excel.Visible.should be true
|
71
|
-
@book.Windows(@book.Name).Visible.should be
|
72
|
-
@book.visible.should be
|
71
|
+
@book.Windows(@book.Name).Visible.should be true
|
72
|
+
@book.visible.should be true
|
73
73
|
@book.ReadOnly.should be true
|
74
|
-
@book.CheckCompatibility.should be
|
74
|
+
@book.CheckCompatibility.should be true
|
75
75
|
@book.for_this_workbook(:visible => true)
|
76
76
|
@book.excel.Visible.should be true
|
77
77
|
@book.Windows(@book.Name).Visible.should be true
|
78
78
|
@book.visible.should be true
|
79
79
|
@book.ReadOnly.should be true
|
80
|
-
@book.CheckCompatibility.should be
|
80
|
+
@book.CheckCompatibility.should be true
|
81
81
|
@book.for_this_workbook(:check_compatibility => true)
|
82
82
|
@book.excel.Visible.should be true
|
83
83
|
@book.Windows(@book.Name).Visible.should be true
|
@@ -106,7 +106,7 @@ describe Workbook do
|
|
106
106
|
|
107
107
|
end
|
108
108
|
|
109
|
-
describe "
|
109
|
+
describe "to_reo.excel" do
|
110
110
|
|
111
111
|
before do
|
112
112
|
@book = Workbook.open(@simple_file)
|
@@ -118,19 +118,19 @@ describe Workbook do
|
|
118
118
|
|
119
119
|
it "should access the excel" do
|
120
120
|
workbook = @book.ole_workbook
|
121
|
-
excel =
|
121
|
+
excel = workbook.to_reo.excel
|
122
122
|
excel.should be_a Excel
|
123
123
|
excel.should == @book.excel
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should access the Excel of the ole_excel" do
|
127
|
-
excel =
|
127
|
+
excel = @book.excel.ole_excel.to_reo.excel
|
128
128
|
excel.should be_a Excel
|
129
129
|
excel.should == @book.excel
|
130
130
|
end
|
131
131
|
|
132
132
|
it "should access the Excel of a Workbook" do
|
133
|
-
excel =
|
133
|
+
excel = @book.to_reo.excel
|
134
134
|
excel.should be_a Excel
|
135
135
|
excel.should == @book.excel
|
136
136
|
end
|
@@ -251,7 +251,7 @@ describe Workbook do
|
|
251
251
|
excel2 = book1.excel
|
252
252
|
excel2.should == excel1
|
253
253
|
excel2.Visible.should be false
|
254
|
-
book2.Windows(book2.Name).Visible.should be
|
254
|
+
book2.Windows(book2.Name).Visible.should be true
|
255
255
|
end
|
256
256
|
|
257
257
|
it "should keep the found Excel instance visible" do
|
@@ -264,7 +264,7 @@ describe Workbook do
|
|
264
264
|
excel2 = book1.excel
|
265
265
|
excel2.should == excel1
|
266
266
|
excel2.Visible.should be true
|
267
|
-
book2.Windows(book2.Name).Visible.should be
|
267
|
+
book2.Windows(book2.Name).Visible.should be true
|
268
268
|
end
|
269
269
|
|
270
270
|
it "should keep the found Excel instance visible with default visible true" do
|
@@ -292,17 +292,17 @@ describe Workbook do
|
|
292
292
|
book2.Windows(book2.Name).Visible.should be true
|
293
293
|
end
|
294
294
|
|
295
|
-
it "should open the workbook visible if the workbook is new" do
|
295
|
+
it "should open the workbook not visible if the workbook is new" do
|
296
296
|
book1 = Workbook.open(@simple_file1, :default => {:visible => true})
|
297
|
-
book1.excel.Visible.should be
|
297
|
+
book1.excel.Visible.should be false
|
298
298
|
book1.Windows(book1.Name).Visible.should be true
|
299
|
-
book1.visible.should be
|
299
|
+
book1.visible.should be false
|
300
300
|
end
|
301
301
|
|
302
302
|
it "should open the workbook invisible if the workbook is new" do
|
303
303
|
book1 = Workbook.open(@simple_file1, :default => {:visible => false})
|
304
304
|
book1.excel.Visible.should be false
|
305
|
-
book1.Windows(book1.Name).Visible.should be
|
305
|
+
book1.Windows(book1.Name).Visible.should be true
|
306
306
|
book1.visible.should be false
|
307
307
|
end
|
308
308
|
|
@@ -324,13 +324,13 @@ describe Workbook do
|
|
324
324
|
book2 = Workbook.open(@simple_file1, :default => {:visible => true})
|
325
325
|
excel2 = book2.excel
|
326
326
|
book1.Windows(book1.Name).Visible.should be true
|
327
|
-
excel2.Visible.should be
|
328
|
-
book2.visible.should be
|
327
|
+
excel2.Visible.should be false
|
328
|
+
book2.visible.should be false
|
329
329
|
end
|
330
330
|
|
331
331
|
it "should open the workbook invisible if the old Excel is closed" do
|
332
332
|
book1 = Workbook.open(@simple_file1, :default => {:visible => true})
|
333
|
-
book1.visible.should be
|
333
|
+
book1.visible.should be false
|
334
334
|
excel1 = book1.excel
|
335
335
|
excel1.Visible.should be true
|
336
336
|
book1.Windows(book1.Name).Visible.should be true
|
@@ -344,7 +344,6 @@ describe Workbook do
|
|
344
344
|
end
|
345
345
|
|
346
346
|
end
|
347
|
-
|
348
347
|
=end
|
349
348
|
|
350
349
|
describe "force-visible" do
|
@@ -375,7 +374,7 @@ describe Workbook do
|
|
375
374
|
excel1.visible = true
|
376
375
|
book1 = Workbook.open(@simple_file)
|
377
376
|
excel1.Visible.should be true
|
378
|
-
excel1.visible.should be true
|
377
|
+
excel1.properties[:visible].should be true
|
379
378
|
book1.visible.should be true
|
380
379
|
end
|
381
380
|
|
@@ -587,30 +586,30 @@ describe Workbook do
|
|
587
586
|
it "should set visible and displayalerts if displayalerts => :if_visible" do
|
588
587
|
book1 = Workbook.open(@simple_file)
|
589
588
|
book1.excel.Visible.should be false
|
590
|
-
book1.excel.displayalerts.should == :if_visible
|
589
|
+
book1.excel.properties[:displayalerts].should == :if_visible
|
591
590
|
book1.Windows(book1.Name).Visible.should be true
|
592
591
|
book1.visible.should be false
|
593
592
|
book2 = Workbook.open(@different_file)
|
594
593
|
book2.excel.Visible.should be false
|
595
594
|
book2.Windows(book2.Name).Visible.should be true
|
596
595
|
book2.visible.should be false
|
597
|
-
book2.excel.visible.should be false
|
598
|
-
book2.excel.displayalerts.should == :if_visible
|
596
|
+
book2.excel.properties[:visible].should be false
|
597
|
+
book2.excel.properties[:displayalerts].should == :if_visible
|
599
598
|
book2.excel.DisplayAlerts.should be false
|
600
599
|
end
|
601
600
|
|
602
601
|
it "should set visible and displayalerts if displayalerts => :if_visible" do
|
603
602
|
book1 = Workbook.open(@simple_file)
|
604
603
|
book1.excel.Visible.should be false
|
605
|
-
book1.excel.displayalerts.should == :if_visible
|
604
|
+
book1.excel.properties[:displayalerts].should == :if_visible
|
606
605
|
book1.Windows(book1.Name).Visible.should be true
|
607
606
|
book1.visible.should be false
|
608
607
|
book2 = Workbook.open(@different_file, :visible => true)
|
609
608
|
book2.excel.Visible.should be true
|
610
609
|
book2.Windows(book2.Name).Visible.should be true
|
611
610
|
book2.visible.should be true
|
612
|
-
book2.excel.visible.should be true
|
613
|
-
book2.excel.displayalerts.should == :if_visible
|
611
|
+
book2.excel.properties[:visible].should be true
|
612
|
+
book2.excel.properties[:displayalerts].should == :if_visible
|
614
613
|
book2.excel.DisplayAlerts.should be true
|
615
614
|
end
|
616
615
|
end
|
@@ -663,8 +662,8 @@ describe Workbook do
|
|
663
662
|
it "should create and use a hidden Excel instance" do
|
664
663
|
book2 = Workbook.open(@simple_file1, :force_excel => @book.bookstore.hidden_excel)
|
665
664
|
book2.excel.should_not == @book.excel
|
666
|
-
book2.excel.visible.should be false
|
667
|
-
book2.excel.displayalerts.should == :if_visible
|
665
|
+
book2.excel.properties[:visible].should be false
|
666
|
+
book2.excel.properties[:displayalerts].should == :if_visible
|
668
667
|
book2.close
|
669
668
|
end
|
670
669
|
end
|
@@ -774,8 +773,7 @@ describe Workbook do
|
|
774
773
|
it "should color the cell" do
|
775
774
|
@book1.set_namevalue_glob("new", "bar")
|
776
775
|
@book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == -4142
|
777
|
-
@book1.
|
778
|
-
@book1.set_namevalue_glob("new", "bar")
|
776
|
+
@book1.set_namevalue_glob("new", "bar", :color => 4)
|
779
777
|
@book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
|
780
778
|
@book1["new"].should == "bar"
|
781
779
|
@book1["new"] = "bar"
|
@@ -784,15 +782,6 @@ describe Workbook do
|
|
784
782
|
@book1.close
|
785
783
|
end
|
786
784
|
|
787
|
-
it "should save without color (deprecated)" do
|
788
|
-
@book1.set_namevalue_glob("new", "bar", :color => 4)
|
789
|
-
@book1.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 4
|
790
|
-
@book1.save(:discoloring => true)
|
791
|
-
@book1.close
|
792
|
-
#book2 = Workbook.open(@simple_file1, :visible => true)
|
793
|
-
#book2.Names.Item("new").RefersToRange.Interior.ColorIndex.should == 0
|
794
|
-
end
|
795
|
-
|
796
785
|
end
|
797
786
|
|
798
787
|
describe "rename_range" do
|