write_xlsx 0.70.0 → 0.71.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.rdoc +7 -1
- data/lib/write_xlsx/chart.rb +133 -1713
- data/lib/write_xlsx/chart/axis.rb +6 -8
- data/lib/write_xlsx/chart/caption.rb +19 -0
- data/lib/write_xlsx/chart/scatter.rb +15 -15
- data/lib/write_xlsx/chart/series.rb +307 -0
- data/lib/write_xlsx/chart/stock.rb +5 -5
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +1 -1
- data/lib/write_xlsx/worksheet.rb +2 -2
- data/test/chart/test_add_series.rb +113 -115
- data/test/chart/test_write_d_lbls.rb +19 -18
- data/test/chart/test_write_number_format.rb +4 -4
- data/test/helper.rb +13 -0
- data/test/perl_output/comments2.xlsx +0 -0
- data/test/perl_output/demo.xlsx +0 -0
- data/test/regression/images/issue32.jpg +0 -0
- data/test/regression/images/issue32.png +0 -0
- data/test/regression/images/logo.png +0 -0
- data/test/regression/images/mylogo.png +0 -0
- data/test/regression/test_chart_area04.rb +44 -0
- data/test/regression/test_chart_bar24.rb +1 -2
- data/test/regression/test_chart_column04.rb +1 -1
- data/test/regression/test_chart_line02.rb +1 -1
- data/test/regression/test_chart_scatter07.rb +1 -1
- data/test/regression/test_chart_stock02.rb +1 -1
- data/test/regression/test_image10.rb +24 -0
- data/test/regression/test_image11.rb +24 -0
- data/test/regression/test_image12.rb +27 -0
- data/test/regression/test_image13.rb +27 -0
- data/test/regression/test_image14.rb +29 -0
- data/test/regression/test_image15.rb +29 -0
- data/test/regression/test_image16.rb +24 -0
- data/test/regression/test_image17.rb +27 -0
- data/test/regression/test_image18.rb +27 -0
- data/test/regression/xlsx_files/image10.xlsx +0 -0
- data/test/regression/xlsx_files/image11.xlsx +0 -0
- data/test/regression/xlsx_files/image12.xlsx +0 -0
- data/test/regression/xlsx_files/image13.xlsx +0 -0
- data/test/regression/xlsx_files/image14.xlsx +0 -0
- data/test/regression/xlsx_files/image15.xlsx +0 -0
- data/test/regression/xlsx_files/image16.xlsx +0 -0
- data/test/regression/xlsx_files/image17.xlsx +0 -0
- data/test/regression/xlsx_files/image18.xlsx +0 -0
- data/test/republic.png +0 -0
- data/test/test_example_match.rb +2 -4
- data/test/workbook/test_workbook_01.rb +1 -1
- data/test/workbook/test_workbook_02.rb +1 -1
- data/test/workbook/test_workbook_03.rb +1 -1
- data/write_xlsx.gemspec +1 -1
- metadata +53 -30
- data/html/en/doc_en.html +0 -7765
- data/html/index.html +0 -16
- data/html/style.css +0 -433
@@ -8,7 +8,7 @@ def setup
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_write_number_format
|
11
|
-
axis = Writexlsx::Chart::Axis.new
|
11
|
+
axis = Writexlsx::Chart::Axis.new(@chart)
|
12
12
|
axis.num_format = 'General'
|
13
13
|
axis.defaults = { :num_format => 'General' }
|
14
14
|
|
@@ -18,7 +18,7 @@ def test_write_number_format
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_write_number_format02
|
21
|
-
axis = Writexlsx::Chart::Axis.new
|
21
|
+
axis = Writexlsx::Chart::Axis.new(@chart)
|
22
22
|
axis.num_format = '#,##0.00'
|
23
23
|
axis.defaults = { :num_format => 'General' }
|
24
24
|
|
@@ -28,7 +28,7 @@ def test_write_number_format02
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_write_number_format03
|
31
|
-
axis = Writexlsx::Chart::Axis.new
|
31
|
+
axis = Writexlsx::Chart::Axis.new(@chart)
|
32
32
|
axis.num_format = 'General'
|
33
33
|
axis.defaults = { :num_format => 'General' }
|
34
34
|
|
@@ -38,7 +38,7 @@ def test_write_number_format03
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_write_number_format04
|
41
|
-
axis = Writexlsx::Chart::Axis.new
|
41
|
+
axis = Writexlsx::Chart::Axis.new(@chart)
|
42
42
|
axis.num_format = '#,##0.00'
|
43
43
|
axis.defaults = { :num_format => 'General' }
|
44
44
|
|
data/test/helper.rb
CHANGED
@@ -108,6 +108,19 @@ def compare_xlsx(exp_filename, got_filename, ignore_members = nil, ignore_elemen
|
|
108
108
|
got_xml_str = got_xml_str.gsub(/\d\d\d\d-\d\d-\d\dT\d\d\:\d\d:\d\dZ/,'')
|
109
109
|
end
|
110
110
|
|
111
|
+
# Remove workbookView dimensions which are almost always different.
|
112
|
+
if exp_members[i].name == 'xl/workbook.xml'
|
113
|
+
exp_xml_str.sub!(/<workbookView[^>]*>/, '<workbookView/>')
|
114
|
+
got_xml_str.sub!(/<workbookView[^>]*>/, '<workbookView/>')
|
115
|
+
end
|
116
|
+
|
117
|
+
# Remove the calcpr elements which may have different Excel version ids.
|
118
|
+
if exp_members[i].name == 'xl/workbook.xml'
|
119
|
+
exp_xml_str.sub!(/<calcPr[^>]*>/, '<calcPr/>')
|
120
|
+
got_xml_str.sub!(/<calcPr[^>]*>/, '<calcPr/>')
|
121
|
+
end
|
122
|
+
|
123
|
+
# Remove printer specific settings from Worksheet pageSetup elements.
|
111
124
|
if exp_members[i].name =~ %r!xl/worksheets/sheet\d.xml!
|
112
125
|
exp_xml_str = exp_xml_str.
|
113
126
|
sub(/horizontalDpi="200" /, '').
|
Binary file
|
data/test/perl_output/demo.xlsx
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartArea04 < 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_area04
|
14
|
+
@xlsx = 'chart_area04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'area', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [63591168, 63592704])
|
21
|
+
chart.instance_variable_set(:@axis2_ids, [74921856, 73764224])
|
22
|
+
|
23
|
+
data = [
|
24
|
+
[1, 2, 3, 4, 5],
|
25
|
+
[6, 8, 6, 4, 2]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5', :y2_axis => 1)
|
32
|
+
|
33
|
+
worksheet.insert_chart('E9', chart)
|
34
|
+
|
35
|
+
workbook.close
|
36
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
37
|
+
[],
|
38
|
+
{
|
39
|
+
'xl/charts/chart1.xml' => ['<c:pageMargins'],
|
40
|
+
'xl/workbook.xml' => [ '<fileVersion' ]
|
41
|
+
}
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
@@ -65,7 +65,7 @@ def test_chart_stock02
|
|
65
65
|
nil,
|
66
66
|
{
|
67
67
|
'xl/charts/chart1.xml' => [ '<c:formatCode', '<c:pageMargins' ],
|
68
|
-
'xl/workbook.xml' => [ '<fileVersion'
|
68
|
+
'xl/workbook.xml' => [ '<fileVersion' ],
|
69
69
|
'xl/worksheets/sheet1.xml' => [ '<sheetView', '<selection activeCell', '</sheetView' ],
|
70
70
|
}
|
71
71
|
)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage10 < 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_image10
|
14
|
+
@xlsx = 'image10.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image('C2',
|
19
|
+
'test/regression/images/logo.png')
|
20
|
+
|
21
|
+
workbook.close
|
22
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage11 < 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_image11
|
14
|
+
@xlsx = 'image11.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image('C2',
|
19
|
+
'test/regression/images/logo.png', 8, 5)
|
20
|
+
|
21
|
+
workbook.close
|
22
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage12 < 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_image12
|
14
|
+
@xlsx = 'image12.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 75)
|
19
|
+
worksheet.set_column('C:C', 32)
|
20
|
+
|
21
|
+
worksheet.insert_image('C2',
|
22
|
+
'test/regression/images/logo.png')
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage13 < 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_image13
|
14
|
+
@xlsx = 'image13.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 75)
|
19
|
+
worksheet.set_column('C:C', 32)
|
20
|
+
|
21
|
+
worksheet.insert_image('C2',
|
22
|
+
'test/regression/images/logo.png', 8, 5)
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage14 < 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_image14
|
14
|
+
@xlsx = 'image14.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 4.5)
|
19
|
+
worksheet.set_row(2, 35.25)
|
20
|
+
worksheet.set_column('C:E', 3.29)
|
21
|
+
worksheet.set_column('F:F', 10.71)
|
22
|
+
|
23
|
+
worksheet.insert_image('C2',
|
24
|
+
'test/regression/images/logo.png')
|
25
|
+
|
26
|
+
workbook.close
|
27
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage15 < 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_image15
|
14
|
+
@xlsx = 'image15.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 4.5)
|
19
|
+
worksheet.set_row(2, 35.25)
|
20
|
+
worksheet.set_column('C:E', 3.29)
|
21
|
+
worksheet.set_column('F:F', 10.71)
|
22
|
+
|
23
|
+
worksheet.insert_image('C2',
|
24
|
+
'test/regression/images/logo.png', 13, 2)
|
25
|
+
|
26
|
+
workbook.close
|
27
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage16 < 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_image16
|
14
|
+
@xlsx = 'image16.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image('C2',
|
19
|
+
'test/regression/images/issue32.png')
|
20
|
+
|
21
|
+
workbook.close
|
22
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage17 < 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_image17
|
14
|
+
@xlsx = 'image17.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 96)
|
19
|
+
worksheet.set_column('C:C', 18)
|
20
|
+
|
21
|
+
worksheet.insert_image('C2',
|
22
|
+
'test/regression/images/issue32.png')
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionImage18 < 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_image18
|
14
|
+
@xlsx = 'image18.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.set_row(1, 96)
|
19
|
+
worksheet.set_column('C:C', 18)
|
20
|
+
|
21
|
+
worksheet.insert_image('C2',
|
22
|
+
'test/regression/images/issue32.png', 5, 5)
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
|
+
end
|
27
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|