write_xlsx 0.81.1 → 0.83.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/Changes +20 -0
- data/README.md +3 -2
- data/examples/chart_combined.rb +107 -0
- data/examples/chart_data_table.rb +1 -1
- data/examples/chart_pareto.rb +82 -0
- data/lib/write_xlsx/chart.rb +115 -42
- data/lib/write_xlsx/chart/axis.rb +5 -1
- data/lib/write_xlsx/chart/bar.rb +13 -0
- data/lib/write_xlsx/chart/pie.rb +7 -0
- data/lib/write_xlsx/chart/scatter.rb +25 -57
- data/lib/write_xlsx/format.rb +40 -0
- data/lib/write_xlsx/package/app.rb +39 -1
- data/lib/write_xlsx/package/comments.rb +1 -5
- data/lib/write_xlsx/package/content_types.rb +48 -13
- data/lib/write_xlsx/package/core.rb +14 -12
- data/lib/write_xlsx/package/packager.rb +17 -41
- data/lib/write_xlsx/package/styles.rb +215 -256
- data/lib/write_xlsx/package/table.rb +5 -7
- data/lib/write_xlsx/package/xml_writer_simple.rb +2 -0
- data/lib/write_xlsx/sheets.rb +2 -2
- data/lib/write_xlsx/utility.rb +17 -2
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +44 -2
- data/lib/write_xlsx/worksheet.rb +26 -17
- data/lib/write_xlsx/worksheet/page_setup.rb +12 -6
- data/test/chart/test_write_style.rb +2 -2
- data/test/helper.rb +3 -0
- data/test/package/app/test_app01.rb +1 -1
- data/test/package/app/test_app02.rb +1 -1
- data/test/package/app/test_app03.rb +1 -1
- data/test/package/content_types/test_content_types.rb +1 -1
- data/test/package/content_types/test_write_default.rb +1 -1
- data/test/package/content_types/test_write_override.rb +1 -1
- data/test/perl_output/chart_combined.xlsx +0 -0
- data/test/perl_output/chart_pareto.xlsx +0 -0
- data/test/regression/test_button07.rb +5 -2
- data/test/regression/test_button13.rb +34 -0
- data/test/regression/test_button14.rb +31 -0
- data/test/regression/test_chart_column11.rb +45 -0
- data/test/regression/test_chart_column12.rb +45 -0
- data/test/regression/test_chart_combined01.rb +37 -0
- data/test/regression/test_chart_combined02.rb +43 -0
- data/test/regression/test_chart_combined03.rb +45 -0
- data/test/regression/test_chart_combined04.rb +47 -0
- data/test/regression/test_chart_combined05.rb +49 -0
- data/test/regression/test_chart_combined06.rb +49 -0
- data/test/regression/test_chart_combined07.rb +53 -0
- data/test/regression/test_chart_combined08.rb +65 -0
- data/test/regression/test_chart_data_labels24.rb +50 -0
- data/test/regression/test_chart_date05.rb +57 -0
- data/test/regression/test_chart_format20.rb +55 -0
- data/test/regression/test_format11.rb +28 -0
- data/test/regression/test_format12.rb +41 -0
- data/test/regression/test_landscape01.rb +27 -0
- data/test/regression/test_quote_name04.rb +40 -0
- data/test/regression/test_set_start_page01.rb +4 -7
- data/test/regression/test_set_start_page02.rb +33 -0
- data/test/regression/test_set_start_page03.rb +33 -0
- data/test/regression/test_table17.rb +70 -0
- data/test/regression/xlsx_files/chart_column11.xlsx +0 -0
- data/test/regression/xlsx_files/chart_column12.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined08.xlsx +0 -0
- data/test/regression/xlsx_files/chart_date05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format20.xlsx +0 -0
- data/test/regression/xlsx_files/format11.xlsx +0 -0
- data/test/regression/xlsx_files/format12.xlsx +0 -0
- data/test/regression/xlsx_files/landscape01.xlsx +0 -0
- data/test/regression/xlsx_files/quote_name04.xlsx +0 -0
- data/test/regression/xlsx_files/set_start_page01.xlsx +0 -0
- data/test/regression/xlsx_files/set_start_page02.xlsx +0 -0
- data/test/regression/xlsx_files/set_start_page03.xlsx +0 -0
- data/test/regression/xlsx_files/table17.xlsx +0 -0
- data/test/test_example_match.rb +172 -0
- data/write_xlsx.gemspec +1 -0
- metadata +106 -3
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels24 < 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_data_labels24
|
14
|
+
@xlsx = 'chart_data_labels24.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, [45937792, 45939712])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:font => { :name => 'Consolas', :size => 12, :baseline => -1, :pitch_family => 49, :charset => 0 }
|
35
|
+
}
|
36
|
+
)
|
37
|
+
|
38
|
+
chart.add_series(
|
39
|
+
:values => '=Sheet1!$B$1:$B$5',
|
40
|
+
:data_labels => { :value => 1, :position => 'inside_base' }
|
41
|
+
)
|
42
|
+
|
43
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
44
|
+
|
45
|
+
worksheet.insert_chart('E9', chart)
|
46
|
+
|
47
|
+
workbook.close
|
48
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDate05 < 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_date05
|
14
|
+
@xlsx = 'chart_date05.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
date_format = workbook.add_format(:num_format => 14)
|
19
|
+
|
20
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
21
|
+
chart.instance_variable_set(:@axis_ids, [45937408, 45939328])
|
22
|
+
|
23
|
+
worksheet.set_column('A:A', 12)
|
24
|
+
|
25
|
+
dates = [
|
26
|
+
'2013-01-01T', '2013-01-02T', '2013-01-03T', '2013-01-04T',
|
27
|
+
'2013-01-05T', '2013-01-06T', '2013-01-07T', '2013-01-08T',
|
28
|
+
'2013-01-09T', '2013-01-10T'
|
29
|
+
]
|
30
|
+
|
31
|
+
data = [10, 30, 20, 40, 20, 60, 50, 40, 30, 30]
|
32
|
+
|
33
|
+
dates.each_with_index do |date_time, row|
|
34
|
+
worksheet.write_date_time(row, 0, date_time, date_format)
|
35
|
+
worksheet.write(row, 1, data[row])
|
36
|
+
end
|
37
|
+
|
38
|
+
chart.add_series(
|
39
|
+
:categories => '=Sheet1!$A$1:$A$10',
|
40
|
+
:values => '=Sheet1!$B$1:$B$10'
|
41
|
+
)
|
42
|
+
|
43
|
+
chart.set_x_axis(
|
44
|
+
:num_format => 'dd/mm/yyyy',
|
45
|
+
:num_format_linked => 1,
|
46
|
+
:text_axis => 1
|
47
|
+
)
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
53
|
+
nil,
|
54
|
+
{'xl/charts/chart1.xml' => ['<c:formatCode']}
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFormat20 < 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_format20
|
14
|
+
@xlsx = 'chart_format20.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart1 = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
chart2 = workbook.add_chart(:type => 'line', :embedded => 1)
|
19
|
+
|
20
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
21
|
+
chart1.instance_variable_set(:@axis_ids, [80553856, 80555392])
|
22
|
+
chart2.instance_variable_set(:@axis_ids, [84583936, 84585856])
|
23
|
+
|
24
|
+
trend = {
|
25
|
+
:type => 'linear',
|
26
|
+
:line => {:color => 'red', :dash_type => 'dash'}
|
27
|
+
}
|
28
|
+
|
29
|
+
data = [
|
30
|
+
[ 1, 2, 3, 4, 5 ],
|
31
|
+
[ 2, 4, 6, 8, 10 ],
|
32
|
+
[ 3, 6, 9, 12, 15 ]
|
33
|
+
]
|
34
|
+
|
35
|
+
worksheet.write('A1', data)
|
36
|
+
|
37
|
+
chart1.add_series(
|
38
|
+
:values => '=Sheet1!$B$1:$B$5',
|
39
|
+
:trendline => trend
|
40
|
+
)
|
41
|
+
chart1.add_series(:values => '=Sheet1!$C$1:$C$5')
|
42
|
+
chart2.add_series(
|
43
|
+
:values => '=Sheet1!$B$1:$B$5',
|
44
|
+
:trendline => trend
|
45
|
+
)
|
46
|
+
chart2.add_series(:values => '=Sheet1!$C$1:$C$5')
|
47
|
+
|
48
|
+
worksheet.insert_chart('E9', chart1)
|
49
|
+
worksheet.insert_chart('E25', chart2)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_xlsx_for_regression(
|
53
|
+
File.join(@regression_output, @xlsx), @xlsx)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionFormat11 < 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_format11
|
14
|
+
@xlsx = 'format11.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
centered = workbook.add_format(
|
19
|
+
:align => 'center',
|
20
|
+
:valign => 'vcenter'
|
21
|
+
)
|
22
|
+
|
23
|
+
worksheet.write('B2', "Foo", centered)
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionFormat12 < 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_format12
|
14
|
+
@xlsx = 'format12.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
top_left_bottom = workbook.add_format(
|
19
|
+
:left => 1,
|
20
|
+
:top => 1,
|
21
|
+
:bottom => 1
|
22
|
+
)
|
23
|
+
|
24
|
+
top_bottom = workbook.add_format(
|
25
|
+
:top => 1,
|
26
|
+
:bottom => 1
|
27
|
+
)
|
28
|
+
|
29
|
+
top_left = workbook.add_format(
|
30
|
+
:left => 1,
|
31
|
+
:top => 1
|
32
|
+
)
|
33
|
+
|
34
|
+
worksheet.write('B2', 'test', top_left_bottom)
|
35
|
+
worksheet.write('D2', 'test', top_left)
|
36
|
+
worksheet.write('F2', 'test', top_bottom)
|
37
|
+
|
38
|
+
workbook.close
|
39
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionLandscape01 < 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_landscape01
|
14
|
+
@xlsx = 'landscape01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.write(0, 0, 'Foo')
|
19
|
+
worksheet.set_landscape
|
20
|
+
worksheet.paper = 9
|
21
|
+
|
22
|
+
worksheet.vertical_dpi = 200
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionQuoteName04 < 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_quote_name04
|
14
|
+
@xlsx = 'quote_name04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
|
17
|
+
data = [
|
18
|
+
[1, 2, 3, 4, 5],
|
19
|
+
[2, 4, 6, 8, 10],
|
20
|
+
[3, 6, 9, 12, 15]
|
21
|
+
]
|
22
|
+
|
23
|
+
# Test quoted/non-quoted sheet names.
|
24
|
+
worksheet = workbook.add_worksheet('Sheet 1')
|
25
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
26
|
+
|
27
|
+
worksheet.write( 'A1', data )
|
28
|
+
chart.add_series(
|
29
|
+
:values => ['Sheet 1', 0, 4, 0, 0],
|
30
|
+
:name => ['Sheet 1', 0, 0]
|
31
|
+
)
|
32
|
+
|
33
|
+
chart.set_title(:name => 'Foo')
|
34
|
+
|
35
|
+
worksheet.insert_chart('E9', chart)
|
36
|
+
|
37
|
+
workbook.close
|
38
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
39
|
+
end
|
40
|
+
end
|
@@ -15,21 +15,18 @@ def test_set_start_page01
|
|
15
15
|
workbook = WriteXLSX.new(@xlsx)
|
16
16
|
worksheet = workbook.add_worksheet
|
17
17
|
|
18
|
-
|
18
|
+
worksheet.start_page = 1
|
19
19
|
worksheet.paper = 9
|
20
20
|
|
21
|
+
worksheet.vertical_dpi = 200
|
22
|
+
|
21
23
|
worksheet.write('A1', 'Foo')
|
22
24
|
|
23
25
|
workbook.close
|
24
26
|
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
25
|
-
[
|
26
|
-
'xl/printerSettings/printerSettings1.bin',
|
27
|
-
'xl/worksheets/_rels/sheet1.xml.rels'
|
28
|
-
],
|
27
|
+
[],
|
29
28
|
{
|
30
|
-
'[Content_Types].xml' => ['<Default Extension="bin"'],
|
31
29
|
'xl/worksheets/sheet1.xml' => ['<pageMargins']
|
32
|
-
|
33
30
|
}
|
34
31
|
)
|
35
32
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionSetStartPage02 < 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_set_start_page02
|
14
|
+
@xlsx = 'set_start_page02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.start_page = 2
|
19
|
+
worksheet.paper = 9
|
20
|
+
|
21
|
+
worksheet.vertical_dpi = 200
|
22
|
+
|
23
|
+
worksheet.write('A1', 'Foo')
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
27
|
+
[],
|
28
|
+
{
|
29
|
+
'xl/worksheets/sheet1.xml' => ['<pageMargins']
|
30
|
+
}
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionSetStartPage03 < 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_set_start_page03
|
14
|
+
@xlsx = 'set_start_page03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.start_page = 101
|
19
|
+
worksheet.paper = 9
|
20
|
+
|
21
|
+
worksheet.vertical_dpi = 200
|
22
|
+
|
23
|
+
worksheet.write('A1', 'Foo')
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
27
|
+
[],
|
28
|
+
{
|
29
|
+
'xl/worksheets/sheet1.xml' => ['<pageMargins']
|
30
|
+
}
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionTable17 < 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_table17
|
14
|
+
@xlsx = 'table17.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
# Set the column width to match the taget worksheet.
|
19
|
+
worksheet.set_column('B:K', 10.288)
|
20
|
+
|
21
|
+
# Write some strings to order the string table.
|
22
|
+
worksheet.write_string('A1', 'Column1')
|
23
|
+
worksheet.write_string('B1', 'Column2')
|
24
|
+
worksheet.write_string('C1', 'Column3')
|
25
|
+
worksheet.write_string('D1', 'Column4')
|
26
|
+
worksheet.write_string('E1', 'Column5')
|
27
|
+
worksheet.write_string('F1', 'Column6')
|
28
|
+
worksheet.write_string('G1', 'Column7')
|
29
|
+
worksheet.write_string('H1', 'Column8')
|
30
|
+
worksheet.write_string('I1', 'Column9')
|
31
|
+
worksheet.write_string('J1', 'Column10')
|
32
|
+
worksheet.write_string('K1', 'Total')
|
33
|
+
|
34
|
+
# Populate the data range.
|
35
|
+
data = [ 0, 0, 0, nil, nil, 0, 0, 0, 0, 0];
|
36
|
+
worksheet.write_row('B4', data)
|
37
|
+
worksheet.write_row('B5', data)
|
38
|
+
|
39
|
+
worksheet.write('G4', 4)
|
40
|
+
worksheet.write('G5', 5)
|
41
|
+
worksheet.write('I4', 1)
|
42
|
+
worksheet.write('I5', 2)
|
43
|
+
|
44
|
+
# Add the table.
|
45
|
+
worksheet.add_table(
|
46
|
+
'B3:K6',
|
47
|
+
{
|
48
|
+
:total_row => 1,
|
49
|
+
:columns => [
|
50
|
+
{:total_string => 'Total'},
|
51
|
+
{},
|
52
|
+
{:total_function => 'Average'},
|
53
|
+
{:total_function => 'COUNT'},
|
54
|
+
{:total_function => 'count_nums'},
|
55
|
+
{:total_function => 'max', :total_value => 5},
|
56
|
+
{:total_function => 'min'},
|
57
|
+
{:total_function => 'sum', :total_value => 3},
|
58
|
+
{:total_function => 'std Dev'},
|
59
|
+
{:total_function => 'var'}
|
60
|
+
]
|
61
|
+
}
|
62
|
+
)
|
63
|
+
|
64
|
+
workbook.close
|
65
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
66
|
+
['xl/calcChain.xml', '[Content_Types].xml', 'xl/_rels/workbook.xml.rels'],
|
67
|
+
{'xl/workbook.xml' => ['<workbookView']}
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|