write_xlsx 0.62.0 → 0.64.0
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/README.rdoc +14 -1
- data/examples/chart_data_tools.rb +215 -0
- data/examples/chart_pie.rb +36 -5
- data/examples/sparklines2.rb +1 -1
- data/examples/tab_colors.rb +3 -3
- data/lib/write_xlsx/chart.rb +559 -516
- data/lib/write_xlsx/chart/area.rb +4 -1
- data/lib/write_xlsx/chart/axis.rb +132 -0
- data/lib/write_xlsx/chart/bar.rb +17 -9
- data/lib/write_xlsx/chart/column.rb +9 -1
- data/lib/write_xlsx/chart/line.rb +24 -0
- data/lib/write_xlsx/chart/radar.rb +2 -2
- data/lib/write_xlsx/chart/scatter.rb +19 -0
- data/lib/write_xlsx/chart/stock.rb +10 -3
- data/lib/write_xlsx/drawing.rb +43 -44
- data/lib/write_xlsx/package/vml.rb +21 -14
- data/lib/write_xlsx/shape.rb +173 -22
- data/lib/write_xlsx/sparkline.rb +524 -0
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +183 -115
- data/lib/write_xlsx/worksheet.rb +821 -1073
- data/lib/write_xlsx/worksheet/cell_data.rb +132 -0
- data/lib/write_xlsx/worksheet/print_style.rb +51 -0
- data/test/chart/test_add_series.rb +31 -6
- data/test/chart/test_write_d_lbls.rb +18 -18
- data/test/chart/test_write_number_format.rb +20 -24
- data/test/drawing/test_drawing_shape_01.rb +1 -1
- data/test/drawing/test_drawing_shape_02.rb +2 -2
- data/test/drawing/test_drawing_shape_03.rb +5 -5
- data/test/drawing/test_drawing_shape_04.rb +3 -3
- data/test/drawing/test_drawing_shape_05.rb +4 -4
- data/test/drawing/test_drawing_shape_07.rb +2 -2
- data/test/perl_output/chart_data_tools.xlsx +0 -0
- data/test/perl_output/chart_pie.xlsx +0 -0
- data/test/regression/disabled_test_vml04.rb +2 -2
- data/test/regression/test_chart_drop_lines01.rb +46 -0
- data/test/regression/test_chart_drop_lines02.rb +51 -0
- data/test/regression/test_chart_drop_lines03.rb +46 -0
- data/test/regression/test_chart_drop_lines04.rb +64 -0
- data/test/regression/test_chart_errorbars01.rb +47 -0
- data/test/regression/test_chart_errorbars02.rb +57 -0
- data/test/regression/test_chart_errorbars03.rb +53 -0
- data/test/regression/test_chart_errorbars04.rb +48 -0
- data/test/regression/test_chart_errorbars05.rb +47 -0
- data/test/regression/test_chart_errorbars06.rb +47 -0
- data/test/regression/test_chart_errorbars07.rb +66 -0
- data/test/regression/test_chart_font02.rb +1 -1
- data/test/regression/test_chart_font06.rb +1 -1
- data/test/regression/test_chart_gridlines04.rb +2 -1
- data/test/regression/test_chart_gridlines08.rb +2 -1
- data/test/regression/test_chart_points01.rb +37 -0
- data/test/regression/test_chart_points02.rb +40 -0
- data/test/regression/test_chart_points03.rb +42 -0
- data/test/regression/test_chart_points04.rb +52 -0
- data/test/regression/test_chart_points05.rb +49 -0
- data/test/regression/test_chart_points06.rb +49 -0
- data/test/regression/test_chartsheet05.rb +1 -1
- data/test/regression/test_chartsheet06.rb +1 -1
- data/test/regression/test_comment01.rb +1 -1
- data/test/regression/test_comment02.rb +1 -1
- data/test/regression/test_comment03.rb +1 -1
- data/test/regression/test_comment04.rb +2 -2
- data/test/regression/test_comment06.rb +1 -1
- data/test/regression/test_comment07.rb +1 -1
- data/test/regression/test_comment08.rb +1 -1
- data/test/regression/test_comment09.rb +1 -1
- data/test/regression/test_comment10.rb +1 -1
- data/test/regression/test_default_row04.rb +1 -1
- data/test/regression/test_escapes02.rb +1 -1
- data/test/regression/test_hyperlink15.rb +2 -2
- data/test/regression/test_shape_connect01.rb +6 -6
- data/test/regression/test_shape_connect02.rb +6 -6
- data/test/regression/test_shape_connect03.rb +11 -11
- data/test/regression/test_shape_connect04.rb +10 -10
- data/test/regression/test_shape_scale01.rb +2 -2
- data/test/regression/test_shape_stencil01.rb +3 -3
- data/test/regression/test_tab_color01.rb +1 -1
- data/test/regression/test_table04.rb +1 -1
- data/test/regression/test_table05.rb +1 -1
- data/test/regression/test_table06.rb +1 -1
- data/test/regression/test_vml01.rb +1 -1
- data/test/regression/test_vml02.rb +1 -1
- data/test/regression/test_vml03.rb +2 -2
- data/test/regression/xlsx_files/chart_drop_lines01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_stock02.xlsx +0 -0
- data/test/test_example_match.rb +278 -57
- data/test/worksheet/test_convert_date_time_02.rb +427 -433
- data/test/worksheet/test_convert_date_time_03.rb +1 -1
- data/test/worksheet/test_write_sheet_pr.rb +2 -2
- data/test/worksheet/test_write_sheet_view1.rb +2 -2
- metadata +80 -10
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'helper'
|
|
3
|
+
|
|
4
|
+
class TestRegressionChartPoints06 < Test::Unit::TestCase
|
|
5
|
+
def setup
|
|
6
|
+
setup_dir_var
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_chart_points06
|
|
14
|
+
@xlsx = 'chart_points06.xlsx'
|
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
|
16
|
+
worksheet = workbook.add_worksheet
|
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
|
18
|
+
|
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
|
20
|
+
chart.instance_variable_set("@axis_ids", [71050368, 71051904])
|
|
21
|
+
|
|
22
|
+
data = [
|
|
23
|
+
[1, 2, 3, 4, 5],
|
|
24
|
+
[2, 4, 6, 8, 10],
|
|
25
|
+
[3, 6, 9, 12, 15]
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
worksheet.write('A1', data)
|
|
29
|
+
|
|
30
|
+
chart.add_series(
|
|
31
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
|
32
|
+
:values => '=Sheet1!$B$1:$B$5',
|
|
33
|
+
:marker => { :type => 'automatic' },
|
|
34
|
+
:points => [
|
|
35
|
+
{ :fill => { :color => 'red' } }
|
|
36
|
+
]
|
|
37
|
+
)
|
|
38
|
+
chart.add_series(
|
|
39
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
|
40
|
+
:values => '=Sheet1!$C$1:$C$5',
|
|
41
|
+
:marker => { :type => 'automatic' }
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
worksheet.insert_chart('E9', chart)
|
|
45
|
+
|
|
46
|
+
workbook.close
|
|
47
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -19,7 +19,7 @@ def test_comment01
|
|
|
19
19
|
worksheet.write_comment('B2', 'Some text')
|
|
20
20
|
|
|
21
21
|
# Set the author to match the target XLSX file.
|
|
22
|
-
worksheet.
|
|
22
|
+
worksheet.comments_author = 'John'
|
|
23
23
|
|
|
24
24
|
workbook.close
|
|
25
25
|
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
|
@@ -20,7 +20,7 @@ def test_comment02
|
|
|
20
20
|
worksheet.write_comment('D17', 'More text')
|
|
21
21
|
|
|
22
22
|
# Set the author to match the target XLSX file.
|
|
23
|
-
worksheet.
|
|
23
|
+
worksheet.comments_author = 'John'
|
|
24
24
|
|
|
25
25
|
workbook.close
|
|
26
26
|
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
|
@@ -24,8 +24,8 @@ def test_comment04
|
|
|
24
24
|
worksheet3.write_comment('C7', 'More text')
|
|
25
25
|
|
|
26
26
|
# Set the author to match the target XLSX file.
|
|
27
|
-
worksheet1.
|
|
28
|
-
worksheet3.
|
|
27
|
+
worksheet1.comments_author = 'John'
|
|
28
|
+
worksheet3.comments_author = 'John'
|
|
29
29
|
|
|
30
30
|
workbook.close
|
|
31
31
|
compare_xlsx_for_regression(
|
|
@@ -19,7 +19,7 @@ def test_comment10
|
|
|
19
19
|
worksheet.write_comment('B2', 'Some text', :color => 51)
|
|
20
20
|
|
|
21
21
|
# Set the author to match the target XLSX file.
|
|
22
|
-
worksheet.
|
|
22
|
+
worksheet.comments_author = 'John'
|
|
23
23
|
|
|
24
24
|
workbook.close
|
|
25
25
|
compare_xlsx_for_regression(
|
|
@@ -23,7 +23,7 @@ def test_default_row04
|
|
|
23
23
|
worksheet.write_comment('C4', 'Hello', :y_offset => 22)
|
|
24
24
|
|
|
25
25
|
# Set the author to match the target XLSX file.
|
|
26
|
-
worksheet.
|
|
26
|
+
worksheet.comments_author = 'John'
|
|
27
27
|
|
|
28
28
|
workbook.close
|
|
29
29
|
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
|
@@ -19,7 +19,7 @@ def test_chart_escapes02
|
|
|
19
19
|
worksheet.write_comment('B2', %q{<>&"'})
|
|
20
20
|
|
|
21
21
|
# Set the author to match the target XLSX file.
|
|
22
|
-
worksheet.
|
|
22
|
+
worksheet.comments_author = %q{I am '"<>&}
|
|
23
23
|
|
|
24
24
|
workbook.close
|
|
25
25
|
compare_xlsx_for_regression(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
require 'helper'
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class TestRegressionHyperlink15 < Test::Unit::TestCase
|
|
5
5
|
def setup
|
|
6
6
|
setup_dir_var
|
|
7
7
|
end
|
|
@@ -10,7 +10,7 @@ def teardown
|
|
|
10
10
|
File.delete(@xlsx) if File.exist?(@xlsx)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def test_hyperlink15
|
|
14
14
|
@xlsx = 'hyperlink16.xlsx'
|
|
15
15
|
workbook = WriteXLSX.new(@xlsx)
|
|
16
16
|
worksheet = workbook.add_worksheet
|
|
@@ -29,14 +29,14 @@ def test_shape_connect01
|
|
|
29
29
|
cxn_shape = workbook.add_shape(:type => 'bentConnector3')
|
|
30
30
|
|
|
31
31
|
# Link the connector to the bottom of the circle
|
|
32
|
-
cxn_shape
|
|
33
|
-
cxn_shape
|
|
34
|
-
cxn_shape
|
|
32
|
+
cxn_shape.start = ellipse.id
|
|
33
|
+
cxn_shape.start_index = 4 # 4th connection point, clockwise from top(0)
|
|
34
|
+
cxn_shape.start_side = 'b' # r)ight or b)ottom
|
|
35
35
|
|
|
36
36
|
# Link the connector to the bottom of the plus sign
|
|
37
|
-
cxn_shape
|
|
38
|
-
cxn_shape
|
|
39
|
-
cxn_shape
|
|
37
|
+
cxn_shape.end = plus.id
|
|
38
|
+
cxn_shape.end_index = 0 # 0 - top connection point
|
|
39
|
+
cxn_shape.end_side = 't' # l)eft of t)op
|
|
40
40
|
|
|
41
41
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
42
42
|
|
|
@@ -25,14 +25,14 @@ def test_shape_connect02
|
|
|
25
25
|
cxn_shape = workbook.add_shape(:type => 'curvedConnector3')
|
|
26
26
|
|
|
27
27
|
# Link the start of the connector to the right side
|
|
28
|
-
cxn_shape
|
|
29
|
-
cxn_shape
|
|
30
|
-
cxn_shape
|
|
28
|
+
cxn_shape.start = s1.id
|
|
29
|
+
cxn_shape.start_index = 2 # 2nd connection point, clockwise from top(0)
|
|
30
|
+
cxn_shape.start_side = 'r' # r)ight or b)ottom
|
|
31
31
|
|
|
32
32
|
# Link the end of the connector to the left side
|
|
33
|
-
cxn_shape
|
|
34
|
-
cxn_shape
|
|
35
|
-
cxn_shape
|
|
33
|
+
cxn_shape.end = s2.id
|
|
34
|
+
cxn_shape.end_index = 4 # 4th connection point, clockwise from top(0)
|
|
35
|
+
cxn_shape.end_side = 'l' # l)eft or t)op
|
|
36
36
|
|
|
37
37
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
38
38
|
|
|
@@ -48,28 +48,28 @@ def test_shape_connect03
|
|
|
48
48
|
p2 = worksheet.insert_shape('A1', plus, 150, 350)
|
|
49
49
|
p3 = worksheet.insert_shape('A1', plus, 350, 150)
|
|
50
50
|
|
|
51
|
-
plus
|
|
51
|
+
plus.adjustments = 35 # change shape of plus symbol
|
|
52
52
|
p4 = worksheet.insert_shape('A1', plus, 150, 150)
|
|
53
53
|
|
|
54
54
|
cxn_shape = workbook.add_shape(:type => 'bentConnector3', :fill=> 0)
|
|
55
|
-
cxn_shape
|
|
56
|
-
cxn_shape
|
|
57
|
-
cxn_shape
|
|
55
|
+
cxn_shape.start = ellipse.id
|
|
56
|
+
cxn_shape.start_index = 4 # 4th connection point, clockwise from top(0)
|
|
57
|
+
cxn_shape.start_side = 'b' # r)ight or b)ottom
|
|
58
58
|
|
|
59
|
-
cxn_shape
|
|
60
|
-
cxn_shape
|
|
61
|
-
cxn_shape
|
|
59
|
+
cxn_shape.end = p1.id
|
|
60
|
+
cxn_shape.end_index = 0 # first connection (zero based) from top
|
|
61
|
+
cxn_shape.end_side = 't' # l)eft or t)op
|
|
62
62
|
|
|
63
63
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
64
64
|
|
|
65
|
-
cxn_shape
|
|
65
|
+
cxn_shape.end = p2.id
|
|
66
66
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
67
67
|
|
|
68
|
-
cxn_shape
|
|
68
|
+
cxn_shape.end = p3.id
|
|
69
69
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
70
70
|
|
|
71
|
-
cxn_shape
|
|
72
|
-
cxn_shape
|
|
71
|
+
cxn_shape.end = p4.id
|
|
72
|
+
cxn_shape.adjustments = [-50, 45, 120]
|
|
73
73
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
74
74
|
|
|
75
75
|
workbook.close
|
|
@@ -49,24 +49,24 @@ def test_shape_connect04
|
|
|
49
49
|
|
|
50
50
|
cxn_shape = workbook.add_shape(:type => 'bentConnector3', :fill => 0)
|
|
51
51
|
|
|
52
|
-
cxn_shape
|
|
53
|
-
cxn_shape
|
|
54
|
-
cxn_shape
|
|
52
|
+
cxn_shape.start = ellipse.id
|
|
53
|
+
cxn_shape.start_index = 2 # 2nd connection point, clockwise from top(0)
|
|
54
|
+
cxn_shape.start_side = 'r' # r)ight or b)ottom
|
|
55
55
|
|
|
56
|
-
cxn_shape
|
|
57
|
-
cxn_shape
|
|
58
|
-
cxn_shape
|
|
56
|
+
cxn_shape.end = p1.id
|
|
57
|
+
cxn_shape.end_index = 3 # 3rd connection point on plus, right side
|
|
58
|
+
cxn_shape.end_side = 'l' # l)eft or t)op
|
|
59
59
|
|
|
60
60
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
61
61
|
|
|
62
|
-
cxn_shape
|
|
62
|
+
cxn_shape.end = p2.id
|
|
63
63
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
64
64
|
|
|
65
|
-
cxn_shape
|
|
65
|
+
cxn_shape.end = p3.id
|
|
66
66
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
67
67
|
|
|
68
|
-
cxn_shape
|
|
69
|
-
cxn_shape
|
|
68
|
+
cxn_shape.end = p4.id
|
|
69
|
+
cxn_shape.adjustments = [-50, 45, 120]
|
|
70
70
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
|
71
71
|
|
|
72
72
|
workbook.close
|
|
@@ -26,8 +26,8 @@ def test_shape_scale01
|
|
|
26
26
|
)
|
|
27
27
|
worksheet.insert_shape('A1', normal, 50, 50)
|
|
28
28
|
|
|
29
|
-
normal
|
|
30
|
-
normal
|
|
29
|
+
normal.text = 'Scaled 3w x 2h'
|
|
30
|
+
normal.name = 'Hope'
|
|
31
31
|
worksheet.insert_shape('A1', normal, 250, 50, 3, 2)
|
|
32
32
|
|
|
33
33
|
workbook.close
|
|
@@ -27,9 +27,9 @@ def test_shape_stencil01
|
|
|
27
27
|
(1..10).each do |n|
|
|
28
28
|
# Change the last 5 rectangles to stars.
|
|
29
29
|
# Previously inserted shapes stay as rectangles
|
|
30
|
-
shape
|
|
31
|
-
text = shape
|
|
32
|
-
shape
|
|
30
|
+
shape.type = 'star5' if n == 6
|
|
31
|
+
text = shape.type
|
|
32
|
+
shape.text = [text, n.to_s].join(' ')
|
|
33
33
|
worksheet.insert_shape('A1', shape, n * 100, 50)
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -25,7 +25,7 @@ def test_table04
|
|
|
25
25
|
worksheet.write('A1', 'http://perl.com/')
|
|
26
26
|
|
|
27
27
|
# Add comments to check rId handling.
|
|
28
|
-
worksheet.
|
|
28
|
+
worksheet.comments_author = 'John'
|
|
29
29
|
worksheet.write_comment('H1', 'Test1')
|
|
30
30
|
worksheet.write_comment('J1', 'Test2')
|
|
31
31
|
workbook.close
|
|
@@ -25,7 +25,7 @@ def test_table05
|
|
|
25
25
|
worksheet.write('A1', 'http://perl.com/')
|
|
26
26
|
|
|
27
27
|
# Add comments to check rId handling.
|
|
28
|
-
worksheet.
|
|
28
|
+
worksheet.comments_author = 'John'
|
|
29
29
|
worksheet.write_comment('H1', 'Test1')
|
|
30
30
|
worksheet.write_comment('J1', 'Test2')
|
|
31
31
|
|
|
@@ -28,7 +28,7 @@ def test_table06
|
|
|
28
28
|
worksheet.write('C1', 'http://perl.com/')
|
|
29
29
|
|
|
30
30
|
# Add comments to check rId handling.
|
|
31
|
-
worksheet.
|
|
31
|
+
worksheet.comments_author = 'John'
|
|
32
32
|
worksheet.write_comment('H1', 'Test1')
|
|
33
33
|
worksheet.write_comment('J1', 'Test2')
|
|
34
34
|
|
|
@@ -20,7 +20,7 @@ def test_vml02
|
|
|
20
20
|
worksheet.write_comment('D17', 'More text')
|
|
21
21
|
|
|
22
22
|
# Set the author to match the target XLSX file.
|
|
23
|
-
worksheet.
|
|
23
|
+
worksheet.comments_author = 'John'
|
|
24
24
|
|
|
25
25
|
worksheet.insert_button('C4', {})
|
|
26
26
|
worksheet.insert_button('E8', {})
|
|
@@ -24,8 +24,8 @@ def test_vml03
|
|
|
24
24
|
worksheet3.write_comment('C7', 'More text')
|
|
25
25
|
|
|
26
26
|
# Set the author to match the target XLSX file.
|
|
27
|
-
worksheet1.
|
|
28
|
-
worksheet3.
|
|
27
|
+
worksheet1.comments_author = 'John'
|
|
28
|
+
worksheet3.comments_author = 'John'
|
|
29
29
|
|
|
30
30
|
worksheet1.insert_button('C4', {})
|
|
31
31
|
worksheet1.insert_button('E8', {})
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|