xlsxwriter 0.2.1.pre.2 → 0.2.3.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/ext/xlsxwriter/chart.c +84 -20
- data/ext/xlsxwriter/chart.h +1 -0
- data/ext/xlsxwriter/chartsheet.c +34 -13
- data/ext/xlsxwriter/common.h +5 -5
- data/ext/xlsxwriter/extconf.rb +8 -8
- data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
- data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
- data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
- data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
- data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
- data/ext/xlsxwriter/rich_string.c +28 -9
- data/ext/xlsxwriter/shared_strings.c +75 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +87 -13
- data/ext/xlsxwriter/workbook.h +1 -0
- data/ext/xlsxwriter/workbook_properties.c +2 -2
- data/ext/xlsxwriter/worksheet.c +75 -23
- data/ext/xlsxwriter/worksheet.h +1 -0
- data/ext/xlsxwriter/xlsxwriter.c +2 -0
- data/lib/xlsxwriter/rich_string.rb +0 -2
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +2 -2
- data/test/{run-test.rb → run_test.rb} +3 -3
- data/test/support/chart_test.rb +3 -3
- data/test/support/with_xlsx_file.rb +4 -2
- data/test/support/xlsx_comparable.rb +40 -26
- data/test/test_array_formula.rb +42 -0
- data/test/test_autofilter.rb +72 -0
- data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
- data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
- data/test/test_chart_bar.rb +382 -0
- data/test/test_chart_blank.rb +27 -0
- data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
- data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
- data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
- data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
- data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
- data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
- data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
- data/test/{test-chartsheet.rb → test_chartsheet.rb} +2 -2
- data/test/{test-data.rb → test_data.rb} +1 -1
- data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
- data/test/{test-default-row.rb → test_default_row.rb} +1 -1
- data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
- data/test/{test-escapes.rb → test_escapes.rb} +5 -2
- data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
- data/test/{test-formatting.rb → test_formatting.rb} +10 -10
- data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
- data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
- data/test/{test-image.rb → test_image.rb} +6 -4
- data/test/{test-macro.rb → test_macro.rb} +1 -1
- data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
- data/test/{test-misc.rb → test_misc.rb} +2 -2
- data/test/{test-optimize.rb → test_optimize.rb} +2 -4
- data/test/{test-outline.rb → test_outline.rb} +14 -14
- data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
- data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
- data/test/{test-panes.rb → test_panes.rb} +1 -1
- data/test/{test-print-area.rb → test_print_area.rb} +3 -3
- data/test/{test-print-options.rb → test_print_options.rb} +7 -7
- data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
- data/test/{test-properties.rb → test_properties.rb} +2 -2
- data/test/{test-protect.rb → test_protect.rb} +3 -3
- data/test/{test-repeat.rb → test_repeat.rb} +3 -3
- data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
- data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
- data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
- data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
- data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
- data/test/{test-simple.rb → test_simple.rb} +10 -10
- data/test/{test-types.rb → test_types.rb} +1 -1
- data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
- metadata +127 -106
- data/test/test-array-formula.rb +0 -35
- data/test/test-autofilter.rb +0 -72
- data/test/test-chart-bar.rb +0 -74
- /data/test/{test-errors.rb → test_errors.rb} +0 -0
@@ -1,19 +1,18 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
5
4
|
|
6
5
|
class TestDataValidation < XlsxWriterTestCase
|
7
6
|
test 'data_validation01' do |wb|
|
8
7
|
wb.add_worksheet
|
9
8
|
.add_data_validation 'C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
10
|
-
value: %w
|
9
|
+
value: %w[Foo Bar Baz]
|
11
10
|
end
|
12
11
|
|
13
12
|
test 'data_validation02' do |wb|
|
14
13
|
wb.add_worksheet
|
15
14
|
.add_data_validation 1, 2, validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
16
|
-
value: %w
|
15
|
+
value: %w[Foo Bar Baz],
|
17
16
|
input_title: 'This is the input title',
|
18
17
|
input_message: 'This is the input message'
|
19
18
|
end
|
@@ -21,81 +20,81 @@ class TestDataValidation < XlsxWriterTestCase
|
|
21
20
|
test 'data_validation03' do |wb|
|
22
21
|
wb.add_worksheet
|
23
22
|
.add_data_validation('C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
24
|
-
value: %w
|
23
|
+
value: %w[Foo Bar Baz],
|
25
24
|
input_title: 'This is the input title',
|
26
25
|
input_message: 'This is the input message')
|
27
26
|
.add_data_validation('D6', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
28
|
-
value: %w
|
27
|
+
value: %w[Foobar Foobas Foobat Foobau Foobav Foobaw Foobax
|
29
28
|
Foobay Foobaz Foobba Foobbb Foobbc Foobbd Foobbe
|
30
29
|
Foobbf Foobbg Foobbh Foobbi Foobbj Foobbk Foobbl
|
31
30
|
Foobbm Foobbn Foobbo Foobbp Foobbq Foobbr Foobbs
|
32
31
|
Foobbt Foobbu Foobbv Foobbw Foobbx Foobby Foobbz
|
33
|
-
Foobca End
|
32
|
+
Foobca End],
|
34
33
|
input_title: 'This is the longest input title1',
|
35
|
-
input_message:
|
34
|
+
input_message: "This is the longest input message #{'a' * 221}")
|
36
35
|
end
|
37
36
|
|
38
37
|
test 'data_validation04', ref_file_name: 'data_validation02' do |wb|
|
39
38
|
ws = wb.add_worksheet
|
40
|
-
|
41
|
-
value: %w
|
39
|
+
ws.add_data_validation('C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
40
|
+
value: %w[Foo Bar Baz],
|
42
41
|
input_title: 'This is the input title',
|
43
42
|
input_message: 'This is the input message')
|
44
43
|
assert_raise(XlsxWriter::Error.new('Parameter exceeds Excel\'s limit of 32 characters.')) do
|
45
44
|
ws.add_data_validation('D6', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
46
|
-
value: %w
|
45
|
+
value: %w[Foobar Foobas Foobat Foobau Foobav Foobaw Foobax
|
47
46
|
Foobay Foobaz Foobba Foobbb Foobbc Foobbd Foobbe
|
48
47
|
Foobbf Foobbg Foobbh Foobbi Foobbj Foobbk Foobbl
|
49
48
|
Foobbm Foobbn Foobbo Foobbp Foobbq Foobbr Foobbs
|
50
49
|
Foobbt Foobbu Foobbv Foobbw Foobbx Foobby Foobbz
|
51
|
-
Foobca End
|
50
|
+
Foobca End],
|
52
51
|
input_title: 'This is the longest input title12',
|
53
|
-
input_message:
|
52
|
+
input_message: "This is the longest input message #{'a' * 221}")
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
56
|
test 'data_validation05', ref_file_name: 'data_validation02' do |wb|
|
58
57
|
ws = wb.add_worksheet
|
59
|
-
|
60
|
-
value: %w
|
58
|
+
ws.add_data_validation('C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
59
|
+
value: %w[Foo Bar Baz],
|
61
60
|
input_title: 'This is the input title',
|
62
61
|
input_message: 'This is the input message')
|
63
62
|
assert_raise(XlsxWriter::Error.new('Parameter exceeds Excel\'s limit of 255 characters.')) do
|
64
63
|
ws.add_data_validation('D6', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
65
|
-
value: %w
|
64
|
+
value: %w[Foobar Foobas Foobat Foobau Foobav Foobaw Foobax
|
66
65
|
Foobay Foobaz Foobba Foobbb Foobbc Foobbd Foobbe
|
67
66
|
Foobbf Foobbg Foobbh Foobbi Foobbj Foobbk Foobbl
|
68
67
|
Foobbm Foobbn Foobbo Foobbp Foobbq Foobbr Foobbs
|
69
68
|
Foobbt Foobbu Foobbv Foobbw Foobbx Foobby Foobbz
|
70
|
-
Foobca End
|
69
|
+
Foobca End],
|
71
70
|
input_title: 'This is the longest input title1',
|
72
|
-
input_message:
|
71
|
+
input_message: "This is the longest input message #{'a' * 222}")
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
75
|
test 'data_validation06', ref_file_name: 'data_validation02' do |wb|
|
77
76
|
ws = wb.add_worksheet
|
78
|
-
|
79
|
-
value: %w
|
77
|
+
ws.add_data_validation('C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
78
|
+
value: %w[Foo Bar Baz],
|
80
79
|
input_title: 'This is the input title',
|
81
80
|
input_message: 'This is the input message')
|
82
81
|
assert_raise(XlsxWriter::Error.new('Parameter exceeds Excel\'s limit of 255 characters.')) do
|
83
82
|
ws.add_data_validation('D6', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
84
|
-
value: %w
|
83
|
+
value: %w[Foobar Foobas Foobat Foobau Foobav Foobaw Foobax
|
85
84
|
Foobay Foobaz Foobba Foobbb Foobbc Foobbd Foobbe
|
86
85
|
Foobbf Foobbg Foobbh Foobbi Foobbj Foobbk Foobbl
|
87
86
|
Foobbm Foobbn Foobbo Foobbp Foobbq Foobbr Foobbs
|
88
87
|
Foobbt Foobbu Foobbv Foobbw Foobbx Foobby Foobbz
|
89
|
-
Foobca End1
|
88
|
+
Foobca End1],
|
90
89
|
input_title: 'This is the longest input title1',
|
91
|
-
input_message:
|
90
|
+
input_message: "This is the longest input message #{'a' * 221}")
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
95
94
|
test 'data_validation07' do |wb|
|
96
95
|
wb.add_worksheet
|
97
96
|
.add_data_validation 'C2', validate: XlsxWriter::Worksheet::VALIDATION_TYPE_LIST,
|
98
|
-
value: %w
|
97
|
+
value: %w[coffee café]
|
99
98
|
end
|
100
99
|
|
101
100
|
test 'data_validation08' do |wb|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestDefinedName < XlsxWriterTestCase
|
6
6
|
test 'defined_name01' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
8
8
|
wb.add_worksheet do |ws|
|
9
9
|
ws.paper = 9
|
10
10
|
ws.vertical_dpi = 200
|
@@ -20,28 +20,28 @@ class TestDefinedName < XlsxWriterTestCase
|
|
20
20
|
wb.add_worksheet 'Sheet 3'
|
21
21
|
|
22
22
|
wb.define_name "'Sheet 3'!Bar", "='Sheet 3'!$A$1"
|
23
|
-
wb.define_name
|
24
|
-
wb.define_name
|
25
|
-
wb.define_name
|
26
|
-
wb.define_name
|
27
|
-
wb.define_name
|
28
|
-
wb.define_name
|
29
|
-
wb.define_name
|
23
|
+
wb.define_name 'Abc', '=Sheet1!$A$1'
|
24
|
+
wb.define_name 'Baz', '=0.98'
|
25
|
+
wb.define_name 'Sheet1!Bar', '=Sheet1!$A$1'
|
26
|
+
wb.define_name 'Sheet2!Bar', '=Sheet2!$A$1'
|
27
|
+
wb.define_name 'Sheet2!aaa', '=Sheet2!$A$1'
|
28
|
+
wb.define_name '_Egg', '=Sheet1!$A$1'
|
29
|
+
wb.define_name '_Fog', '=Sheet1!$A$1'
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'defined_name02' do |wb|
|
33
33
|
wb.add_worksheet 'sheet One'
|
34
|
-
wb.define_name
|
34
|
+
wb.define_name 'Sales', "='sheet One'!$G$1:$H$10"
|
35
35
|
end
|
36
36
|
|
37
37
|
test 'defined_name03' do |wb, t|
|
38
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
38
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
39
39
|
wb.add_worksheet('sheet One')
|
40
40
|
wb.define_name 'Sales', '=\'sheet One\'!G1:H10'
|
41
41
|
end
|
42
42
|
|
43
43
|
test 'defined_name04' do |wb, t|
|
44
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
44
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
45
45
|
wb.add_worksheet
|
46
46
|
wb.define_name '\\__', '=Sheet1!$A$1'
|
47
47
|
wb.define_name 'a3f6', '=Sheet1!$A$2'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestEscapes < XlsxWriterTestCase
|
6
6
|
test 'escapes03' do |wb|
|
@@ -11,15 +11,16 @@ class TestEscapes < XlsxWriterTestCase
|
|
11
11
|
.write_string('A1', 'Foo', :bold)
|
12
12
|
.write_string('A2', 'Bar', :italic)
|
13
13
|
.write_rich_string('A3', [['a'], ["b\"<>'c", :bold], ['defg']])
|
14
|
-
|
15
14
|
end
|
16
15
|
|
17
16
|
test 'escapes04' do |wb|
|
17
|
+
wb.unset_default_url_format
|
18
18
|
wb.add_worksheet
|
19
19
|
.write_url(0, 'A', 'http://www.perl.com/?a=1&b=2')
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'escapes05' do |wb|
|
23
|
+
wb.unset_default_url_format
|
23
24
|
wb.add_worksheet('Start')
|
24
25
|
.write_url(0, 'A', 'internal:\'A & B\'!A1', string: 'Jump to A & B')
|
25
26
|
wb.add_worksheet('A & B')
|
@@ -33,6 +34,7 @@ class TestEscapes < XlsxWriterTestCase
|
|
33
34
|
end
|
34
35
|
|
35
36
|
test 'escapes07' do |wb|
|
37
|
+
wb.unset_default_url_format
|
36
38
|
wb.add_worksheet
|
37
39
|
.write_url(0, 'A', 'http://example.com/!"$%&\'( )*+,-./0123456789:;<=>?@' \
|
38
40
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`' \
|
@@ -40,6 +42,7 @@ class TestEscapes < XlsxWriterTestCase
|
|
40
42
|
end
|
41
43
|
|
42
44
|
test 'escapes08' do |wb|
|
45
|
+
wb.unset_default_url_format
|
43
46
|
wb.add_worksheet
|
44
47
|
.write_url 0, 'A', 'http://example.com/%5b0%5d', string: 'http://example.com/[0]'
|
45
48
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestFitToPages < XlsxWriterTestCase
|
6
6
|
test 'fit_to_pages01' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
8
8
|
|
9
9
|
ws = wb.add_worksheet
|
10
10
|
ws.fit_to_pages 1, 1
|
@@ -14,7 +14,7 @@ class TestFitToPages < XlsxWriterTestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
test 'fit_to_pages02' do |wb, t|
|
17
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
17
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
18
18
|
|
19
19
|
ws = wb.add_worksheet
|
20
20
|
ws.fit_to_pages 2, 1
|
@@ -24,7 +24,7 @@ class TestFitToPages < XlsxWriterTestCase
|
|
24
24
|
end
|
25
25
|
|
26
26
|
test 'fit_to_pages03' do |wb, t|
|
27
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
27
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
28
28
|
|
29
29
|
ws = wb.add_worksheet
|
30
30
|
ws.fit_to_pages 1, 2
|
@@ -34,7 +34,7 @@ class TestFitToPages < XlsxWriterTestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'fit_to_pages04' do |wb, t|
|
37
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
37
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
38
38
|
|
39
39
|
ws = wb.add_worksheet
|
40
40
|
ws.fit_to_pages(3, 2)
|
@@ -44,7 +44,7 @@ class TestFitToPages < XlsxWriterTestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
test 'fit_to_pages05' do |wb, t|
|
47
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
47
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
48
48
|
|
49
49
|
ws = wb.add_worksheet
|
50
50
|
ws.fit_to_pages(1, 0)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestFormatting < XlsxWriterTestCase
|
6
6
|
test 'format01' do |wb|
|
7
7
|
ws1 = wb.add_worksheet
|
8
|
-
|
8
|
+
wb.add_worksheet 'Data Sheet'
|
9
9
|
ws3 = wb.add_worksheet
|
10
10
|
|
11
11
|
wb.add_format :unused, {}
|
@@ -32,8 +32,8 @@ class TestFormatting < XlsxWriterTestCase
|
|
32
32
|
wb.add_format(:format2, font_name: 'Arial',
|
33
33
|
bold: true,
|
34
34
|
rotation: 90,
|
35
|
-
align:
|
36
|
-
vertical_align:
|
35
|
+
align: XlsxWriter::Format::ALIGN_CENTER,
|
36
|
+
vertical_align: XlsxWriter::Format::ALIGN_VERTICAL_BOTTOM)
|
37
37
|
|
38
38
|
ws.write_string(0, 0, 'Foo', :format1)
|
39
39
|
ws.write_string(0, 1, 'Bar', :format2)
|
@@ -124,13 +124,13 @@ class TestFormatting < XlsxWriterTestCase
|
|
124
124
|
ws = wb.add_worksheet
|
125
125
|
|
126
126
|
wb.add_format :top_left_bottom, bottom: XlsxWriter::Format::BORDER_THIN,
|
127
|
-
left:
|
128
|
-
top:
|
127
|
+
left: XlsxWriter::Format::BORDER_THIN,
|
128
|
+
top: XlsxWriter::Format::BORDER_THIN
|
129
129
|
wb.add_format :top_bottom, bottom: XlsxWriter::Format::BORDER_THIN,
|
130
|
-
top:
|
131
|
-
wb.add_format :top_left, left:
|
132
|
-
top:
|
133
|
-
wb.add_format :unused, left:
|
130
|
+
top: XlsxWriter::Format::BORDER_THIN
|
131
|
+
wb.add_format :top_left, left: XlsxWriter::Format::BORDER_THIN,
|
132
|
+
top: XlsxWriter::Format::BORDER_THIN
|
133
|
+
wb.add_format :unused, left: XlsxWriter::Format::BORDER_THIN
|
134
134
|
|
135
135
|
ws.write_string(1, 'B', 'test', :top_left_bottom)
|
136
136
|
ws.write_string(1, 'D', 'test', :top_left)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestGridlines < XlsxWriterTestCase
|
6
6
|
test 'gridlines01' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
8
8
|
ws = wb.add_worksheet
|
9
9
|
|
10
10
|
ws.paper = 9
|
@@ -12,6 +12,6 @@ class TestGridlines < XlsxWriterTestCase
|
|
12
12
|
|
13
13
|
ws.gridlines = XlsxWriter::Worksheet::GRIDLINES_HIDE_ALL
|
14
14
|
|
15
|
-
ws.write_string(0, 'A', 'Foo'
|
15
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
16
16
|
end
|
17
17
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestHyperlink < XlsxWriterTestCase
|
6
6
|
test 'hyperlink03' do |wb|
|
7
|
+
wb.unset_default_url_format
|
7
8
|
ws1 = wb.add_worksheet
|
8
9
|
ws2 = wb.add_worksheet
|
9
10
|
|
@@ -21,6 +22,7 @@ class TestHyperlink < XlsxWriterTestCase
|
|
21
22
|
end
|
22
23
|
|
23
24
|
test 'hyperlink05' do |wb|
|
25
|
+
wb.unset_default_url_format
|
24
26
|
wb.add_worksheet
|
25
27
|
.write_url(0, 'A', 'http://www.perl.org/')
|
26
28
|
.write_url(2, 'A', 'http://www.perl.org/', nil, string: 'Perl home')
|
@@ -29,15 +31,16 @@ class TestHyperlink < XlsxWriterTestCase
|
|
29
31
|
end
|
30
32
|
|
31
33
|
test 'hyperlink09' do |wb|
|
34
|
+
wb.unset_default_url_format
|
32
35
|
wb.add_worksheet
|
33
|
-
.write_url(
|
34
|
-
.write_url(
|
35
|
-
.write_url(
|
36
|
+
.write_url('A1', 'external:..\\foo.xlsx')
|
37
|
+
.write_url('A3', 'external:..\\foo.xlsx#Sheet1!A1')
|
38
|
+
.write_url('A5', 'external:\\\\VBOXSVR\\share\\foo.xlsx#Sheet1!B2',
|
36
39
|
string: 'J:\\foo.xlsx#Sheet1!B2')
|
37
40
|
end
|
38
41
|
|
39
42
|
test 'hyperlink14' do |wb, t|
|
40
|
-
t.ignore_files = %w
|
43
|
+
t.ignore_files = %w[xl/sharedStrings.xml]
|
41
44
|
|
42
45
|
wb.add_format(:f, align: XlsxWriter::Format::ALIGN_CENTER)
|
43
46
|
ws = wb.add_worksheet
|
@@ -48,22 +51,30 @@ class TestHyperlink < XlsxWriterTestCase
|
|
48
51
|
end
|
49
52
|
|
50
53
|
test 'hyperlink18' do |wb|
|
54
|
+
wb.max_url_length = 255
|
55
|
+
ws = wb.add_worksheet
|
56
|
+
wb.unset_default_url_format
|
57
|
+
ws.write_url(0, 0, 'http://google.com/00000000001111111111222222222233333333334444444444555555555566666666666777777777778888888888999999999990000000000111111111122222222223333333333444444444455555555556666666666677777777777888888888899999999999000000000011111111112222222222x')
|
58
|
+
end
|
59
|
+
|
60
|
+
test 'hyperlink19' do |wb|
|
61
|
+
pend
|
51
62
|
wb.add_worksheet
|
52
|
-
.write_url(
|
53
|
-
.
|
63
|
+
.write_url('A1', 'http://www.perl.com/')
|
64
|
+
.write_formula_num('A1', '=1+1', 2)
|
65
|
+
wb.sst.string_count = 0
|
54
66
|
end
|
55
67
|
|
56
68
|
test 'hyperlink20' do |wb, t|
|
57
|
-
t.ignore_files = %w
|
69
|
+
t.ignore_files = %w[xl/styles.xml]
|
58
70
|
|
59
71
|
wb
|
60
|
-
.add_format(:f1, underline:
|
72
|
+
.add_format(:f1, underline: XlsxWriter::Format::UNDERLINE_SINGLE,
|
61
73
|
font_color: XlsxWriter::Format::COLOR_BLUE)
|
62
|
-
.add_format(:f2, underline:
|
74
|
+
.add_format(:f2, underline: XlsxWriter::Format::UNDERLINE_SINGLE,
|
63
75
|
font_color: XlsxWriter::Format::COLOR_RED)
|
64
76
|
.add_worksheet
|
65
77
|
.write_url(0, 0, 'http://www.python.org/1', :f1)
|
66
78
|
.write_url(1, 0, 'http://www.python.org/2', :f2)
|
67
|
-
|
68
79
|
end
|
69
80
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestImage < XlsxWriterTestCase
|
6
6
|
test 'image01' do |wb|
|
@@ -96,13 +96,13 @@ class TestImage < XlsxWriterTestCase
|
|
96
96
|
|
97
97
|
test 'image45' do |wb|
|
98
98
|
wb.add_worksheet
|
99
|
-
.insert_image('E9', image_path('red.png'))
|
99
|
+
.insert_image('E9', image_path('red.png'), object_position: XlsxWriter::Worksheet::OBJECT_MOVE_AND_SIZE_AFTER)
|
100
100
|
.set_row(8, height: 30, hide: true)
|
101
101
|
end
|
102
102
|
|
103
103
|
test 'image46' do |wb|
|
104
104
|
wb.add_worksheet
|
105
|
-
.insert_image('E9', image_path('red.png'),
|
105
|
+
.insert_image('E9', image_path('red.png'), y_offset: 4, object_position: XlsxWriter::Worksheet::OBJECT_MOVE_AND_SIZE_AFTER)
|
106
106
|
.set_row(8, height: 30, hide: true)
|
107
107
|
end
|
108
108
|
|
@@ -124,6 +124,8 @@ class TestImage < XlsxWriterTestCase
|
|
124
124
|
|
125
125
|
test('image83', ref_file_name: 'image02') do |wb|
|
126
126
|
wb.add_worksheet
|
127
|
-
.insert_image_buffer('D7', File.binread(image_path('yellow.png')), x_offset: 1,
|
127
|
+
.insert_image_buffer('D7', File.binread(image_path('yellow.png')), x_offset: 1,
|
128
|
+
y_offset: 2,
|
129
|
+
description: 'yellow.png')
|
128
130
|
end
|
129
131
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestMisc < XlsxWriterTestCase
|
6
6
|
test 'tab_color01' do |wb|
|
@@ -24,7 +24,7 @@ class TestMisc < XlsxWriterTestCase
|
|
24
24
|
test 'shared_strings01' do |wb|
|
25
25
|
ws = wb.add_worksheet
|
26
26
|
ws.write_string(0, 0, '_x0000_')
|
27
|
-
(1...127).each_with_object(String.new(
|
27
|
+
(1...127).each_with_object(String.new('')) do |i, s|
|
28
28
|
s[0] = i.chr
|
29
29
|
ws.write_string(i, 0, s) unless i == 34
|
30
30
|
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
5
4
|
|
6
5
|
class TestOptimize < XlsxWriterTestCase
|
7
6
|
test('optimize01', constant_memory: true) do |wb|
|
@@ -34,7 +33,7 @@ class TestOptimize < XlsxWriterTestCase
|
|
34
33
|
['a', ['bc', :bold], 'defg'],
|
35
34
|
['a', ['bcdef', :bold], 'g'],
|
36
35
|
['abc', ['de', :italic], 'fg'],
|
37
|
-
[['abcd', :italic], ['efg', nil]]
|
36
|
+
[['abcd', :italic], ['efg', nil]]
|
38
37
|
].map { |parts| XlsxWriter::RichString.new(wb, parts) }
|
39
38
|
wb
|
40
39
|
.add_format(:bold, bold: true)
|
@@ -56,7 +55,6 @@ class TestOptimize < XlsxWriterTestCase
|
|
56
55
|
(1..127).each { |i| ws.write_string(i, 0, i.chr, nil) unless i == 34 }
|
57
56
|
end
|
58
57
|
|
59
|
-
|
60
58
|
test('optimize08', constant_memory: true) do |wb|
|
61
59
|
wb
|
62
60
|
.add_format(:bold, bold: true)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestOutline < XlsxWriterTestCase
|
6
6
|
test 'outline01' do |wb, t|
|
@@ -10,7 +10,7 @@ class TestOutline < XlsxWriterTestCase
|
|
10
10
|
ws = wb.add_worksheet 'Outlined Rows'
|
11
11
|
ws.set_column('A', 'A', width: 20)
|
12
12
|
(1..10).each do |i|
|
13
|
-
ws.set_row i, level: (i % 5
|
13
|
+
ws.set_row i, level: ((i % 5).zero? ? 1 : 2)
|
14
14
|
end
|
15
15
|
|
16
16
|
write_common_data(ws)
|
@@ -22,7 +22,7 @@ class TestOutline < XlsxWriterTestCase
|
|
22
22
|
wb.add_format(:bold, bold: true)
|
23
23
|
ws = wb.add_worksheet 'Collapsed Rows'
|
24
24
|
(1..10).each do |i|
|
25
|
-
ws.set_row i, level: (i % 5
|
25
|
+
ws.set_row i, level: ((i % 5).zero? ? 1 : 2), hide: true
|
26
26
|
end
|
27
27
|
ws.set_row 11, collapse: true
|
28
28
|
|
@@ -38,18 +38,18 @@ class TestOutline < XlsxWriterTestCase
|
|
38
38
|
wb.add_format(:bold, bold: true)
|
39
39
|
ws = wb.add_worksheet 'Outline Columns'
|
40
40
|
|
41
|
-
%w
|
41
|
+
%w[Month Jan Feb Mar Apr May Jun Total].each_with_index { |s, i| ws.write_string 0, i, s }
|
42
42
|
[
|
43
43
|
['North', [50, 20, 15, 25, 65, 80]],
|
44
44
|
['South', [10, 20, 30, 50, 50, 50]],
|
45
45
|
['East', [45, 75, 50, 15, 75, 100]],
|
46
|
-
['West', [15, 15, 55, 35, 20, 50]]
|
46
|
+
['West', [15, 15, 55, 35, 20, 50]]
|
47
47
|
].each_with_index do |(d, vals), i|
|
48
|
-
ws.write_string(i+1, 0, d)
|
49
|
-
vals.each_with_index { |v, j| ws.write_number(i+1, j+1, v) }
|
50
|
-
ws.write_formula_num(i+1, vals.size + 1, "=SUM(B#{i+2}:G#{i+2})", vals.reduce(:+))
|
48
|
+
ws.write_string(i + 1, 0, d)
|
49
|
+
vals.each_with_index { |v, j| ws.write_number(i + 1, j + 1, v) }
|
50
|
+
ws.write_formula_num(i + 1, vals.size + 1, "=SUM(B#{i + 2}:G#{i + 2})", vals.reduce(:+))
|
51
51
|
end
|
52
|
-
ws.write_formula_num('H6',
|
52
|
+
ws.write_formula_num('H6', '=SUM(H2:H5)', 1015, :bold)
|
53
53
|
ws.set_row 0, format: :bold
|
54
54
|
ws.set_column 'A', 'A', width: 10, format: :bold
|
55
55
|
ws.set_column 'H', 'H', width: 10
|
@@ -60,7 +60,7 @@ class TestOutline < XlsxWriterTestCase
|
|
60
60
|
t.ignore_files << 'xl/calcChain.xml' << '[Content_Types].xml' << 'xl/_rels/workbook.xml.rels'
|
61
61
|
|
62
62
|
ws = wb.add_worksheet 'Outline levels'
|
63
|
-
13.times { |i| ws.write_string i, 0, "Level #{
|
63
|
+
13.times { |i| ws.write_string i, 0, "Level #{i > 6 ? 13 - i : i + 1}" }
|
64
64
|
13.times { |i| ws.set_row i, level: (i > 6 ? 13 - i : i + 1) }
|
65
65
|
end
|
66
66
|
|
@@ -72,7 +72,7 @@ class TestOutline < XlsxWriterTestCase
|
|
72
72
|
ws.set_column('A', 'A', width: 20)
|
73
73
|
ws.set_selection 'A14:A14'
|
74
74
|
(1..10).each do |i|
|
75
|
-
ws.set_row i, level: (i % 5
|
75
|
+
ws.set_row i, level: ((i % 5).zero? ? 1 : 2), hide: true, collapse: (i % 5).zero?
|
76
76
|
end
|
77
77
|
ws.set_row 11, collapse: true
|
78
78
|
|
@@ -87,7 +87,7 @@ class TestOutline < XlsxWriterTestCase
|
|
87
87
|
ws.outline_settings = { visible: false, symbols_below: false, symbols_right: false, auto_style: true }
|
88
88
|
ws.set_column('A', 'A', width: 20)
|
89
89
|
(1..10).each do |i|
|
90
|
-
ws.set_row i, level: (i % 5
|
90
|
+
ws.set_row i, level: ((i % 5).zero? ? 1 : 2)
|
91
91
|
end
|
92
92
|
|
93
93
|
write_common_data(ws)
|
@@ -95,8 +95,8 @@ class TestOutline < XlsxWriterTestCase
|
|
95
95
|
|
96
96
|
private
|
97
97
|
|
98
|
-
def write_common_data(
|
99
|
-
|
98
|
+
def write_common_data(worksheet)
|
99
|
+
worksheet
|
100
100
|
.write_string('A1', 'Region', :bold)
|
101
101
|
.write_string('A2', 'North')
|
102
102
|
.write_string('A3', 'North')
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestpageBreaks < XlsxWriterTestCase
|
6
6
|
test 'page_breaks06' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
8
8
|
ws = wb.add_worksheet
|
9
9
|
ws.paper = 9
|
10
10
|
ws.vertical_dpi = 200
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestPageSetup < XlsxWriterTestCase
|
6
6
|
test 'page_view01' do |wb|
|
@@ -20,7 +20,7 @@ class TestPageSetup < XlsxWriterTestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'print_across01' do |wb, t|
|
23
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
23
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
24
24
|
ws = wb.add_worksheet
|
25
25
|
ws.print_across
|
26
26
|
ws.paper = 9
|