axlsx 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -5
- data/examples/colored_links.rb +59 -0
- data/examples/example.rb +421 -266
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/finance.rb +82 -0
- data/examples/finance.xlsx +0 -0
- data/examples/financial.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/where_is_my_color.xlsx +0 -0
- data/lib/axlsx.rb +11 -4
- data/lib/axlsx/content_type/abstract_content_type.rb +32 -0
- data/lib/axlsx/content_type/content_type.rb +1 -1
- data/lib/axlsx/content_type/default.rb +6 -37
- data/lib/axlsx/content_type/override.rb +6 -38
- data/lib/axlsx/doc_props/app.rb +7 -4
- data/lib/axlsx/drawing/axis.rb +3 -3
- data/lib/axlsx/drawing/chart.rb +2 -3
- data/lib/axlsx/drawing/d_lbls.rb +21 -31
- data/lib/axlsx/drawing/drawing.rb +6 -0
- data/lib/axlsx/drawing/hyperlink.rb +40 -32
- data/lib/axlsx/drawing/marker.rb +13 -13
- data/lib/axlsx/drawing/num_data.rb +6 -6
- data/lib/axlsx/drawing/num_data_source.rb +17 -16
- data/lib/axlsx/drawing/one_cell_anchor.rb +20 -22
- data/lib/axlsx/drawing/pic.rb +25 -27
- data/lib/axlsx/drawing/picture_locking.rb +12 -44
- data/lib/axlsx/drawing/scaling.rb +13 -13
- data/lib/axlsx/drawing/scatter_chart.rb +3 -3
- data/lib/axlsx/drawing/series.rb +3 -6
- data/lib/axlsx/drawing/str_data.rb +3 -3
- data/lib/axlsx/drawing/str_val.rb +7 -8
- data/lib/axlsx/drawing/view_3D.rb +51 -37
- data/lib/axlsx/drawing/vml_shape.rb +23 -23
- data/lib/axlsx/package.rb +14 -16
- data/lib/axlsx/stylesheet/border.rb +29 -20
- data/lib/axlsx/stylesheet/border_pr.rb +5 -4
- data/lib/axlsx/stylesheet/cell_alignment.rb +55 -29
- data/lib/axlsx/stylesheet/cell_protection.rb +7 -4
- data/lib/axlsx/stylesheet/cell_style.rb +19 -14
- data/lib/axlsx/stylesheet/color.rb +19 -16
- data/lib/axlsx/stylesheet/dxf.rb +4 -4
- data/lib/axlsx/stylesheet/font.rb +22 -22
- data/lib/axlsx/stylesheet/gradient_fill.rb +45 -21
- data/lib/axlsx/stylesheet/num_fmt.rb +22 -13
- data/lib/axlsx/stylesheet/pattern_fill.rb +12 -21
- data/lib/axlsx/stylesheet/styles.rb +1 -1
- data/lib/axlsx/stylesheet/table_style.rb +17 -16
- data/lib/axlsx/stylesheet/table_style_element.rb +15 -11
- data/lib/axlsx/stylesheet/table_styles.rb +14 -11
- data/lib/axlsx/stylesheet/xf.rb +28 -26
- data/lib/axlsx/util/accessors.rb +49 -0
- data/lib/axlsx/util/options_parser.rb +15 -0
- data/lib/axlsx/util/serialized_attributes.rb +46 -0
- data/lib/axlsx/util/simple_typed_list.rb +16 -4
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/defined_name.rb +13 -58
- data/lib/axlsx/workbook/workbook.rb +27 -1
- data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +11 -19
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +20 -27
- data/lib/axlsx/workbook/worksheet/cell.rb +38 -39
- data/lib/axlsx/workbook/worksheet/cfvo.rb +15 -15
- data/lib/axlsx/workbook/worksheet/cfvos.rb +18 -0
- data/lib/axlsx/workbook/worksheet/col.rb +34 -27
- data/lib/axlsx/workbook/worksheet/color_scale.rb +7 -13
- data/lib/axlsx/workbook/worksheet/comment.rb +14 -11
- data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +11 -11
- data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +27 -25
- data/lib/axlsx/workbook/worksheet/data_bar.rb +44 -34
- data/lib/axlsx/workbook/worksheet/data_validation.rb +61 -62
- data/lib/axlsx/workbook/worksheet/dimension.rb +0 -1
- data/lib/axlsx/workbook/worksheet/icon_set.rb +20 -20
- data/lib/axlsx/workbook/worksheet/page_margins.rb +21 -19
- data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +6 -9
- data/lib/axlsx/workbook/worksheet/page_setup.rb +20 -19
- data/lib/axlsx/workbook/worksheet/pane.rb +48 -51
- data/lib/axlsx/workbook/worksheet/print_options.rb +8 -30
- data/lib/axlsx/workbook/worksheet/protected_range.rb +16 -13
- data/lib/axlsx/workbook/worksheet/selection.rb +30 -38
- data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +6 -26
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +19 -57
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +51 -155
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +68 -234
- data/lib/axlsx/workbook/worksheet/table.rb +16 -18
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +10 -27
- data/lib/axlsx/workbook/worksheet/worksheet.rb +6 -7
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +11 -33
- data/test/content_type/tc_default.rb +0 -11
- data/test/content_type/tc_override.rb +0 -13
- data/test/drawing/tc_d_lbls.rb +14 -4
- data/test/tc_axlsx.rb +20 -2
- data/test/workbook/tc_defined_name.rb +2 -2
- data/test/workbook/tc_workbook.rb +15 -0
- data/test/workbook/worksheet/tc_col.rb +11 -1
- data/test/workbook/worksheet/tc_pane.rb +5 -45
- data/test/workbook/worksheet/tc_selection.rb +9 -48
- metadata +13 -3
@@ -7,61 +7,21 @@ class TestPane < Test::Unit::TestCase
|
|
7
7
|
#inverse defaults for booleans
|
8
8
|
@nil_options = { :active_pane => :bottom_left, :state => :frozen, :top_left_cell => 'A2' }
|
9
9
|
@int_0_options = { :x_split => 2, :y_split => 2 }
|
10
|
-
|
11
|
-
@string_options = { :top_left_cell => 'A2' }
|
12
|
-
@integer_options = { :x_split => 2, :y_split => 2 }
|
13
|
-
@symbol_options = { :active_pane => :bottom_left, :state => :frozen }
|
14
|
-
|
15
|
-
@options = @nil_options.merge(@int_0_options)
|
16
|
-
|
10
|
+
@options = @nil_options.merge(@int_0_options)
|
17
11
|
@pane = Axlsx::Pane.new(@options)
|
18
12
|
end
|
19
|
-
|
20
|
-
|
21
|
-
pane = Axlsx::Pane.new
|
22
|
-
|
23
|
-
@nil_options.each do |key, value|
|
24
|
-
assert_equal(nil, pane.send(key.to_sym), "initialized default #{key} should be nil")
|
25
|
-
assert_equal(value, @pane.send(key.to_sym), "initialized options #{key} should be #{value}")
|
26
|
-
end
|
27
|
-
|
28
|
-
@int_0_options.each do |key, value|
|
29
|
-
assert_equal(0, pane.send(key.to_sym), "initialized default #{key} should be 0")
|
30
|
-
assert_equal(value, @pane.send(key.to_sym), "initialized options #{key} should be #{value}")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_string_attribute_validation
|
35
|
-
@string_options.each do |key, value|
|
36
|
-
assert_raise(ArgumentError, "#{key} must be string") { @pane.send("#{key}=".to_sym, :symbol) }
|
37
|
-
assert_nothing_raised { @pane.send("#{key}=".to_sym, "foo") }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_symbol_attribute_validation
|
42
|
-
@symbol_options.each do |key, value|
|
43
|
-
assert_raise(ArgumentError, "#{key} must be symbol") { @pane.send("#{key}=".to_sym, "foo") }
|
44
|
-
assert_nothing_raised { @pane.send("#{key}=".to_sym, value) }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_integer_attribute_validation
|
49
|
-
@integer_options.each do |key, value|
|
50
|
-
assert_raise(ArgumentError, "#{key} must be integer") { @pane.send("#{key}=".to_sym, "foo") }
|
51
|
-
assert_nothing_raised { @pane.send("#{key}=".to_sym, value) }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
13
|
+
|
14
|
+
|
55
15
|
def test_active_pane
|
56
16
|
assert_raise(ArgumentError) { @pane.active_pane = "10" }
|
57
17
|
assert_nothing_raised { @pane.active_pane = :top_left }
|
58
|
-
assert_equal(@pane.active_pane,
|
18
|
+
assert_equal(@pane.active_pane, "topLeft")
|
59
19
|
end
|
60
20
|
|
61
21
|
def test_state
|
62
22
|
assert_raise(ArgumentError) { @pane.state = "foo" }
|
63
23
|
assert_nothing_raised { @pane.state = :frozen_split }
|
64
|
-
assert_equal(@pane.state,
|
24
|
+
assert_equal(@pane.state, "frozenSplit")
|
65
25
|
end
|
66
26
|
|
67
27
|
def test_x_split
|
@@ -3,70 +3,34 @@ require 'tc_helper.rb'
|
|
3
3
|
|
4
4
|
class TestSelection < Test::Unit::TestCase
|
5
5
|
def setup
|
6
|
-
@
|
7
|
-
@options = @nil_options
|
8
|
-
|
9
|
-
@string_options = { :active_cell => 'A2', :sqref => 'A2' }
|
10
|
-
@integer_options = { :active_cell_id => 1 }
|
11
|
-
@symbol_options = { :pane => :top_left }
|
12
|
-
|
6
|
+
@options = { :active_cell => 'A2', :active_cell_id => 1, :pane => :top_left, :sqref => 'A2' }
|
13
7
|
@selection = Axlsx::Selection.new(@options)
|
14
8
|
end
|
15
|
-
|
16
|
-
def test_initialize
|
17
|
-
selection = Axlsx::Selection.new
|
18
|
-
|
19
|
-
@nil_options.each do |key, value|
|
20
|
-
assert_equal(nil, selection.send(key.to_sym), "initialized default #{key} should be nil")
|
21
|
-
assert_equal(value, @selection.send(key.to_sym), "initialized options #{key} should be #{value}")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_string_attribute_validation
|
26
|
-
@string_options.each do |key, value|
|
27
|
-
assert_raise(ArgumentError, "#{key} must be string") { @selection.send("#{key}=".to_sym, :symbol) }
|
28
|
-
assert_nothing_raised { @selection.send("#{key}=".to_sym, "foo") }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_symbol_attribute_validation
|
33
|
-
@symbol_options.each do |key, value|
|
34
|
-
assert_raise(ArgumentError, "#{key} must be symbol") { @selection.send("#{key}=".to_sym, "foo") }
|
35
|
-
assert_nothing_raised { @selection.send("#{key}=".to_sym, value) }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_integer_attribute_validation
|
40
|
-
@integer_options.each do |key, value|
|
41
|
-
assert_raise(ArgumentError, "#{key} must be integer") { @selection.send("#{key}=".to_sym, "foo") }
|
42
|
-
assert_nothing_raised { @selection.send("#{key}=".to_sym, value) }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
9
|
+
|
46
10
|
def test_active_cell
|
47
11
|
assert_raise(ArgumentError) { @selection.active_cell = :active_cell }
|
48
12
|
assert_nothing_raised { @selection.active_cell = "F5" }
|
49
13
|
assert_equal(@selection.active_cell, "F5")
|
50
14
|
end
|
51
|
-
|
15
|
+
|
52
16
|
def test_active_cell_id
|
53
17
|
assert_raise(ArgumentError) { @selection.active_cell_id = "foo" }
|
54
18
|
assert_nothing_raised { @selection.active_cell_id = 11 }
|
55
19
|
assert_equal(@selection.active_cell_id, 11)
|
56
20
|
end
|
57
|
-
|
21
|
+
|
58
22
|
def test_pane
|
59
23
|
assert_raise(ArgumentError) { @selection.pane = "foo´" }
|
60
24
|
assert_nothing_raised { @selection.pane = :bottom_right }
|
61
|
-
assert_equal(@selection.pane,
|
25
|
+
assert_equal(@selection.pane, "bottomRight")
|
62
26
|
end
|
63
|
-
|
27
|
+
|
64
28
|
def test_sqref
|
65
29
|
assert_raise(ArgumentError) { @selection.sqref = :sqref }
|
66
30
|
assert_nothing_raised { @selection.sqref = "G32" }
|
67
31
|
assert_equal(@selection.sqref, "G32")
|
68
32
|
end
|
69
|
-
|
33
|
+
|
70
34
|
def test_to_xml
|
71
35
|
p = Axlsx::Package.new
|
72
36
|
@ws = p.workbook.add_worksheet :name => "sheetview"
|
@@ -76,18 +40,15 @@ class TestSelection < Test::Unit::TestCase
|
|
76
40
|
vs.add_selection(:bottom_left, { :active_cell => 'E55', :sqref => 'E55' })
|
77
41
|
vs.add_selection(:bottom_right, { :active_cell => 'I57', :sqref => 'I57' })
|
78
42
|
end
|
79
|
-
|
43
|
+
|
80
44
|
doc = Nokogiri::XML.parse(@ws.to_xml_string)
|
81
|
-
|
45
|
+
|
82
46
|
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='B2'][@pane='topLeft'][@activeCell='B2']").size)
|
83
47
|
assert doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='B2'][@pane='topLeft'][@activeCell='B2']")
|
84
|
-
|
85
48
|
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='I10'][@pane='topRight'][@activeCell='I10']").size)
|
86
49
|
assert doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='I10'][@pane='topRight'][@activeCell='I10']")
|
87
|
-
|
88
50
|
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='E55'][@pane='bottomLeft'][@activeCell='E55']").size)
|
89
51
|
assert doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='E55'][@pane='bottomLeft'][@activeCell='E55']")
|
90
|
-
|
91
52
|
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='I57'][@pane='bottomRight'][@activeCell='I57']").size)
|
92
53
|
assert doc.xpath("//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView/xmlns:selection[@sqref='I57'][@pane='bottomRight'][@activeCell='I57']")
|
93
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -120,6 +120,7 @@ executables: []
|
|
120
120
|
extensions: []
|
121
121
|
extra_rdoc_files: []
|
122
122
|
files:
|
123
|
+
- lib/axlsx/content_type/abstract_content_type.rb
|
123
124
|
- lib/axlsx/content_type/content_type.rb
|
124
125
|
- lib/axlsx/content_type/default.rb
|
125
126
|
- lib/axlsx/content_type/override.rb
|
@@ -181,8 +182,11 @@ files:
|
|
181
182
|
- lib/axlsx/stylesheet/table_style_element.rb
|
182
183
|
- lib/axlsx/stylesheet/table_styles.rb
|
183
184
|
- lib/axlsx/stylesheet/xf.rb
|
185
|
+
- lib/axlsx/util/accessors.rb
|
184
186
|
- lib/axlsx/util/constants.rb
|
187
|
+
- lib/axlsx/util/options_parser.rb
|
185
188
|
- lib/axlsx/util/parser.rb
|
189
|
+
- lib/axlsx/util/serialized_attributes.rb
|
186
190
|
- lib/axlsx/util/simple_typed_list.rb
|
187
191
|
- lib/axlsx/util/storage.rb
|
188
192
|
- lib/axlsx/util/validators.rb
|
@@ -196,6 +200,7 @@ files:
|
|
196
200
|
- lib/axlsx/workbook/worksheet/auto_filter/filters.rb
|
197
201
|
- lib/axlsx/workbook/worksheet/cell.rb
|
198
202
|
- lib/axlsx/workbook/worksheet/cfvo.rb
|
203
|
+
- lib/axlsx/workbook/worksheet/cfvos.rb
|
199
204
|
- lib/axlsx/workbook/worksheet/col.rb
|
200
205
|
- lib/axlsx/workbook/worksheet/color_scale.rb
|
201
206
|
- lib/axlsx/workbook/worksheet/cols.rb
|
@@ -273,6 +278,7 @@ files:
|
|
273
278
|
- examples/auto_filter.xlsx
|
274
279
|
- examples/basic_charts.rb
|
275
280
|
- examples/chart_colors.rb
|
281
|
+
- examples/colored_links.rb
|
276
282
|
- examples/conditional_formatting/example_conditional_formatting.rb
|
277
283
|
- examples/conditional_formatting/getting_barred.rb
|
278
284
|
- examples/conditional_formatting/hitting_the_high_notes.rb
|
@@ -285,6 +291,9 @@ files:
|
|
285
291
|
- examples/extractive.pdf
|
286
292
|
- examples/extractive.rb
|
287
293
|
- examples/extractive.xlsx
|
294
|
+
- examples/finance.rb
|
295
|
+
- examples/finance.xlsx
|
296
|
+
- examples/financial.xlsx
|
288
297
|
- examples/hyperlinks.rb
|
289
298
|
- examples/hyperlinks.xlsx
|
290
299
|
- examples/image1.gif
|
@@ -324,6 +333,7 @@ files:
|
|
324
333
|
- examples/styles.rb
|
325
334
|
- examples/styles.xlsx
|
326
335
|
- examples/two_cell_anchor_image.rb
|
336
|
+
- examples/where_is_my_color.xlsx
|
327
337
|
- LICENSE
|
328
338
|
- README.md
|
329
339
|
- Rakefile
|
@@ -450,7 +460,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
450
460
|
version: '0'
|
451
461
|
segments:
|
452
462
|
- 0
|
453
|
-
hash:
|
463
|
+
hash: -3709977559995033
|
454
464
|
requirements: []
|
455
465
|
rubyforge_project:
|
456
466
|
rubygems_version: 1.8.24
|