robust_excel_ole 0.5.1 → 0.6
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.
- data/Changelog +13 -0
- data/README.rdoc +70 -21
- data/README_detail.rdoc +60 -27
- data/examples/edit_sheets/example_access_sheets_and_cells.rb +2 -2
- data/examples/edit_sheets/example_adding_sheets.rb +2 -2
- data/examples/edit_sheets/example_concating.rb +2 -3
- data/examples/edit_sheets/example_copying.rb +2 -3
- data/examples/edit_sheets/example_expanding.rb +2 -3
- data/examples/edit_sheets/example_naming.rb +2 -3
- data/examples/edit_sheets/example_ranges.rb +2 -2
- data/examples/edit_sheets/example_saving.rb +2 -3
- data/examples/open_save_close/example_control_to_excel.rb +3 -3
- data/examples/open_save_close/example_default_excel.rb +4 -4
- data/examples/open_save_close/example_force_excel.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_forget.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_save.rb +2 -2
- data/examples/open_save_close/example_if_unsaved_accept.rb +2 -2
- data/examples/open_save_close/example_if_unsaved_forget.rb +2 -2
- data/examples/open_save_close/example_if_unsaved_forget_more.rb +4 -5
- data/examples/open_save_close/example_read_only.rb +2 -2
- data/examples/open_save_close/example_rename_cells.rb +3 -3
- data/examples/open_save_close/example_reuse.rb +2 -2
- data/examples/open_save_close/example_simple.rb +3 -4
- data/examples/open_save_close/example_unobtrusively.rb +2 -2
- data/lib/robust_excel_ole/book.rb +84 -78
- data/lib/robust_excel_ole/bookstore.rb +5 -1
- data/lib/robust_excel_ole/excel.rb +165 -188
- data/lib/robust_excel_ole/reo_common.rb +4 -0
- data/lib/robust_excel_ole/sheet.rb +15 -6
- data/lib/robust_excel_ole/version.rb +1 -1
- data/spec/book_spec.rb +104 -77
- data/spec/book_specs/book_close_spec.rb +9 -8
- data/spec/book_specs/book_misc_spec.rb +367 -26
- data/spec/book_specs/book_open_spec.rb +375 -94
- data/spec/book_specs/book_save_spec.rb +137 -112
- data/spec/book_specs/book_sheet_spec.rb +1 -1
- data/spec/book_specs/book_subclass_spec.rb +2 -1
- data/spec/book_specs/book_unobtr_spec.rb +87 -96
- data/spec/bookstore_spec.rb +8 -5
- data/spec/cell_spec.rb +1 -1
- data/spec/data/another_workbook.xls +0 -0
- data/spec/data/book_with_blank.xls +0 -0
- data/spec/data/workbook.xls +0 -0
- data/spec/excel_spec.rb +484 -72
- data/spec/range_spec.rb +1 -1
- data/spec/sheet_spec.rb +47 -1
- metadata +4 -5
data/spec/range_spec.rb
CHANGED
data/spec/sheet_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe Sheet do
|
|
13
13
|
excel = Excel.new(:reuse => true)
|
14
14
|
open_books = excel == nil ? 0 : excel.Workbooks.Count
|
15
15
|
puts "*** open books *** : #{open_books}" if open_books > 0
|
16
|
-
Excel.
|
16
|
+
Excel.kill_all
|
17
17
|
end
|
18
18
|
|
19
19
|
before do
|
@@ -37,6 +37,7 @@ describe Sheet do
|
|
37
37
|
before do
|
38
38
|
@key_sender = IO.popen 'ruby "' + File.join(File.dirname(__FILE__), '/helpers/key_sender.rb') + '" "Microsoft Office Excel" ' , "w"
|
39
39
|
@book_protect = Book.open(@protected_file, :visible => true, :read_only => true, :force_excel => :new)
|
40
|
+
@book_protect.excel.displayalerts = false
|
40
41
|
@key_sender.puts "{p}{r}{o}{t}{e}{c}{t}{enter}"
|
41
42
|
@protected_sheet = @book_protect.sheet('protect')
|
42
43
|
end
|
@@ -68,6 +69,22 @@ describe Sheet do
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
72
|
+
describe "workbook" do
|
73
|
+
before do
|
74
|
+
@book = Book.open(@simple_file)
|
75
|
+
@sheet = @book.sheet(1)
|
76
|
+
end
|
77
|
+
|
78
|
+
after do
|
79
|
+
@book.close
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should return workbook" do
|
83
|
+
@sheet.workbook.should === @book
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
71
88
|
describe "access sheet name" do
|
72
89
|
describe "#name" do
|
73
90
|
it 'get sheet1 name' do
|
@@ -409,6 +426,14 @@ describe Sheet do
|
|
409
426
|
@sheet1["firstrow"].should == [[1,2]]
|
410
427
|
end
|
411
428
|
|
429
|
+
it "should return value of a name with coordinates" do
|
430
|
+
@sheet1["A1"].should == "foo"
|
431
|
+
end
|
432
|
+
|
433
|
+
it "should return nil for a range with empty contents" do
|
434
|
+
@sheet1["another"].should == nil
|
435
|
+
end
|
436
|
+
|
412
437
|
it "should evaluate named formula" do
|
413
438
|
@sheet1["named_formula"].should == 4
|
414
439
|
end
|
@@ -470,6 +495,18 @@ describe Sheet do
|
|
470
495
|
}.to raise_error(SheetError, /name "named_formula" not in Sheet1/)
|
471
496
|
end
|
472
497
|
|
498
|
+
it "should raise an error of coordinates are given instead of a defined name" do
|
499
|
+
expect {
|
500
|
+
@sheet1.nameval("A1")
|
501
|
+
}.to raise_error(SheetError, /name "A1" not in Sheet1/)
|
502
|
+
end
|
503
|
+
|
504
|
+
it "should raise an error for a range with empty contents" do
|
505
|
+
expect{
|
506
|
+
@sheet1.nameval("another")
|
507
|
+
}.to raise_error(SheetError, /name "another" not in Sheet1/)
|
508
|
+
end
|
509
|
+
|
473
510
|
it "should set a range to a value" do
|
474
511
|
@sheet1.nameval("firstcell").should == "foo"
|
475
512
|
@sheet1[1,1].Value.should == "foo"
|
@@ -501,6 +538,14 @@ describe Sheet do
|
|
501
538
|
@sheet1.rangeval("firstcell").should == "foo"
|
502
539
|
end
|
503
540
|
|
541
|
+
it "should return value of a name with coordinates" do
|
542
|
+
@sheet1.rangeval("A1").should == "foo"
|
543
|
+
end
|
544
|
+
|
545
|
+
it "should return nil for a range with empty contents" do
|
546
|
+
@sheet1.rangeval("another").should == nil
|
547
|
+
end
|
548
|
+
|
504
549
|
it "should return value of a defined name" do
|
505
550
|
@sheet1.rangeval("new").should == "foo"
|
506
551
|
@sheet1.rangeval("one").should == 1.0
|
@@ -546,6 +591,7 @@ describe Sheet do
|
|
546
591
|
|
547
592
|
before do
|
548
593
|
@book1 = Book.open(@dir + '/another_workbook.xls', :read_only => true, :visible => true)
|
594
|
+
@book1.excel.displayalerts = false
|
549
595
|
@sheet1 = @book1.sheet(1)
|
550
596
|
end
|
551
597
|
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robust_excel_ole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.5.1
|
8
|
+
- 6
|
9
|
+
version: "0.6"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- traths
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2016-
|
17
|
+
date: 2016-08-03 00:00:00 +02:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|