robust_excel_ole 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Changelog +9 -1
- data/README.rdoc +122 -169
- data/README_detail.rdoc +10 -4
- data/README_development.rdoc +5 -0
- data/README_excel.rdoc +145 -0
- data/README_open.rdoc +202 -0
- data/README_ranges.rdoc +134 -0
- data/README_save_close.rdoc +77 -0
- data/README_sheet.rdoc +71 -0
- data/examples/open_save_close/example_control_to_excel.rb +2 -2
- data/lib/robust_excel_ole/book.rb +80 -44
- data/lib/robust_excel_ole/excel.rb +30 -7
- data/lib/robust_excel_ole/general.rb +1 -1
- data/lib/robust_excel_ole/reo_common.rb +65 -49
- data/lib/robust_excel_ole/sheet.rb +2 -6
- data/lib/robust_excel_ole/version.rb +1 -1
- data/spec/book_spec.rb +5 -5
- data/spec/book_specs/book_misc_spec.rb +69 -1
- data/spec/book_specs/book_open_spec.rb +11 -17
- data/spec/book_specs/book_unobtr_spec.rb +1 -1
- data/spec/data/another_workbook.xls +0 -0
- data/spec/data/workbook.xls +0 -0
- data/spec/excel_spec.rb +51 -53
- data/spec/general_spec.rb +2 -2
- data/spec/reo_common_spec.rb +1 -1
- data/spec/sheet_spec.rb +14 -0
- metadata +8 -2
@@ -251,7 +251,7 @@ describe Book do
|
|
251
251
|
expect{
|
252
252
|
Book.unobtrusively(@simple_file, :if_closed => :invalid_option) do |book|
|
253
253
|
end
|
254
|
-
}.to raise_error(
|
254
|
+
}.to raise_error(TypeREOError, "given object is neither an Excel, a Workbook, nor a Win32ole")
|
255
255
|
end
|
256
256
|
|
257
257
|
end
|
Binary file
|
data/spec/data/workbook.xls
CHANGED
Binary file
|
data/spec/excel_spec.rb
CHANGED
@@ -27,7 +27,7 @@ module RobustExcelOle
|
|
27
27
|
|
28
28
|
after do
|
29
29
|
Excel.kill_all
|
30
|
-
|
30
|
+
rm_tmp(@dir)
|
31
31
|
end
|
32
32
|
|
33
33
|
context "Illegal Refrence" do
|
@@ -714,7 +714,7 @@ module RobustExcelOle
|
|
714
714
|
@key_sender.puts "{left}{enter}"
|
715
715
|
expect{
|
716
716
|
@excel.close(:if_unsaved => :alert)
|
717
|
-
}.to raise_error(
|
717
|
+
}.to raise_error(ExcelREOError, "user canceled or runtime error")
|
718
718
|
end
|
719
719
|
end
|
720
720
|
end
|
@@ -984,54 +984,7 @@ module RobustExcelOle
|
|
984
984
|
|
985
985
|
end
|
986
986
|
|
987
|
-
|
988
|
-
|
989
|
-
it "should not raise an error for an empty Excel instance" do
|
990
|
-
excel = Excel.create
|
991
|
-
expect{
|
992
|
-
excel.workbooks_visible = true
|
993
|
-
}.to_not raise_error
|
994
|
-
end
|
995
|
-
|
996
|
-
it "should make visible a workbook" do
|
997
|
-
book1 = Book.open(@simple_file)
|
998
|
-
book1.excel.workbooks_visible = true
|
999
|
-
book1.excel.Visible.should be_true
|
1000
|
-
book1.Windows(book1.Name).Visible.should be_true
|
1001
|
-
book1.visible.should be_true
|
1002
|
-
end
|
1003
|
-
|
1004
|
-
it "should make visible and invisible two workbooks" do
|
1005
|
-
book1 = Book.open(@simple_file)
|
1006
|
-
book2 = Book.open(@different_file)
|
1007
|
-
excel = book1.excel
|
1008
|
-
excel.workbooks_visible = true
|
1009
|
-
excel.Visible.should be_true
|
1010
|
-
book1.Windows(book1.Name).Visible.should be_true
|
1011
|
-
book1.visible.should be_true
|
1012
|
-
book2.Windows(book2.Name).Visible.should be_true
|
1013
|
-
book2.visible.should be_true
|
1014
|
-
excel.workbooks_visible = false
|
1015
|
-
excel.Visible.should be_true
|
1016
|
-
book1.Windows(book1.Name).Visible.should be_false
|
1017
|
-
book1.visible.should be_false
|
1018
|
-
book2.Windows(book2.Name).Visible.should be_false
|
1019
|
-
book2.visible.should be_false
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
it "should make visible all workbooks" do
|
1023
|
-
book1 = Book.open(@simple_file, :visible => true)
|
1024
|
-
book2 = Book.open(@different_file)
|
1025
|
-
excel = book1.excel
|
1026
|
-
excel.workbooks_visible = true
|
1027
|
-
excel.Visible.should be_true
|
1028
|
-
book1.Windows(book1.Name).Visible.should be_true
|
1029
|
-
book1.visible.should be_true
|
1030
|
-
book2.Windows(book2.Name).Visible.should be_true
|
1031
|
-
book2.visible.should be_true
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
end
|
987
|
+
|
1035
988
|
|
1036
989
|
context "with Visible and DisplayAlerts, focus" do
|
1037
990
|
|
@@ -1538,14 +1491,14 @@ module RobustExcelOle
|
|
1538
1491
|
|
1539
1492
|
end
|
1540
1493
|
|
1541
|
-
describe "
|
1494
|
+
describe "for_this_instance" do
|
1542
1495
|
|
1543
1496
|
before do
|
1544
1497
|
@excel = Excel.new(:reuse => false)
|
1545
1498
|
end
|
1546
1499
|
|
1547
|
-
it "should set options" do
|
1548
|
-
@excel.
|
1500
|
+
it "should set options in the Excel instance" do
|
1501
|
+
@excel.for_this_instance(:displayalerts => true, :visible => true, :screenupdating => true, :calculaiton => :manual)
|
1549
1502
|
@excel.DisplayAlerts.should be_true
|
1550
1503
|
@excel.Visible.should be_true
|
1551
1504
|
@excel.ScreenUpdating.should be_true
|
@@ -1556,6 +1509,51 @@ module RobustExcelOle
|
|
1556
1509
|
|
1557
1510
|
end
|
1558
1511
|
|
1512
|
+
context "for_all_workbooks" do
|
1513
|
+
|
1514
|
+
it "should not raise an error for an empty Excel instance" do
|
1515
|
+
excel = Excel.create
|
1516
|
+
expect{
|
1517
|
+
excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
|
1518
|
+
}.to_not raise_error
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
it "should set options to true for a workbook" do
|
1522
|
+
book1 = Book.open(@simple_file)
|
1523
|
+
book1.excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
|
1524
|
+
book1.excel.Visible.should be_true
|
1525
|
+
book1.Windows(book1.Name).Visible.should be_true
|
1526
|
+
book1.visible.should be_true
|
1527
|
+
book1.ReadOnly.should be_true
|
1528
|
+
book1.CheckCompatibility.should be_true
|
1529
|
+
end
|
1530
|
+
|
1531
|
+
it "should set options for two workbooks" do
|
1532
|
+
book1 = Book.open(@simple_file)
|
1533
|
+
book2 = Book.open(@different_file)
|
1534
|
+
excel = book1.excel
|
1535
|
+
excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
|
1536
|
+
excel.Visible.should be_true
|
1537
|
+
book1.Windows(book1.Name).Visible.should be_true
|
1538
|
+
book1.visible.should be_true
|
1539
|
+
book1.ReadOnly.should be_true
|
1540
|
+
book1.CheckCompatibility.should be_true
|
1541
|
+
book2.Windows(book2.Name).Visible.should be_true
|
1542
|
+
book2.visible.should be_true
|
1543
|
+
book2.ReadOnly.should be_true
|
1544
|
+
book2.CheckCompatibility.should be_true
|
1545
|
+
excel.for_all_workbooks(:visible => false, :read_only => false, :check_compatibility => false)
|
1546
|
+
excel.Visible.should be_true
|
1547
|
+
book1.Windows(book1.Name).Visible.should be_false
|
1548
|
+
book1.visible.should be_false
|
1549
|
+
book2.Windows(book2.Name).Visible.should be_false
|
1550
|
+
book2.visible.should be_false
|
1551
|
+
book2.ReadOnly.should be_false
|
1552
|
+
book2.CheckCompatibility.should be_false
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
end
|
1556
|
+
|
1559
1557
|
describe "known_excel_instances" do
|
1560
1558
|
|
1561
1559
|
it "should return empty list" do
|
data/spec/general_spec.rb
CHANGED
@@ -171,7 +171,7 @@ module RobustExcelOle
|
|
171
171
|
it "should raise an error for no strings" do
|
172
172
|
expect{
|
173
173
|
canonize(1)
|
174
|
-
}.to raise_error(
|
174
|
+
}.to raise_error(TypeREOError, "No string given to canonize, but 1")
|
175
175
|
end
|
176
176
|
|
177
177
|
end
|
@@ -205,7 +205,7 @@ module RobustExcelOle
|
|
205
205
|
it "should raise an error when asking excel of a sheet" do
|
206
206
|
expect{
|
207
207
|
@sheet.excel
|
208
|
-
}.to raise_error(
|
208
|
+
}.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Book")
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
data/spec/reo_common_spec.rb
CHANGED
@@ -100,7 +100,7 @@ module RobustExcelOle
|
|
100
100
|
it "should raise an error when asking excel of a sheet" do
|
101
101
|
expect{
|
102
102
|
@sheet.excel
|
103
|
-
}.to raise_error(
|
103
|
+
}.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Book")
|
104
104
|
end
|
105
105
|
|
106
106
|
end
|
data/spec/sheet_spec.rb
CHANGED
@@ -583,6 +583,20 @@ describe Sheet do
|
|
583
583
|
}.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1/)
|
584
584
|
end
|
585
585
|
|
586
|
+
it "should raise an error if name not defined and default value is not provided" do
|
587
|
+
expect {
|
588
|
+
@sheet1.rangeval("foo", :default => nil)
|
589
|
+
}.to_not raise_error
|
590
|
+
expect {
|
591
|
+
@sheet1.rangeval("foo", :default => :__not_provided)
|
592
|
+
}.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1 another_workbook/)
|
593
|
+
expect {
|
594
|
+
@sheet1.rangeval("foo")
|
595
|
+
}.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1 another_workbook/)
|
596
|
+
@sheet1.rangeval("foo", :default => nil).should be_nil
|
597
|
+
@sheet1.rangeval("foo", :default => 1).should == 1
|
598
|
+
@sheet1.nameval("empty", :default => 1).should be_nil
|
599
|
+
end
|
586
600
|
end
|
587
601
|
|
588
602
|
describe "set_name" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robust_excel_ole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- traths
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -46,6 +46,12 @@ files:
|
|
46
46
|
- LICENSE
|
47
47
|
- README.rdoc
|
48
48
|
- README_detail.rdoc
|
49
|
+
- README_development.rdoc
|
50
|
+
- README_excel.rdoc
|
51
|
+
- README_open.rdoc
|
52
|
+
- README_ranges.rdoc
|
53
|
+
- README_save_close.rdoc
|
54
|
+
- README_sheet.rdoc
|
49
55
|
- Rakefile
|
50
56
|
- TodoList.md
|
51
57
|
- examples/edit_sheets/example_access_sheets_and_cells.rb
|