axlsx 1.0.18 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -3
- data/README.md +93 -18
- data/examples/example.csv +1000 -0
- data/examples/example.rb +97 -5
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/lib/axlsx.rb +30 -9
- data/lib/axlsx/content_type/content_type.rb +9 -9
- data/lib/axlsx/content_type/default.rb +9 -6
- data/lib/axlsx/content_type/override.rb +12 -8
- data/lib/axlsx/doc_props/app.rb +37 -40
- data/lib/axlsx/doc_props/core.rb +12 -17
- data/lib/axlsx/drawing/axis.rb +38 -19
- data/lib/axlsx/drawing/bar_3D_chart.rb +33 -32
- data/lib/axlsx/drawing/bar_series.rb +13 -14
- data/lib/axlsx/drawing/cat_axis.rb +15 -14
- data/lib/axlsx/drawing/cat_axis_data.rb +16 -18
- data/lib/axlsx/drawing/chart.rb +37 -38
- data/lib/axlsx/drawing/drawing.rb +15 -12
- data/lib/axlsx/drawing/graphic_frame.rb +21 -21
- data/lib/axlsx/drawing/hyperlink.rb +12 -11
- data/lib/axlsx/drawing/line_3D_chart.rb +30 -28
- data/lib/axlsx/drawing/line_series.rb +11 -11
- data/lib/axlsx/drawing/marker.rb +10 -8
- data/lib/axlsx/drawing/named_axis_data.rb +36 -0
- data/lib/axlsx/drawing/one_cell_anchor.rb +17 -16
- data/lib/axlsx/drawing/pic.rb +24 -37
- data/lib/axlsx/drawing/picture_locking.rb +21 -18
- data/lib/axlsx/drawing/pie_3D_chart.rb +10 -8
- data/lib/axlsx/drawing/pie_series.rb +15 -12
- data/lib/axlsx/drawing/scaling.rb +10 -10
- data/lib/axlsx/drawing/scatter_chart.rb +69 -0
- data/lib/axlsx/drawing/scatter_series.rb +39 -0
- data/lib/axlsx/drawing/ser_axis.rb +10 -10
- data/lib/axlsx/drawing/series.rb +15 -15
- data/lib/axlsx/drawing/series_title.rb +14 -14
- data/lib/axlsx/drawing/title.rb +26 -26
- data/lib/axlsx/drawing/two_cell_anchor.rb +18 -20
- data/lib/axlsx/drawing/val_axis.rb +8 -7
- data/lib/axlsx/drawing/val_axis_data.rb +17 -17
- data/lib/axlsx/drawing/view_3D.rb +22 -20
- data/lib/axlsx/package.rb +32 -15
- data/lib/axlsx/rels/relationship.rb +9 -6
- data/lib/axlsx/rels/relationships.rb +7 -1
- data/lib/axlsx/stylesheet/#num_fmt.rb# +69 -0
- data/lib/axlsx/stylesheet/border.rb +27 -23
- data/lib/axlsx/stylesheet/border_pr.rb +16 -15
- data/lib/axlsx/stylesheet/cell_alignment.rb +23 -21
- data/lib/axlsx/stylesheet/cell_protection.rb +10 -7
- data/lib/axlsx/stylesheet/cell_style.rb +8 -5
- data/lib/axlsx/stylesheet/color.rb +20 -14
- data/lib/axlsx/stylesheet/fill.rb +7 -5
- data/lib/axlsx/stylesheet/font.rb +14 -14
- data/lib/axlsx/stylesheet/gradient_fill.rb +19 -16
- data/lib/axlsx/stylesheet/gradient_stop.rb +9 -5
- data/lib/axlsx/stylesheet/num_fmt.rb +12 -6
- data/lib/axlsx/stylesheet/pattern_fill.rb +25 -10
- data/lib/axlsx/stylesheet/styles.rb +41 -32
- data/lib/axlsx/stylesheet/table_style.rb +9 -4
- data/lib/axlsx/stylesheet/table_style_element.rb +10 -7
- data/lib/axlsx/stylesheet/table_styles.rb +11 -8
- data/lib/axlsx/stylesheet/xf.rb +29 -25
- data/lib/axlsx/util/constants.rb +4 -0
- data/lib/axlsx/util/simple_typed_list.rb +18 -9
- data/lib/axlsx/util/validators.rb +13 -6
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +19 -21
- data/lib/axlsx/workbook/workbook.rb +43 -19
- data/lib/axlsx/workbook/worksheet/cell.rb +93 -91
- data/lib/axlsx/workbook/worksheet/col.rb +114 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/page_margins.rb +16 -13
- data/lib/axlsx/workbook/worksheet/row.rb +13 -13
- data/lib/axlsx/workbook/worksheet/table.rb +96 -0
- data/lib/axlsx/workbook/worksheet/table.rb~ +97 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +152 -118
- data/lib/schema/dc.xsd +5 -5
- data/lib/schema/dcmitype.xsd +5 -3
- data/lib/schema/dcterms.xsd +15 -15
- data/lib/schema/opc-coreProperties.xsd +6 -2
- data/lib/schema/xml.xsd +7 -8
- data/test/#benchmark.txt# +7 -0
- data/test/#tc_helper.rb# +3 -0
- data/test/benchmark.rb +81 -0
- data/test/benchmark.rb~ +0 -0
- data/test/benchmark.txt +6 -0
- data/test/benchmark.txt~ +6 -0
- data/test/content_type/tc_content_type.rb +30 -32
- data/test/content_type/tc_default.rb +8 -23
- data/test/content_type/tc_override.rb +7 -21
- data/test/doc_props/tc_app.rb +2 -8
- data/test/doc_props/tc_core.rb +6 -7
- data/test/drawing/tc_axis.rb +7 -3
- data/test/drawing/tc_bar_3D_chart.rb +6 -7
- data/test/drawing/tc_bar_series.rb +4 -5
- data/test/drawing/tc_cat_axis.rb +2 -3
- data/test/drawing/tc_cat_axis_data.rb +2 -3
- data/test/drawing/tc_chart.rb +11 -12
- data/test/drawing/tc_drawing.rb +7 -8
- data/test/drawing/tc_graphic_frame.rb +3 -4
- data/test/drawing/tc_hyperlink.rb +2 -3
- data/test/drawing/tc_line_3d_chart.rb +5 -6
- data/test/drawing/tc_line_series.rb +3 -4
- data/test/drawing/tc_marker.rb +3 -4
- data/test/drawing/tc_one_cell_anchor.rb +6 -7
- data/test/drawing/tc_pic.rb +8 -9
- data/test/drawing/tc_picture_locking.rb +2 -3
- data/test/drawing/tc_pie_3D_chart.rb +5 -6
- data/test/drawing/tc_pie_series.rb +4 -5
- data/test/drawing/tc_scaling.rb +3 -4
- data/test/drawing/tc_scatter_chart.rb +43 -0
- data/test/drawing/tc_scatter_series.rb +20 -0
- data/test/drawing/tc_ser_axis.rb +2 -3
- data/test/drawing/tc_series.rb +4 -5
- data/test/drawing/tc_series_title.rb +4 -5
- data/test/drawing/tc_title.rb +4 -5
- data/test/drawing/tc_two_cell_anchor.rb +4 -5
- data/test/drawing/tc_val_axis.rb +2 -3
- data/test/drawing/tc_val_axis_data.rb +2 -3
- data/test/drawing/tc_view_3D.rb +6 -7
- data/test/example.csv +1000 -0
- data/test/example.xlsx +0 -0
- data/test/example_streamed.xlsx +0 -0
- data/test/profile.rb +33 -0
- data/test/rels/tc_relationship.rb +5 -6
- data/test/rels/tc_relationships.rb +4 -5
- data/test/stylesheet/tc_border.rb +3 -4
- data/test/stylesheet/tc_border_pr.rb +3 -4
- data/test/stylesheet/tc_cell_alignment.rb +4 -5
- data/test/stylesheet/tc_cell_protection.rb +2 -3
- data/test/stylesheet/tc_cell_style.rb +2 -3
- data/test/stylesheet/tc_color.rb +2 -3
- data/test/stylesheet/tc_fill.rb +1 -2
- data/test/stylesheet/tc_font.rb +5 -6
- data/test/stylesheet/tc_gradient_fill.rb +1 -2
- data/test/stylesheet/tc_gradient_stop.rb +1 -2
- data/test/stylesheet/tc_num_fmt.rb +1 -2
- data/test/stylesheet/tc_pattern_fill.rb +3 -4
- data/test/stylesheet/tc_styles.rb +15 -9
- data/test/stylesheet/tc_table_style.rb +2 -3
- data/test/stylesheet/tc_table_style_element.rb +2 -3
- data/test/stylesheet/tc_table_styles.rb +3 -4
- data/test/stylesheet/tc_xf.rb +16 -17
- data/test/tc_axlsx.rb +39 -0
- data/test/tc_axlsx.rb~ +0 -0
- data/test/tc_helper.rb +3 -0
- data/test/tc_helper.rb~ +3 -0
- data/test/tc_package.rb +13 -10
- data/test/util/tc_simple_typed_list.rb +8 -9
- data/test/util/tc_validators.rb +7 -8
- data/test/workbook/tc_shared_strings_table.rb +5 -6
- data/test/workbook/tc_workbook.rb +24 -6
- data/test/workbook/worksheet/table/tc_table.rb +71 -0
- data/test/workbook/worksheet/table/tc_table.rb~ +72 -0
- data/test/workbook/worksheet/tc_cell.rb +24 -10
- data/test/workbook/worksheet/tc_col.rb +59 -0
- data/test/workbook/worksheet/tc_col.rb~ +10 -0
- data/test/workbook/worksheet/tc_date_time_converter.rb +1 -2
- data/test/workbook/worksheet/tc_page_margins.rb +6 -9
- data/test/workbook/worksheet/tc_row.rb +26 -12
- data/test/workbook/worksheet/tc_worksheet.rb +134 -68
- metadata +150 -90
- data/test/drawing/tc_hyperlink.rb~ +0 -71
- data/test/workbook/tc_shared_strings_table.rb~ +0 -8
- data/test/workbook/worksheet/tc_date_time_converter.rb~ +0 -69
data/test/example.xlsx
ADDED
Binary file
|
Binary file
|
data/test/profile.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby -s
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# Usage:
|
5
|
+
# > ruby test/profile.rb
|
6
|
+
# > pprof.rb --gif /tmp/axlsx_noautowidth > /tmp/axlsx_noautowidth.gif
|
7
|
+
# > open /tmp/axlsx_noautowidth.gif
|
8
|
+
|
9
|
+
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
10
|
+
require 'axlsx'
|
11
|
+
require 'csv'
|
12
|
+
|
13
|
+
# require 'benchmark'
|
14
|
+
require 'perftools'
|
15
|
+
row = []
|
16
|
+
input = (32..126).to_a.pack('U*').chars.to_a
|
17
|
+
20.times { row << input.shuffle.join}
|
18
|
+
times = 1000
|
19
|
+
|
20
|
+
PerfTools::CpuProfiler.start("/tmp/axlsx_noautowidth") do
|
21
|
+
p = Axlsx::Package.new
|
22
|
+
p.use_autowidth = false
|
23
|
+
wb = p.workbook
|
24
|
+
|
25
|
+
#A Simple Workbook
|
26
|
+
|
27
|
+
wb.add_worksheet do |sheet|
|
28
|
+
times.times do
|
29
|
+
sheet << row
|
30
|
+
end
|
31
|
+
end
|
32
|
+
p.serialize("example.xlsx")
|
33
|
+
end
|
@@ -1,12 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestRelationships < Test::Unit::TestCase
|
5
|
-
def setup
|
4
|
+
def setup
|
5
|
+
end
|
6
|
+
|
7
|
+
def teardown
|
6
8
|
end
|
7
|
-
|
8
|
-
def teardown
|
9
|
-
end
|
10
9
|
|
11
10
|
def test_type
|
12
11
|
assert_raise(ArgumentError) { Axlsx::Relationship.new 'type', 'target' }
|
@@ -1,12 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestRelationships < Test::Unit::TestCase
|
5
4
|
|
6
5
|
def test_valid_document
|
7
6
|
@rels = Axlsx::Relationships.new
|
8
7
|
schema = Nokogiri::XML::Schema(File.open(Axlsx::RELS_XSD))
|
9
|
-
doc = Nokogiri::XML(@rels.
|
8
|
+
doc = Nokogiri::XML(@rels.to_xml_string)
|
10
9
|
errors = []
|
11
10
|
schema.validate(doc).each do |error|
|
12
11
|
puts error.message
|
@@ -14,14 +13,14 @@ class TestRelationships < Test::Unit::TestCase
|
|
14
13
|
end
|
15
14
|
|
16
15
|
@rels << Axlsx::Relationship.new(Axlsx::WORKSHEET_R, "bar")
|
17
|
-
doc = Nokogiri::XML(@rels.
|
16
|
+
doc = Nokogiri::XML(@rels.to_xml_string)
|
18
17
|
errors = []
|
19
18
|
schema.validate(doc).each do |error|
|
20
19
|
puts error.message
|
21
20
|
errors << error
|
22
21
|
end
|
23
22
|
|
24
|
-
assert(errors.size == 0)
|
23
|
+
assert(errors.size == 0)
|
25
24
|
end
|
26
25
|
|
27
26
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestBorder < Test::Unit::TestCase
|
5
|
-
def setup
|
4
|
+
def setup
|
6
5
|
@b = Axlsx::Border.new
|
7
6
|
end
|
8
7
|
def teardown
|
@@ -10,7 +9,7 @@ class TestBorder < Test::Unit::TestCase
|
|
10
9
|
def test_initialiation
|
11
10
|
assert_equal(@b.diagonalUp, nil)
|
12
11
|
assert_equal(@b.diagonalDown, nil)
|
13
|
-
assert_equal(@b.outline, nil)
|
12
|
+
assert_equal(@b.outline, nil)
|
14
13
|
assert(@b.prs.is_a?(Axlsx::SimpleTypedList))
|
15
14
|
end
|
16
15
|
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestBorderPr < Test::Unit::TestCase
|
5
|
-
def setup
|
4
|
+
def setup
|
6
5
|
@bpr = Axlsx::BorderPr.new
|
7
6
|
end
|
8
7
|
def teardown
|
@@ -10,7 +9,7 @@ class TestBorderPr < Test::Unit::TestCase
|
|
10
9
|
def test_initialiation
|
11
10
|
assert_equal(@bpr.color, nil)
|
12
11
|
assert_equal(@bpr.style, nil)
|
13
|
-
assert_equal(@bpr.name, nil)
|
12
|
+
assert_equal(@bpr.name, nil)
|
14
13
|
end
|
15
14
|
|
16
15
|
def test_color
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestCellAlignment < Test::Unit::TestCase
|
5
|
-
def setup
|
4
|
+
def setup
|
6
5
|
@item = Axlsx::CellAlignment.new
|
7
6
|
end
|
8
7
|
|
@@ -16,8 +15,8 @@ class TestCellAlignment < Test::Unit::TestCase
|
|
16
15
|
assert_equal(@item.justifyLastLine, nil)
|
17
16
|
assert_equal(@item.shrinkToFit, nil)
|
18
17
|
assert_equal(@item.readingOrder, nil)
|
19
|
-
options = { :horizontal => :left, :vertical => :top, :textRotation => 3,
|
20
|
-
:wrapText => true, :indent => 2, :relativeIndent => 5,
|
18
|
+
options = { :horizontal => :left, :vertical => :top, :textRotation => 3,
|
19
|
+
:wrapText => true, :indent => 2, :relativeIndent => 5,
|
21
20
|
:justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 }
|
22
21
|
ca = Axlsx::CellAlignment.new options
|
23
22
|
options.each do |key, value|
|
data/test/stylesheet/tc_color.rb
CHANGED
data/test/stylesheet/tc_fill.rb
CHANGED
data/test/stylesheet/tc_font.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestFont < Test::Unit::TestCase
|
5
4
|
|
@@ -29,7 +28,7 @@ class TestFont < Test::Unit::TestCase
|
|
29
28
|
|
30
29
|
|
31
30
|
|
32
|
-
# def name=(v) Axlsx::validate_string v; @name = v end
|
31
|
+
# def name=(v) Axlsx::validate_string v; @name = v end
|
33
32
|
def test_name
|
34
33
|
assert_raise(ArgumentError) { @item.name = 7 }
|
35
34
|
assert_nothing_raised { @item.name = "bob" }
|
@@ -49,7 +48,7 @@ class TestFont < Test::Unit::TestCase
|
|
49
48
|
assert_equal(@item.family, 5)
|
50
49
|
end
|
51
50
|
|
52
|
-
# def b=(v) Axlsx::validate_boolean v; @b = v end
|
51
|
+
# def b=(v) Axlsx::validate_boolean v; @b = v end
|
53
52
|
def test_b
|
54
53
|
assert_raise(ArgumentError) { @item.b = -7 }
|
55
54
|
assert_nothing_raised { @item.b = true }
|
@@ -62,7 +61,7 @@ class TestFont < Test::Unit::TestCase
|
|
62
61
|
assert_nothing_raised { @item.i = true }
|
63
62
|
assert_equal(@item.i, true)
|
64
63
|
end
|
65
|
-
|
64
|
+
|
66
65
|
# def u=(v) Axlsx::validate_boolean v; @u = v end
|
67
66
|
def test_u
|
68
67
|
assert_raise(ArgumentError) { @item.u = -7 }
|
@@ -84,7 +83,7 @@ class TestFont < Test::Unit::TestCase
|
|
84
83
|
assert_equal(@item.outline, true)
|
85
84
|
end
|
86
85
|
|
87
|
-
# def shadow=(v) Axlsx::validate_boolean v; @shadow = v end
|
86
|
+
# def shadow=(v) Axlsx::validate_boolean v; @shadow = v end
|
88
87
|
def test_shadow
|
89
88
|
assert_raise(ArgumentError) { @item.shadow = -7 }
|
90
89
|
assert_nothing_raised { @item.shadow = true }
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestPatternFill < Test::Unit::TestCase
|
5
4
|
|
@@ -17,13 +16,13 @@ class TestPatternFill < Test::Unit::TestCase
|
|
17
16
|
assert_equal(@item.fgColor, nil)
|
18
17
|
end
|
19
18
|
|
20
|
-
def test_bgColor
|
19
|
+
def test_bgColor
|
21
20
|
assert_raise(ArgumentError) { @item.bgColor = -1.1 }
|
22
21
|
assert_nothing_raised { @item.bgColor = Axlsx::Color.new }
|
23
22
|
assert_equal(@item.bgColor.rgb, "FF000000")
|
24
23
|
end
|
25
24
|
|
26
|
-
def test_fgColor
|
25
|
+
def test_fgColor
|
27
26
|
assert_raise(ArgumentError) { @item.fgColor = -1.1 }
|
28
27
|
assert_nothing_raised { @item.fgColor = Axlsx::Color.new }
|
29
28
|
assert_equal(@item.fgColor.rgb, "FF000000")
|
@@ -1,16 +1,15 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestStyles < Test::Unit::TestCase
|
5
|
-
def setup
|
4
|
+
def setup
|
6
5
|
@styles = Axlsx::Styles.new
|
7
6
|
end
|
8
7
|
def teardown
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
def test_valid_document
|
12
11
|
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
|
13
|
-
doc = Nokogiri::XML(@styles.
|
12
|
+
doc = Nokogiri::XML(@styles.to_xml_string)
|
14
13
|
errors = []
|
15
14
|
schema.validate(doc).each do |error|
|
16
15
|
errors.push error
|
@@ -18,7 +17,14 @@ class TestStyles < Test::Unit::TestCase
|
|
18
17
|
end
|
19
18
|
assert(errors.size == 0)
|
20
19
|
end
|
20
|
+
def test_add_style_border_hash
|
21
|
+
border_count = @styles.borders.size
|
22
|
+
s = @styles.add_style :border => {:style=>:thin, :color => "FFFF0000"}
|
23
|
+
assert_equal(@styles.borders.size, border_count + 1)
|
24
|
+
assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000")
|
25
|
+
assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} }
|
21
26
|
|
27
|
+
end
|
22
28
|
|
23
29
|
def test_add_style
|
24
30
|
fill_count = @styles.fills.size
|
@@ -44,13 +50,13 @@ class TestStyles < Test::Unit::TestCase
|
|
44
50
|
assert_equal(xf.alignment.horizontal, :left, "horizontal alignment applied")
|
45
51
|
assert_equal(xf.protection.hidden, true, "hidden protection set")
|
46
52
|
assert_equal(xf.protection.locked, true, "cell locking set")
|
47
|
-
assert_raise(ArgumentError, "should reject invalid borderId") { @styles.add_style :border => 2 }
|
53
|
+
assert_raise(ArgumentError, "should reject invalid borderId") { @styles.add_style :border => 2 }
|
54
|
+
|
48
55
|
|
49
|
-
|
50
56
|
assert_equal(xf.applyProtection, 1, "protection applied")
|
51
57
|
assert_equal(xf.applyBorder, true, "border applied")
|
52
|
-
assert_equal(xf.applyNumberFormat, true, "
|
53
|
-
|
58
|
+
assert_equal(xf.applyNumberFormat, true, "number format applied")
|
59
|
+
assert_equal(xf.applyAlignment, true, "alignment applied")
|
54
60
|
end
|
55
61
|
|
56
62
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestTableStyle < Test::Unit::TestCase
|
5
4
|
|
@@ -16,7 +15,7 @@ class TestTableStyle < Test::Unit::TestCase
|
|
16
15
|
assert_equal(@item.table, nil)
|
17
16
|
end
|
18
17
|
|
19
|
-
def test_name
|
18
|
+
def test_name
|
20
19
|
assert_raise(ArgumentError) { @item.name = -1.1 }
|
21
20
|
assert_nothing_raised { @item.name = "lovely table style" }
|
22
21
|
assert_equal(@item.name, "lovely table style")
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestTableStyleElement < Test::Unit::TestCase
|
5
4
|
|
@@ -16,7 +15,7 @@ class TestTableStyleElement < Test::Unit::TestCase
|
|
16
15
|
assert_equal(@item.dxfId, nil)
|
17
16
|
end
|
18
17
|
|
19
|
-
def test_type
|
18
|
+
def test_type
|
20
19
|
assert_raise(ArgumentError) { @item.type = -1.1 }
|
21
20
|
assert_nothing_raised { @item.type = :blankRow }
|
22
21
|
assert_equal(@item.type, :blankRow)
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestTableStyles < Test::Unit::TestCase
|
5
4
|
|
@@ -15,13 +14,13 @@ class TestTableStyles < Test::Unit::TestCase
|
|
15
14
|
assert_equal(@item.defaultPivotStyle, "PivotStyleLight16")
|
16
15
|
end
|
17
16
|
|
18
|
-
def test_defaultTableStyle
|
17
|
+
def test_defaultTableStyle
|
19
18
|
assert_raise(ArgumentError) { @item.defaultTableStyle = -1.1 }
|
20
19
|
assert_nothing_raised { @item.defaultTableStyle = "anyones guess" }
|
21
20
|
assert_equal(@item.defaultTableStyle, "anyones guess")
|
22
21
|
end
|
23
22
|
|
24
|
-
def test_defaultPivotStyle
|
23
|
+
def test_defaultPivotStyle
|
25
24
|
assert_raise(ArgumentError) { @item.defaultPivotStyle = -1.1 }
|
26
25
|
assert_nothing_raised { @item.defaultPivotStyle = "anyones guess" }
|
27
26
|
assert_equal(@item.defaultPivotStyle, "anyones guess")
|
data/test/stylesheet/tc_xf.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'axlsx.rb'
|
1
|
+
require 'tc_helper.rb'
|
3
2
|
|
4
3
|
class TestXf < Test::Unit::TestCase
|
5
4
|
|
@@ -28,91 +27,91 @@ class TestXf < Test::Unit::TestCase
|
|
28
27
|
assert_equal(@item.applyProtection, nil)
|
29
28
|
end
|
30
29
|
|
31
|
-
def test_alignment
|
30
|
+
def test_alignment
|
32
31
|
assert_raise(ArgumentError) { @item.alignment = -1.1 }
|
33
32
|
assert_nothing_raised { @item.alignment = Axlsx::CellAlignment.new }
|
34
33
|
assert(@item.alignment.is_a?(Axlsx::CellAlignment))
|
35
34
|
end
|
36
35
|
|
37
|
-
def test_protection
|
36
|
+
def test_protection
|
38
37
|
assert_raise(ArgumentError) { @item.protection = -1.1 }
|
39
38
|
assert_nothing_raised { @item.protection = Axlsx::CellProtection.new }
|
40
39
|
assert(@item.protection.is_a?(Axlsx::CellProtection))
|
41
40
|
end
|
42
41
|
|
43
|
-
def test_numFmtId
|
42
|
+
def test_numFmtId
|
44
43
|
assert_raise(ArgumentError) { @item.numFmtId = -1.1 }
|
45
44
|
assert_nothing_raised { @item.numFmtId = 0 }
|
46
45
|
assert_equal(@item.numFmtId, 0)
|
47
46
|
end
|
48
47
|
|
49
|
-
def test_fillId
|
48
|
+
def test_fillId
|
50
49
|
assert_raise(ArgumentError) { @item.fillId = -1.1 }
|
51
50
|
assert_nothing_raised { @item.fillId = 0 }
|
52
51
|
assert_equal(@item.fillId, 0)
|
53
52
|
end
|
54
53
|
|
55
|
-
def test_fontId
|
54
|
+
def test_fontId
|
56
55
|
assert_raise(ArgumentError) { @item.fontId = -1.1 }
|
57
56
|
assert_nothing_raised { @item.fontId = 0 }
|
58
57
|
assert_equal(@item.fontId, 0)
|
59
58
|
end
|
60
59
|
|
61
|
-
def test_borderId
|
60
|
+
def test_borderId
|
62
61
|
assert_raise(ArgumentError) { @item.borderId = -1.1 }
|
63
62
|
assert_nothing_raised { @item.borderId = 0 }
|
64
63
|
assert_equal(@item.borderId, 0)
|
65
64
|
end
|
66
65
|
|
67
|
-
def test_xfId
|
66
|
+
def test_xfId
|
68
67
|
assert_raise(ArgumentError) { @item.xfId = -1.1 }
|
69
68
|
assert_nothing_raised { @item.xfId = 0 }
|
70
69
|
assert_equal(@item.xfId, 0)
|
71
70
|
end
|
72
71
|
|
73
|
-
def test_quotePrefix
|
72
|
+
def test_quotePrefix
|
74
73
|
assert_raise(ArgumentError) { @item.quotePrefix = -1.1 }
|
75
74
|
assert_nothing_raised { @item.quotePrefix = false }
|
76
75
|
assert_equal(@item.quotePrefix, false)
|
77
76
|
end
|
78
77
|
|
79
|
-
def test_pivotButton
|
78
|
+
def test_pivotButton
|
80
79
|
assert_raise(ArgumentError) { @item.pivotButton = -1.1 }
|
81
80
|
assert_nothing_raised { @item.pivotButton = false }
|
82
81
|
assert_equal(@item.pivotButton, false)
|
83
82
|
end
|
84
83
|
|
85
|
-
def test_applyNumberFormat
|
84
|
+
def test_applyNumberFormat
|
86
85
|
assert_raise(ArgumentError) { @item.applyNumberFormat = -1.1 }
|
87
86
|
assert_nothing_raised { @item.applyNumberFormat = false }
|
88
87
|
assert_equal(@item.applyNumberFormat, false)
|
89
88
|
end
|
90
89
|
|
91
|
-
def test_applyFont
|
90
|
+
def test_applyFont
|
92
91
|
assert_raise(ArgumentError) { @item.applyFont = -1.1 }
|
93
92
|
assert_nothing_raised { @item.applyFont = false }
|
94
93
|
assert_equal(@item.applyFont, false)
|
95
94
|
end
|
96
95
|
|
97
|
-
def test_applyFill
|
96
|
+
def test_applyFill
|
98
97
|
assert_raise(ArgumentError) { @item.applyFill = -1.1 }
|
99
98
|
assert_nothing_raised { @item.applyFill = false }
|
100
99
|
assert_equal(@item.applyFill, false)
|
101
100
|
end
|
102
101
|
|
103
|
-
def test_applyBorder
|
102
|
+
def test_applyBorder
|
104
103
|
assert_raise(ArgumentError) { @item.applyBorder = -1.1 }
|
105
104
|
assert_nothing_raised { @item.applyBorder = false }
|
106
105
|
assert_equal(@item.applyBorder, false)
|
107
106
|
end
|
108
107
|
|
109
|
-
def test_applyAlignment
|
108
|
+
def test_applyAlignment
|
110
109
|
assert_raise(ArgumentError) { @item.applyAlignment = -1.1 }
|
111
110
|
assert_nothing_raised { @item.applyAlignment = false }
|
112
111
|
assert_equal(@item.applyAlignment, false)
|
113
112
|
end
|
114
113
|
|
115
|
-
def test_applyProtection
|
114
|
+
def test_applyProtection
|
116
115
|
assert_raise(ArgumentError) { @item.applyProtection = -1.1 }
|
117
116
|
assert_nothing_raised { @item.applyProtection = false }
|
118
117
|
assert_equal(@item.applyProtection, false)
|