xlsxwriter 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +40 -0
- data/ext/xlsxwriter/chart.c +105 -0
- data/ext/xlsxwriter/chart.h +27 -0
- data/ext/xlsxwriter/extconf.rb +14 -0
- data/ext/xlsxwriter/format.c +67 -0
- data/ext/xlsxwriter/format.h +9 -0
- data/ext/xlsxwriter/libxlsxwriter/LICENSE.txt +89 -0
- data/ext/xlsxwriter/libxlsxwriter/Makefile +141 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +1093 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +336 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +215 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +751 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/ext/xlsxwriter/libxlsxwriter/lib/.gitignore +0 -0
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +125 -0
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +439 -0
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +3420 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +341 -0
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +293 -0
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +224 -0
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +746 -0
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +728 -0
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +223 -0
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +877 -0
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +242 -0
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +264 -0
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +1086 -0
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +348 -0
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +512 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +1895 -0
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +4992 -0
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +355 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.h +209 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/ext/xlsxwriter/workbook.c +257 -0
- data/ext/xlsxwriter/workbook.h +42 -0
- data/ext/xlsxwriter/workbook_properties.c +103 -0
- data/ext/xlsxwriter/workbook_properties.h +10 -0
- data/ext/xlsxwriter/worksheet.c +1064 -0
- data/ext/xlsxwriter/worksheet.h +74 -0
- data/ext/xlsxwriter/xlsxwriter.c +239 -0
- data/lib/xlsxwriter.rb +6 -0
- data/lib/xlsxwriter/version.rb +3 -0
- data/lib/xlsxwriter/worksheet.rb +72 -0
- data/test/run-test.rb +11 -0
- data/test/support/xlsx_comparable.rb +109 -0
- data/test/test-array-formula.rb +33 -0
- data/test/test-autofilter.rb +70 -0
- data/test/test-chart-area.rb +25 -0
- data/test/test-data.rb +65 -0
- data/test/test-default-row.rb +25 -0
- data/test/test-defined-name.rb +46 -0
- data/test/test-escapes.rb +33 -0
- data/test/test-fit-to-pages.rb +21 -0
- data/test/test-formatting.rb +137 -0
- data/test/test-gridlines.rb +15 -0
- data/test/test-hyperlink.rb +67 -0
- data/test/test-image.rb +84 -0
- data/test/test-merge-range.rb +18 -0
- data/test/test-misc.rb +29 -0
- data/test/test-optimize.rb +32 -0
- data/test/test-page-breaks.rb +13 -0
- data/test/test-page-setup.rb +28 -0
- data/test/test-panes.rb +45 -0
- data/test/test-print-area.rb +19 -0
- data/test/test-print-options.rb +61 -0
- data/test/test-print-scale.rb +12 -0
- data/test/test-properties.rb +51 -0
- data/test/test-protect.rb +27 -0
- data/test/test-repeat.rb +23 -0
- data/test/test-row-col-format.rb +35 -0
- data/test/test-set-selection.rb +13 -0
- data/test/test-set-start-page.rb +13 -0
- data/test/test-simple.rb +62 -0
- data/test/test-types.rb +17 -0
- data/test/xlsx-func-testcase.rb +36 -0
- metadata +228 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestGridlines < XlsxWriterTestCase
|
4
|
+
test 'gridlines01' do |wb, t|
|
5
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
6
|
+
ws = wb.add_worksheet
|
7
|
+
|
8
|
+
ws.paper = 9
|
9
|
+
ws.vertical_dpi = 200
|
10
|
+
|
11
|
+
ws.gridlines = XlsxWriter::Worksheet::GRIDLINES_HIDE_ALL
|
12
|
+
|
13
|
+
ws.write_string(0, 'A', 'Foo' , nil)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestHyperlink < XlsxWriterTestCase
|
4
|
+
test 'hyperlink03' do |wb|
|
5
|
+
ws1 = wb.add_worksheet
|
6
|
+
ws2 = wb.add_worksheet
|
7
|
+
|
8
|
+
ws1
|
9
|
+
.write_url(0, 'A', 'http://www.perl.org/')
|
10
|
+
.write_url(3, 'D', 'http://www.perl.org/')
|
11
|
+
.write_url(7, 'A', 'http://www.perl.org/')
|
12
|
+
.write_url(5, 'B', 'http://www.cpan.org/')
|
13
|
+
.write_url(11, 'F', 'http://www.cpan.org/')
|
14
|
+
|
15
|
+
ws2
|
16
|
+
.write_url(1, 'C', 'http://www.google.com/')
|
17
|
+
.write_url(4, 'C', 'http://www.cpan.org/')
|
18
|
+
.write_url(6, 'C', 'http://www.perl.org/')
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'hyperlink05' do |wb|
|
22
|
+
wb.add_worksheet
|
23
|
+
.write_url(0, 'A', 'http://www.perl.org/')
|
24
|
+
.write_url(2, 'A', 'http://www.perl.org/', nil, string: 'Perl home')
|
25
|
+
.write_url(4, 'A', 'http://www.perl.org/', string: 'Perl home', tooltip: 'Tool Tip')
|
26
|
+
.write_url(6, 'A', 'http://www.cpan.org/', string: 'CPAN', tooltip: 'Download')
|
27
|
+
end
|
28
|
+
|
29
|
+
test 'hyperlink09' do |wb|
|
30
|
+
wb.add_worksheet
|
31
|
+
.write_url(0, 'A', 'external:..\\foo.xlsx')
|
32
|
+
.write_url(2, 'A', 'external:..\\foo.xlsx#Sheet1!A1')
|
33
|
+
.write_url(4, 'A', 'external:\\\\VBOXSVR\\share\\foo.xlsx#Sheet1!B2',
|
34
|
+
string: 'J:\\foo.xlsx#Sheet1!B2')
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'hyperlink14' do |wb, t|
|
38
|
+
t.ignore_files = %w(xl/sharedStrings.xml)
|
39
|
+
|
40
|
+
wb.add_format(:f, align: XlsxWriter::Format::ALIGN_CENTER)
|
41
|
+
ws = wb.add_worksheet
|
42
|
+
ws
|
43
|
+
.write_string(0, 0, 'Perl Home', nil)
|
44
|
+
.merge_range(3, 2, 4, 4, 'http://www.perl.org/', :f)
|
45
|
+
.write_url(3, 2, 'http://www.perl.org/', format: :f, string: 'Perl Home')
|
46
|
+
end
|
47
|
+
|
48
|
+
test 'hyperlink18' do |wb|
|
49
|
+
wb.add_worksheet
|
50
|
+
.write_url(0, 0, 'http://google.com/00000000001111111111222222222233333333334444444444555555555566666666666777777777778888888888999999999990000000000111111111122222222223333333333444444444455555555556666666666677777777777888888888899999999999000000000011111111112222222222x')
|
51
|
+
.write_url(0, 0, 'http://google.com/00000000001111111111222222222233333333334444444444555555555566666666666777777777778888888888999999999990000000000111111111122222222223333333333444444444455555555556666666666677777777777888888888899999999999000000000011111111112222222222xy')
|
52
|
+
end
|
53
|
+
|
54
|
+
test 'hyperlink20' do |wb, t|
|
55
|
+
t.ignore_files = %w(xl/styles.xml)
|
56
|
+
|
57
|
+
wb
|
58
|
+
.add_format(:f1, underline: XlsxWriter::Format::UNDERLINE_SINGLE,
|
59
|
+
font_color: XlsxWriter::Format::COLOR_BLUE)
|
60
|
+
.add_format(:f2, underline: XlsxWriter::Format::UNDERLINE_SINGLE,
|
61
|
+
font_color: XlsxWriter::Format::COLOR_RED)
|
62
|
+
.add_worksheet
|
63
|
+
.write_url(0, 0, 'http://www.python.org/1', :f1)
|
64
|
+
.write_url(1, 0, 'http://www.python.org/2', :f2)
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
data/test/test-image.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestImage < XlsxWriterTestCase
|
4
|
+
test 'image01' do |wb|
|
5
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('red.png'), {})
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'image02' do |wb|
|
9
|
+
wb.add_worksheet.insert_image(6, 'D', image_path('yellow.png'), x_offset: 1, y_offset: 2)
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'image03' do |wb|
|
13
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('red.jpg'), {})
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'image04' do |wb|
|
17
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('red.bmp'), {})
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'image05' do |wb|
|
21
|
+
ws = wb.add_worksheet
|
22
|
+
ws.insert_image(0, 'A', image_path('blue.png'), {})
|
23
|
+
ws.insert_image(2, 'B', image_path('red.jpg'), {})
|
24
|
+
ws.insert_image(4, 'D', image_path('yellow.jpg'), {})
|
25
|
+
ws.insert_image(8, 'F', image_path('grey.png'), {})
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'image07' do |wb|
|
29
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('red.png'), {})
|
30
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('yellow.png'), {})
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'image08' do |wb|
|
34
|
+
wb.add_worksheet.insert_image(2, 'B', image_path('grey.png'), scale: 0.5)
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'image09' do |wb|
|
38
|
+
wb.add_worksheet.insert_image(8, 'E', image_path('red_64x20.png'), {})
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'image10' do |wb|
|
42
|
+
wb.add_worksheet.insert_image(1, 'C', image_path('logo.png'), {})
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'image11' do |wb|
|
46
|
+
wb.add_worksheet.insert_image(1, 'C', image_path('logo.png'), x_offset: 8, y_offset: 5)
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'image12' do |wb|
|
50
|
+
ws = wb.add_worksheet
|
51
|
+
ws.set_row(1, height: 75)
|
52
|
+
ws.set_column(2, 2, width: 32)
|
53
|
+
ws.insert_image(1, 'C', image_path('logo.png'), {})
|
54
|
+
end
|
55
|
+
|
56
|
+
test 'image13' do |wb|
|
57
|
+
ws = wb.add_worksheet
|
58
|
+
ws.set_row(1, height: 75)
|
59
|
+
ws.set_column(2, 2, width: 32)
|
60
|
+
ws.insert_image(1, 'C', image_path('logo.png'), x_offset: 8, y_offset: 5)
|
61
|
+
end
|
62
|
+
|
63
|
+
test 'image14' do |wb|
|
64
|
+
ws = wb.add_worksheet
|
65
|
+
ws.set_row(1, height: 4.5)
|
66
|
+
ws.set_row(2, height: 35.25)
|
67
|
+
ws.set_column(2, 4, width: 3.29)
|
68
|
+
ws.set_column(5, 5, width: 10.71)
|
69
|
+
ws.insert_image(1, 'C', image_path('logo.png'), {})
|
70
|
+
end
|
71
|
+
|
72
|
+
test 'image15' do |wb|
|
73
|
+
ws = wb.add_worksheet
|
74
|
+
ws.set_row(1, height: 4.5)
|
75
|
+
ws.set_row(2, height: 35.25)
|
76
|
+
ws.set_column(2, 4, width: 3.29)
|
77
|
+
ws.set_column(5, 5, width: 10.71)
|
78
|
+
ws.insert_image(1, 'C', image_path('logo.png'), x_offset: 13, y_offset: 2)
|
79
|
+
end
|
80
|
+
|
81
|
+
test 'image29' do |wb|
|
82
|
+
wb.add_worksheet.insert_image(0, 10, image_path('red_208.png'), x_offset: -210, y_offset: 1)
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestMergeRange < XlsxWriterTestCase
|
4
|
+
test 'merge_range03' do |wb|
|
5
|
+
wb.add_format(:f, align: XlsxWriter::Format::ALIGN_CENTER)
|
6
|
+
wb.add_worksheet
|
7
|
+
.merge_range(1, 1, 1, 2, 'Foo', :f)
|
8
|
+
.merge_range('D2:E2', 'Foo', :f)
|
9
|
+
.merge_range('F2', 'G2', 'Foo', :f)
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'merge_range05' do |wb|
|
13
|
+
wb.add_format(:f, align: XlsxWriter::Format::ALIGN_CENTER)
|
14
|
+
wb.add_worksheet
|
15
|
+
.merge_range('B2:D2', '', :f)
|
16
|
+
.write_number(1, 1, 123, :f)
|
17
|
+
end
|
18
|
+
end
|
data/test/test-misc.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestMisc < XlsxWriterTestCase
|
4
|
+
test 'tab_color01' do |wb|
|
5
|
+
wb.add_worksheet
|
6
|
+
.write_string(0, 0, 'Foo', nil)
|
7
|
+
.tab_color = XlsxWriter::Format::COLOR_RED
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'firstsheet01' do |wb|
|
11
|
+
wss = 20.times.map { wb.add_worksheet }
|
12
|
+
wss[7].set_first_sheet
|
13
|
+
wss[19].activate
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'hide01' do |wb|
|
17
|
+
wb.add_worksheet
|
18
|
+
wb.add_worksheet.hide
|
19
|
+
wb.add_worksheet
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'gh42_01' do |wb|
|
23
|
+
wb.add_worksheet.write_string(0, 0, "\xe5\x9b\xbe\x14\xe5\x9b\xbe", nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'gh42_02' do |wb|
|
27
|
+
wb.add_worksheet.write_string(0, 0, "\xe5\x9b\xbe\x20\xe5\x9b\xbe", nil)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestOptimize < XlsxWriterTestCase
|
4
|
+
test('optimize01', constant_memory: true) do |wb|
|
5
|
+
wb.add_worksheet
|
6
|
+
.write_string(0, 0, 'Hello', nil)
|
7
|
+
.write_string(0, 0, 'Hello', nil)
|
8
|
+
.write_number(1, 0, 123, nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
test('optimize02', constant_memory: true) do |wb|
|
12
|
+
wb.add_worksheet
|
13
|
+
.write_string(0, 0, 'Hello', nil)
|
14
|
+
.write_number(1, 0, 123, nil)
|
15
|
+
.write_string(0, 'G', 'World', nil)
|
16
|
+
# G1 should be ignored since a later row has already been written.
|
17
|
+
end
|
18
|
+
|
19
|
+
test('optimize06', constant_memory: true) do |wb|
|
20
|
+
ws = wb.add_worksheet
|
21
|
+
ws.write_string(0, 0, '_x0000_', nil)
|
22
|
+
(1..127).each { |i| ws.write_string(i, 0, i.chr, nil) unless i == 34 }
|
23
|
+
end
|
24
|
+
|
25
|
+
test('optimize21', constant_memory: true) do |wb|
|
26
|
+
wb.add_worksheet
|
27
|
+
.write_string(0, 'A', 'Foo', nil)
|
28
|
+
.write_string(2, 'C', ' Foo', nil)
|
29
|
+
.write_string(4, 'E', 'Foo ', nil)
|
30
|
+
.write_string(6, 'A', "\tFoo\t", nil)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestpageBreaks < XlsxWriterTestCase
|
4
|
+
test 'page_breaks06' do |wb, t|
|
5
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
6
|
+
ws = wb.add_worksheet
|
7
|
+
ws.paper = 9
|
8
|
+
ws.vertical_dpi = 200
|
9
|
+
ws.h_pagebreaks = [1, 5, 8, 13]
|
10
|
+
ws.v_pagebreaks = [1, 3, 8]
|
11
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestPageSetup < XlsxWriterTestCase
|
4
|
+
test 'page_view01' do |wb|
|
5
|
+
ws = wb.add_worksheet
|
6
|
+
ws.set_page_view
|
7
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
8
|
+
ws.paper = 9
|
9
|
+
ws.vertical_dpi = 200
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'landscape01' do |wb|
|
13
|
+
ws = wb.add_worksheet
|
14
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
15
|
+
ws.set_landscape
|
16
|
+
ws.paper = 9
|
17
|
+
ws.vertical_dpi = 200
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'print_across01' do |wb, t|
|
21
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins'] }
|
22
|
+
ws = wb.add_worksheet
|
23
|
+
ws.print_across
|
24
|
+
ws.paper = 9
|
25
|
+
ws.vertical_dpi = 200
|
26
|
+
ws.write_string 0, 0, 'Foo', nil
|
27
|
+
end
|
28
|
+
end
|
data/test/test-panes.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestPanes < XlsxWriterTestCase
|
4
|
+
test 'panes01' do |wb|
|
5
|
+
wb.add_worksheet
|
6
|
+
.write_string(0, 'A', 'Foo', nil)
|
7
|
+
.freeze_panes(1, 'A')
|
8
|
+
wb.add_worksheet
|
9
|
+
.write_string(0, 'A', 'Foo', nil)
|
10
|
+
.freeze_panes(2, 'A')
|
11
|
+
wb.add_worksheet
|
12
|
+
.write_string(0, 'A', 'Foo', nil)
|
13
|
+
.freeze_panes(0, 'B')
|
14
|
+
wb.add_worksheet
|
15
|
+
.write_string(0, 'A', 'Foo', nil)
|
16
|
+
.freeze_panes(0, 'C')
|
17
|
+
wb.add_worksheet
|
18
|
+
.write_string(0, 'A', 'Foo', nil)
|
19
|
+
.freeze_panes(1, 'B')
|
20
|
+
wb.add_worksheet
|
21
|
+
.write_string(0, 'A', 'Foo', nil)
|
22
|
+
.freeze_panes(3, 'G')
|
23
|
+
wb.add_worksheet
|
24
|
+
.write_string(0, 'A', 'Foo', nil)
|
25
|
+
.freeze_panes(3, 6, 3, 6, 1)
|
26
|
+
wb.add_worksheet
|
27
|
+
.write_string(0, 'A', 'Foo', nil)
|
28
|
+
.split_panes(15, 0)
|
29
|
+
wb.add_worksheet
|
30
|
+
.write_string(0, 'A', 'Foo', nil)
|
31
|
+
.split_panes(30, 0)
|
32
|
+
wb.add_worksheet
|
33
|
+
.write_string(0, 'A', 'Foo', nil)
|
34
|
+
.split_panes(0, 8.46)
|
35
|
+
wb.add_worksheet
|
36
|
+
.write_string(0, 'A', 'Foo', nil)
|
37
|
+
.split_panes(0, 17.57)
|
38
|
+
wb.add_worksheet
|
39
|
+
.write_string(0, 'A', 'Foo', nil)
|
40
|
+
.split_panes(15, 8.46)
|
41
|
+
wb.add_worksheet
|
42
|
+
.write_string(0, 'A', 'Foo', nil)
|
43
|
+
.split_panes(45, 54.14)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestPrintArea < XlsxWriterTestCase
|
4
|
+
test 'print_area06' do |wb, t|
|
5
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
6
|
+
ws = wb.add_worksheet
|
7
|
+
ws.paper = 9
|
8
|
+
ws.vertical_dpi = 200
|
9
|
+
ws.print_area(0, 'A', 8, 'F')
|
10
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'print_area07' do |wb, t|
|
14
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
15
|
+
ws = wb.add_worksheet
|
16
|
+
ws.print_area('A1:XFD1048576')
|
17
|
+
ws.write_string('A1', 'Foo', nil)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestPrintOptions < XlsxWriterTestCase
|
4
|
+
test 'print_options01' do |wb, t|
|
5
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
6
|
+
ws = wb.add_worksheet
|
7
|
+
ws.paper = 9
|
8
|
+
ws.vertical_dpi = 200
|
9
|
+
ws.gridlines = XlsxWriter::Worksheet::GRIDLINES_SHOW_PRINT
|
10
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'print_options02' do |wb, t|
|
14
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
15
|
+
ws = wb.add_worksheet
|
16
|
+
ws.paper = 9
|
17
|
+
ws.vertical_dpi = 200
|
18
|
+
ws.center_horizontally
|
19
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'print_options03' do |wb, t|
|
23
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
24
|
+
ws = wb.add_worksheet
|
25
|
+
ws.paper = 9
|
26
|
+
ws.vertical_dpi = 200
|
27
|
+
ws.center_vertically
|
28
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'print_options04' do |wb, t|
|
32
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
33
|
+
ws = wb.add_worksheet
|
34
|
+
ws.paper = 9
|
35
|
+
ws.vertical_dpi = 200
|
36
|
+
ws.print_row_col_headers
|
37
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'print_options05' do |wb, t|
|
41
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
42
|
+
ws = wb.add_worksheet
|
43
|
+
ws.paper = 9
|
44
|
+
ws.vertical_dpi = 200
|
45
|
+
ws.gridlines = XlsxWriter::Worksheet::GRIDLINES_SHOW_PRINT
|
46
|
+
ws.center_horizontally
|
47
|
+
ws.center_vertically
|
48
|
+
ws.print_row_col_headers
|
49
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'print_options06' do |wb, t|
|
53
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
54
|
+
ws = wb.add_worksheet
|
55
|
+
ws.paper = 9
|
56
|
+
ws.vertical_dpi = 200
|
57
|
+
ws.print_area(0, 'A', 19, 'G')
|
58
|
+
ws.repeat_rows(0, 0)
|
59
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestPrintScale < XlsxWriterTestCase
|
4
|
+
test 'print_scale01' do |wb, t|
|
5
|
+
t.ignore_elements = { 'xl/worksheets/sheet1.xml' => [ '<pageMargins' ] }
|
6
|
+
ws = wb.add_worksheet
|
7
|
+
ws.print_scale = 75
|
8
|
+
ws.paper = 9
|
9
|
+
ws.vertical_dpi = 200
|
10
|
+
ws.write_string(0, 'A', 'Foo', nil)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative './xlsx-func-testcase'
|
2
|
+
|
3
|
+
class TestProperties < XlsxWriterTestCase
|
4
|
+
test 'properties01' do |wb|
|
5
|
+
wb.properties do |p|
|
6
|
+
p.title = 'This is an example spreadsheet'
|
7
|
+
p.subject = 'With document properties'
|
8
|
+
p.author = 'Someone'
|
9
|
+
p.manager = 'Dr. Heinz Doofenshmirtz'
|
10
|
+
p.company = 'of Wolves'
|
11
|
+
p.category = 'Example spreadsheets'
|
12
|
+
p.keywords = 'Sample, Example, Properties'
|
13
|
+
p.comments = 'Created with Perl and Excel::Writer::XLSX'
|
14
|
+
p.status = 'Quo'
|
15
|
+
end
|
16
|
+
|
17
|
+
wb.add_worksheet do |ws|
|
18
|
+
ws.set_column(0, 0, width: 70)
|
19
|
+
ws.write_string(0, 0, 'Select \'Office Button -> Prepare -> Properties\' to see the file properties.', nil)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'properties02' do |wb|
|
24
|
+
wb.properties.hyperlink_base = 'C:\\'
|
25
|
+
wb.add_worksheet
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'properties04' do |wb|
|
29
|
+
wb.properties['Checked by'] = 'Adam'
|
30
|
+
wb.properties['Date completed'] = Time.new(2016, 12, 12, 23)
|
31
|
+
wb.properties['Document number'] = 12345
|
32
|
+
wb.properties['Reference'] = 1.2345
|
33
|
+
wb.properties['Source'] = true
|
34
|
+
wb.properties['Status'] = false
|
35
|
+
wb.properties['Department'] = 'Finance'
|
36
|
+
wb.properties['Group'] = 1.2345678901234
|
37
|
+
|
38
|
+
wb.add_worksheet do |ws|
|
39
|
+
ws.set_column 0, 0, width: 70
|
40
|
+
ws.write_string 0, 'A', 'Select \'Office Button -> Prepare -> Properties\' to see the file properties.', nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'properties05' do |wb|
|
45
|
+
wb.properties['Location'] = "Caf\xc3\xa9"
|
46
|
+
wb.add_worksheet do |ws|
|
47
|
+
ws.set_column 0, 0, width: 70
|
48
|
+
ws.write_string 0, 'A', 'Select \'Office Button -> Prepare -> Properties\' to see the file properties.', nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|