xlsxwriter 0.2.1.pre → 0.2.2
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 +88 -80
- data/ext/xlsxwriter/chart.h +2 -2
- data/ext/xlsxwriter/chartsheet.c +307 -0
- data/ext/xlsxwriter/chartsheet.h +15 -0
- data/ext/xlsxwriter/common.h +104 -0
- 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/shared_strings.c +65 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +96 -20
- data/ext/xlsxwriter/worksheet.c +125 -235
- data/ext/xlsxwriter/worksheet.h +2 -1
- data/ext/xlsxwriter/xlsxwriter.c +4 -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 +201 -0
- 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 +135 -104
- 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,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
|
@@ -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 TestPrintArea < XlsxWriterTestCase
|
6
6
|
test 'print_area06' 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
|
@@ -13,7 +13,7 @@ class TestPrintArea < XlsxWriterTestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test 'print_area07' do |wb, t|
|
16
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
16
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
17
17
|
ws = wb.add_worksheet
|
18
18
|
ws.print_area('A1:XFD1048576')
|
19
19
|
ws.write_string('A1', 'Foo', nil)
|
@@ -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 TestPrintOptions < XlsxWriterTestCase
|
6
6
|
test 'print_options01' 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
|
@@ -13,7 +13,7 @@ class TestPrintOptions < XlsxWriterTestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test 'print_options02' do |wb, t|
|
16
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
16
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
17
17
|
ws = wb.add_worksheet
|
18
18
|
ws.paper = 9
|
19
19
|
ws.vertical_dpi = 200
|
@@ -22,7 +22,7 @@ class TestPrintOptions < XlsxWriterTestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
test 'print_options03' do |wb, t|
|
25
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
25
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
26
26
|
ws = wb.add_worksheet
|
27
27
|
ws.paper = 9
|
28
28
|
ws.vertical_dpi = 200
|
@@ -31,7 +31,7 @@ class TestPrintOptions < XlsxWriterTestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'print_options04' do |wb, t|
|
34
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
34
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
35
35
|
ws = wb.add_worksheet
|
36
36
|
ws.paper = 9
|
37
37
|
ws.vertical_dpi = 200
|
@@ -40,7 +40,7 @@ class TestPrintOptions < XlsxWriterTestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'print_options05' do |wb, t|
|
43
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
43
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
44
44
|
ws = wb.add_worksheet
|
45
45
|
ws.paper = 9
|
46
46
|
ws.vertical_dpi = 200
|
@@ -52,7 +52,7 @@ class TestPrintOptions < XlsxWriterTestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
test 'print_options06' do |wb, t|
|
55
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
55
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
56
56
|
ws = wb.add_worksheet
|
57
57
|
ws.paper = 9
|
58
58
|
ws.vertical_dpi = 200
|
@@ -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 TestPrintScale < XlsxWriterTestCase
|
6
6
|
test 'print_scale01' 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.print_scale = 75
|
10
10
|
ws.paper = 9
|
@@ -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 TestProperties < XlsxWriterTestCase
|
6
6
|
test 'properties01' do |wb|
|
@@ -30,7 +30,7 @@ class TestProperties < XlsxWriterTestCase
|
|
30
30
|
test 'properties04' do |wb|
|
31
31
|
wb.properties['Checked by'] = 'Adam'
|
32
32
|
wb.properties['Date completed'] = Time.new(2016, 12, 12, 23)
|
33
|
-
wb.properties['Document number'] =
|
33
|
+
wb.properties['Document number'] = 12_345
|
34
34
|
wb.properties['Reference'] = 1.2345
|
35
35
|
wb.properties['Source'] = true
|
36
36
|
wb.properties['Status'] = false
|
@@ -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 TestProtect < XlsxWriterTestCase
|
6
6
|
test 'protect02' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
8
8
|
wb.add_format :unlocked, unlocked: true
|
9
9
|
wb.add_format :hidden, unlocked: true, hidden: true
|
10
10
|
wb.add_worksheet do |ws|
|
@@ -16,7 +16,7 @@ class TestProtect < XlsxWriterTestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
test 'protect03' do |wb, t|
|
19
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
19
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'] }
|
20
20
|
wb.add_format :unlocked, unlocked: true
|
21
21
|
wb.add_format :hidden, unlocked: true, hidden: true
|
22
22
|
wb.add_worksheet do |ws|
|
@@ -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 TestRepeat < XlsxWriterTestCase
|
6
6
|
test 'repeat05' do |wb, t|
|
7
|
-
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [
|
8
|
-
'xl/worksheets/sheet3.xml' => [
|
7
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => ['<pageMargins'],
|
8
|
+
'xl/worksheets/sheet3.xml' => ['<pageMargins'] }
|
9
9
|
wb.add_worksheet do |ws|
|
10
10
|
ws.paper = 9
|
11
11
|
ws.vertical_dpi = 200
|
@@ -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 TestRichString < XlsxWriterTestCase
|
7
6
|
test('rich_string01') do |wb|
|
@@ -53,12 +52,10 @@ class TestRichString < XlsxWriterTestCase
|
|
53
52
|
.write_string('A1', 'Foo', :bold)
|
54
53
|
.write_string('A2', 'Bar', :italic)
|
55
54
|
.write_rich_string('A3',
|
56
|
-
|
57
|
-
|
58
|
-
)
|
55
|
+
XlsxWriter::RichString.new(wb) <<
|
56
|
+
'This is ' << ['bold', :bold] << ' and this is ' << ['italic', :italic])
|
59
57
|
end
|
60
58
|
|
61
|
-
|
62
59
|
test('rich_string06') do |wb|
|
63
60
|
wb
|
64
61
|
.add_format(:red, font_color: XlsxWriter::Format::COLOR_RED)
|
@@ -73,7 +70,7 @@ class TestRichString < XlsxWriterTestCase
|
|
73
70
|
['a', ['bc', :bold], 'defg'],
|
74
71
|
['a', ['bcdef', :bold], 'g'],
|
75
72
|
['abc', ['de', :italic], 'fg'],
|
76
|
-
[['abcd', :italic], ['efg', nil]]
|
73
|
+
[['abcd', :italic], ['efg', nil]]
|
77
74
|
].map { |parts| XlsxWriter::RichString.new(wb, parts) }
|
78
75
|
wb
|
79
76
|
.add_format(:bold, bold: true)
|
@@ -153,7 +150,6 @@ class TestRichString < XlsxWriterTestCase
|
|
153
150
|
.write_string('A2', 'Bar', :italic)
|
154
151
|
.write_rich_string('A3', XlsxWriter::RichString.new(wb) <<
|
155
152
|
"This is\n" << ["bold\n", :bold] << "and this is\n" << ['italic', :italic],
|
156
|
-
|
157
|
-
)
|
153
|
+
:wrap)
|
158
154
|
end
|
159
155
|
end
|
@@ -9,7 +9,7 @@ class TestRubyWorksheet < Test::Unit::TestCase
|
|
9
9
|
with_xlsx_file do |wb|
|
10
10
|
ws = wb.add_worksheet
|
11
11
|
|
12
|
-
ws.add_row ['asd', 'asdf', 'asdfg', 'asdfgh', 'asdfghj', 'd'*250]
|
12
|
+
ws.add_row ['asd', 'asdf', 'asdfg', 'asdfgh', 'asdfghj', 'd' * 250]
|
13
13
|
assert_in_epsilon(4.4, ws.get_column_auto_width('A'))
|
14
14
|
assert_in_epsilon(4.4, ws.get_column_auto_width('B'))
|
15
15
|
assert_in_epsilon(5.5, ws.get_column_auto_width('C'))
|
@@ -18,7 +18,7 @@ class TestRubyWorksheet < Test::Unit::TestCase
|
|
18
18
|
assert_in_epsilon(255, ws.get_column_auto_width('F'))
|
19
19
|
|
20
20
|
wb.add_format :f, font_size: 14
|
21
|
-
ws.add_row [
|
21
|
+
ws.add_row %w[asd asdf asdfg asdfgh asdfghj], style: :f
|
22
22
|
assert_in_epsilon(5.6, ws.get_column_auto_width('A'))
|
23
23
|
assert_in_epsilon(5.6, ws.get_column_auto_width('B'))
|
24
24
|
assert_in_epsilon(7.0, ws.get_column_auto_width('C'))
|
@@ -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 TestSetSelection < XlsxWriterTestCase
|
6
6
|
test 'set_selection02' 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 { |ws| ws.set_selection(3, 2, 3, 2) }
|
9
9
|
wb.add_worksheet { |ws| ws.set_selection(3, 2, 6, 6) }
|
10
10
|
wb.add_worksheet { |ws| ws.set_selection(6, 6, 3, 2) }
|
@@ -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 TestSetStartPage < XlsxWriterTestCase
|
6
6
|
test 'set_start_page02' 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.start_page = 2
|
10
10
|
ws.paper = 9
|
@@ -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 TestSimple < XlsxWriterTestCase
|
6
6
|
test 'simple01' do |wb|
|
@@ -12,7 +12,7 @@ class TestSimple < XlsxWriterTestCase
|
|
12
12
|
|
13
13
|
test 'simple02' do |wb|
|
14
14
|
ws1 = wb.add_worksheet
|
15
|
-
|
15
|
+
wb.add_worksheet('Data Sheet')
|
16
16
|
ws3 = wb.add_worksheet
|
17
17
|
|
18
18
|
wb.add_format(:bold, bold: true)
|
@@ -27,10 +27,10 @@ class TestSimple < XlsxWriterTestCase
|
|
27
27
|
|
28
28
|
test 'simple03' do |wb|
|
29
29
|
ws1 = wb.add_worksheet
|
30
|
-
ws2 = wb.add_worksheet(
|
30
|
+
ws2 = wb.add_worksheet('Data Sheet')
|
31
31
|
ws3 = wb.add_worksheet
|
32
32
|
|
33
|
-
wb.add_format(:bold, bold: true)
|
33
|
+
wb.add_format(:bold, bold: true)
|
34
34
|
|
35
35
|
ws1.write_string(0, 'A', 'Foo')
|
36
36
|
ws1.write_number(1, 'A', 123)
|
@@ -40,16 +40,16 @@ class TestSimple < XlsxWriterTestCase
|
|
40
40
|
ws3.write_number('C4', 234)
|
41
41
|
|
42
42
|
# Ensure the active worksheet is overwritten, below.
|
43
|
-
|
43
|
+
ws2.activate
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
ws2.select
|
46
|
+
ws3.select
|
47
|
+
ws3.activate
|
48
48
|
end
|
49
49
|
|
50
50
|
test 'simple04' do |wb|
|
51
|
-
datetime1 = Time.new(0, 1,
|
52
|
-
datetime2 = Time.new(2013, 1, 27,
|
51
|
+
datetime1 = Time.new(0, 1, 1, 12)
|
52
|
+
datetime2 = Time.new(2013, 1, 27, 0)
|
53
53
|
|
54
54
|
ws = wb.add_worksheet
|
55
55
|
|