write_xlsx 1.02.0 → 1.08.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/Changes +72 -0
  4. data/README.md +1 -1
  5. data/examples/chart_data_labels.rb +320 -0
  6. data/examples/chart_line.rb +85 -10
  7. data/examples/tables.rb +77 -42
  8. data/lib/write_xlsx/chart/line.rb +15 -1
  9. data/lib/write_xlsx/chart/series.rb +100 -0
  10. data/lib/write_xlsx/chart.rb +155 -33
  11. data/lib/write_xlsx/drawing.rb +80 -17
  12. data/lib/write_xlsx/format.rb +5 -5
  13. data/lib/write_xlsx/package/app.rb +3 -3
  14. data/lib/write_xlsx/package/comments.rb +4 -4
  15. data/lib/write_xlsx/package/conditional_format.rb +2 -8
  16. data/lib/write_xlsx/package/packager.rb +1 -0
  17. data/lib/write_xlsx/package/relationships.rb +2 -2
  18. data/lib/write_xlsx/package/styles.rb +42 -11
  19. data/lib/write_xlsx/package/table.rb +16 -7
  20. data/lib/write_xlsx/package/vml.rb +20 -19
  21. data/lib/write_xlsx/sheets.rb +12 -20
  22. data/lib/write_xlsx/utility.rb +9 -3
  23. data/lib/write_xlsx/version.rb +1 -1
  24. data/lib/write_xlsx/workbook.rb +76 -35
  25. data/lib/write_xlsx/worksheet/data_validation.rb +1 -6
  26. data/lib/write_xlsx/worksheet.rb +197 -57
  27. data/test/drawing/{test_write_ext.rb → test_write_xdr_ext.rb} +2 -2
  28. data/test/perl_output/chart_data_labels.xlsx +0 -0
  29. data/test/perl_output/chart_line.xlsx +0 -0
  30. data/test/perl_output/comments2.xlsx +0 -0
  31. data/test/perl_output/tables.xlsx +0 -0
  32. data/test/regression/images/red2.png +0 -0
  33. data/test/regression/test_array_formula04.rb +31 -0
  34. data/test/regression/test_chart_crossing01.rb +1 -1
  35. data/test/regression/test_chart_crossing05.rb +46 -0
  36. data/test/regression/test_chart_crossing06.rb +46 -0
  37. data/test/regression/test_chart_data_labels26.rb +44 -0
  38. data/test/regression/test_chart_data_labels27.rb +44 -0
  39. data/test/regression/test_chart_data_labels28.rb +52 -0
  40. data/test/regression/test_chart_data_labels29.rb +43 -0
  41. data/test/regression/test_chart_data_labels30.rb +46 -0
  42. data/test/regression/test_chart_data_labels31.rb +49 -0
  43. data/test/regression/test_chart_data_labels32.rb +54 -0
  44. data/test/regression/test_chart_data_labels33.rb +52 -0
  45. data/test/regression/test_chart_data_labels34.rb +54 -0
  46. data/test/regression/test_chart_data_labels35.rb +46 -0
  47. data/test/regression/test_chart_data_labels36.rb +54 -0
  48. data/test/regression/test_chart_data_labels37.rb +51 -0
  49. data/test/regression/test_chart_data_labels38.rb +54 -0
  50. data/test/regression/test_chart_data_labels39.rb +53 -0
  51. data/test/regression/test_chart_data_labels40.rb +53 -0
  52. data/test/regression/test_chart_data_labels41.rb +54 -0
  53. data/test/regression/test_chart_data_labels42.rb +58 -0
  54. data/test/regression/test_chart_data_labels43.rb +58 -0
  55. data/test/regression/test_chart_data_labels44.rb +56 -0
  56. data/test/regression/test_chart_data_labels45.rb +57 -0
  57. data/test/regression/test_chart_data_labels46.rb +61 -0
  58. data/test/regression/test_chart_data_labels47.rb +61 -0
  59. data/test/regression/test_chart_data_labels48.rb +55 -0
  60. data/test/regression/test_chart_data_labels49.rb +55 -0
  61. data/test/regression/test_chart_data_labels50.rb +57 -0
  62. data/test/regression/test_chart_line05.rb +43 -0
  63. data/test/regression/test_chart_line06.rb +43 -0
  64. data/test/regression/test_comment15.rb +28 -0
  65. data/test/regression/test_comment16.rb +34 -0
  66. data/test/regression/test_format16.rb +24 -0
  67. data/test/regression/test_format17.rb +24 -0
  68. data/test/regression/test_header04.rb +30 -0
  69. data/test/regression/test_header_image15.rb +36 -0
  70. data/test/regression/test_header_image16.rb +42 -0
  71. data/test/regression/test_header_image17.rb +46 -0
  72. data/test/regression/test_header_image18.rb +48 -0
  73. data/test/regression/test_header_image19.rb +36 -0
  74. data/test/regression/test_hyperlink48.rb +31 -0
  75. data/test/regression/test_hyperlink49.rb +29 -0
  76. data/test/regression/test_hyperlink50.rb +27 -0
  77. data/test/regression/test_hyperlink51.rb +27 -0
  78. data/test/regression/test_ignore_error01.rb +23 -0
  79. data/test/regression/test_ignore_error02.rb +24 -0
  80. data/test/regression/test_ignore_error03.rb +26 -0
  81. data/test/regression/test_ignore_error04.rb +26 -0
  82. data/test/regression/test_ignore_error05.rb +32 -0
  83. data/test/regression/test_ignore_error06.rb +32 -0
  84. data/test/regression/test_image45.rb +2 -1
  85. data/test/regression/test_image46.rb +1 -1
  86. data/test/regression/test_image48.rb +32 -0
  87. data/test/regression/test_image49.rb +38 -0
  88. data/test/regression/test_image50.rb +24 -0
  89. data/test/regression/test_image51.rb +30 -0
  90. data/test/regression/test_image52.rb +26 -0
  91. data/test/regression/test_image53.rb +26 -0
  92. data/test/regression/test_image54.rb +26 -0
  93. data/test/regression/test_image55.rb +27 -0
  94. data/test/regression/test_object_position12.rb +25 -0
  95. data/test/regression/test_object_position13.rb +25 -0
  96. data/test/regression/test_object_position14.rb +25 -0
  97. data/test/regression/test_object_position15.rb +29 -0
  98. data/test/regression/test_object_position16.rb +29 -0
  99. data/test/regression/test_object_position17.rb +29 -0
  100. data/test/regression/test_object_position18.rb +29 -0
  101. data/test/regression/test_object_position19.rb +29 -0
  102. data/test/regression/test_object_position20.rb +29 -0
  103. data/test/regression/test_protect04.rb +32 -0
  104. data/test/regression/test_protect05.rb +35 -0
  105. data/test/regression/test_protect06.rb +35 -0
  106. data/test/regression/test_protect07.rb +23 -0
  107. data/test/regression/test_table24.rb +27 -0
  108. data/test/regression/test_table25.rb +27 -0
  109. data/test/regression/test_table26.rb +38 -0
  110. data/test/regression/xlsx_files/array_formula04.xlsx +0 -0
  111. data/test/regression/xlsx_files/chart_crossing05.xlsx +0 -0
  112. data/test/regression/xlsx_files/chart_crossing06.xlsx +0 -0
  113. data/test/regression/xlsx_files/chart_data_labels26.xlsx +0 -0
  114. data/test/regression/xlsx_files/chart_data_labels27.xlsx +0 -0
  115. data/test/regression/xlsx_files/chart_data_labels28.xlsx +0 -0
  116. data/test/regression/xlsx_files/chart_data_labels29.xlsx +0 -0
  117. data/test/regression/xlsx_files/chart_data_labels30.xlsx +0 -0
  118. data/test/regression/xlsx_files/chart_data_labels31.xlsx +0 -0
  119. data/test/regression/xlsx_files/chart_data_labels32.xlsx +0 -0
  120. data/test/regression/xlsx_files/chart_data_labels33.xlsx +0 -0
  121. data/test/regression/xlsx_files/chart_data_labels34.xlsx +0 -0
  122. data/test/regression/xlsx_files/chart_data_labels35.xlsx +0 -0
  123. data/test/regression/xlsx_files/chart_data_labels36.xlsx +0 -0
  124. data/test/regression/xlsx_files/chart_data_labels37.xlsx +0 -0
  125. data/test/regression/xlsx_files/chart_data_labels38.xlsx +0 -0
  126. data/test/regression/xlsx_files/chart_data_labels39.xlsx +0 -0
  127. data/test/regression/xlsx_files/chart_data_labels40.xlsx +0 -0
  128. data/test/regression/xlsx_files/chart_data_labels41.xlsx +0 -0
  129. data/test/regression/xlsx_files/chart_data_labels42.xlsx +0 -0
  130. data/test/regression/xlsx_files/chart_data_labels43.xlsx +0 -0
  131. data/test/regression/xlsx_files/chart_data_labels44.xlsx +0 -0
  132. data/test/regression/xlsx_files/chart_data_labels45.xlsx +0 -0
  133. data/test/regression/xlsx_files/chart_data_labels46.xlsx +0 -0
  134. data/test/regression/xlsx_files/chart_data_labels47.xlsx +0 -0
  135. data/test/regression/xlsx_files/chart_data_labels48.xlsx +0 -0
  136. data/test/regression/xlsx_files/chart_data_labels49.xlsx +0 -0
  137. data/test/regression/xlsx_files/chart_data_labels50.xlsx +0 -0
  138. data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
  139. data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
  140. data/test/regression/xlsx_files/comment15.xlsx +0 -0
  141. data/test/regression/xlsx_files/comment16.xlsx +0 -0
  142. data/test/regression/xlsx_files/format16.xlsx +0 -0
  143. data/test/regression/xlsx_files/format17.xlsx +0 -0
  144. data/test/regression/xlsx_files/header04.xlsx +0 -0
  145. data/test/regression/xlsx_files/header_image15.xlsx +0 -0
  146. data/test/regression/xlsx_files/header_image16.xlsx +0 -0
  147. data/test/regression/xlsx_files/header_image17.xlsx +0 -0
  148. data/test/regression/xlsx_files/header_image18.xlsx +0 -0
  149. data/test/regression/xlsx_files/header_image19.xlsx +0 -0
  150. data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
  151. data/test/regression/xlsx_files/hyperlink50.xlsx +0 -0
  152. data/test/regression/xlsx_files/hyperlink51.xlsx +0 -0
  153. data/test/regression/xlsx_files/ignore_error01.xlsx +0 -0
  154. data/test/regression/xlsx_files/ignore_error02.xlsx +0 -0
  155. data/test/regression/xlsx_files/ignore_error03.xlsx +0 -0
  156. data/test/regression/xlsx_files/ignore_error04.xlsx +0 -0
  157. data/test/regression/xlsx_files/ignore_error05.xlsx +0 -0
  158. data/test/regression/xlsx_files/ignore_error06.xlsx +0 -0
  159. data/test/regression/xlsx_files/image45.xlsx +0 -0
  160. data/test/regression/xlsx_files/image46.xlsx +0 -0
  161. data/test/regression/xlsx_files/image48.xlsx +0 -0
  162. data/test/regression/xlsx_files/image49.xlsx +0 -0
  163. data/test/regression/xlsx_files/image50.xlsx +0 -0
  164. data/test/regression/xlsx_files/image51.xlsx +0 -0
  165. data/test/regression/xlsx_files/image52.xlsx +0 -0
  166. data/test/regression/xlsx_files/image53.xlsx +0 -0
  167. data/test/regression/xlsx_files/image54.xlsx +0 -0
  168. data/test/regression/xlsx_files/image55.xlsx +0 -0
  169. data/test/regression/xlsx_files/object_position12.xlsx +0 -0
  170. data/test/regression/xlsx_files/object_position13.xlsx +0 -0
  171. data/test/regression/xlsx_files/object_position14.xlsx +0 -0
  172. data/test/regression/xlsx_files/object_position15.xlsx +0 -0
  173. data/test/regression/xlsx_files/object_position16.xlsx +0 -0
  174. data/test/regression/xlsx_files/object_position17.xlsx +0 -0
  175. data/test/regression/xlsx_files/object_position18.xlsx +0 -0
  176. data/test/regression/xlsx_files/object_position19.xlsx +0 -0
  177. data/test/regression/xlsx_files/object_position20.xlsx +0 -0
  178. data/test/regression/xlsx_files/protect04.xlsx +0 -0
  179. data/test/regression/xlsx_files/protect05.xlsx +0 -0
  180. data/test/regression/xlsx_files/protect06.xlsx +0 -0
  181. data/test/regression/xlsx_files/protect07.xlsx +0 -0
  182. data/test/regression/xlsx_files/table24.xlsx +0 -0
  183. data/test/regression/xlsx_files/table25.xlsx +0 -0
  184. data/test/regression/xlsx_files/table26.xlsx +0 -0
  185. data/test/test_example_match.rb +433 -10
  186. data/test/utility/test_range.rb +20 -0
  187. data/test/workbook/test_check_sheetname.rb +0 -10
  188. data/write_xlsx.gemspec +1 -0
  189. metadata +323 -8
@@ -17,7 +17,8 @@ class TestRegressionImage45 < Minitest::Test
17
17
 
18
18
  worksheet.insert_image(
19
19
  'E9',
20
- File.join(@test_dir, 'regression', 'images/red.png')
20
+ File.join(@test_dir, 'regression', 'images/red.png'),
21
+ :object_position => 4
21
22
  )
22
23
 
23
24
  worksheet.set_row(8, 30, nil, 1)
@@ -18,7 +18,7 @@ class TestRegressionImage46 < Minitest::Test
18
18
  worksheet.insert_image(
19
19
  'E9',
20
20
  File.join(@test_dir, 'regression', 'images/red.png'),
21
- 0, 4
21
+ :object_position => 4, :y_offset => 4
22
22
  )
23
23
 
24
24
  worksheet.set_row(8, 30, nil, 1)
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage48 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image48
14
+ @xlsx = 'image48.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet1 = workbook.add_worksheet
17
+ worksheet2 = workbook.add_worksheet
18
+
19
+ worksheet1.insert_image(
20
+ 'E9',
21
+ File.join(@test_dir, 'regression', 'images/red.png')
22
+ )
23
+
24
+ worksheet2.insert_image(
25
+ 'E9',
26
+ File.join(@test_dir, 'regression', 'images/red.png')
27
+ )
28
+
29
+ workbook.close
30
+ compare_for_regression
31
+ end
32
+ end
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage49 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image49
14
+ @xlsx = 'image49.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet1 = workbook.add_worksheet
17
+ worksheet2 = workbook.add_worksheet
18
+ worksheet3 = workbook.add_worksheet
19
+
20
+ worksheet1.insert_image('A1', 'test/regression/images/blue.png')
21
+ worksheet1.insert_image('B3', 'test/regression/images/red.jpg')
22
+ worksheet1.insert_image('D5', 'test/regression/images/yellow.jpg')
23
+ worksheet1.insert_image('F9', 'test/regression/images/grey.png')
24
+
25
+ worksheet2.insert_image('A1', 'test/regression/images/blue.png')
26
+ worksheet2.insert_image('B3', 'test/regression/images/red.jpg')
27
+ worksheet2.insert_image('D5', 'test/regression/images/yellow.jpg')
28
+ worksheet2.insert_image('F9', 'test/regression/images/grey.png')
29
+
30
+ worksheet3.insert_image('A1', 'test/regression/images/blue.png')
31
+ worksheet3.insert_image('B3', 'test/regression/images/red.jpg')
32
+ worksheet3.insert_image('D5', 'test/regression/images/yellow.jpg')
33
+ worksheet3.insert_image('F9', 'test/regression/images/grey.png')
34
+
35
+ workbook.close
36
+ compare_for_regression
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage50 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image50
14
+ @xlsx = 'image50.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image('E9', 'test/regression/images/red.png')
19
+ worksheet.insert_image('E13', 'test/regression/images/red.png')
20
+
21
+ workbook.close
22
+ compare_for_regression
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage51 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image51
14
+ @xlsx = 'image51.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image(
19
+ 'E9', 'test/regression/images/red.png',
20
+ :url => 'https://duckduckgo.com/?q=1'
21
+ )
22
+ worksheet.insert_image(
23
+ 'E13', 'test/regression/images/red2.png',
24
+ :url => 'https://duckduckgo.com/?q=2'
25
+ )
26
+
27
+ workbook.close
28
+ compare_for_regression
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage52 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image52
14
+ @xlsx = 'image52.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image(
19
+ 'E9', 'test/regression/images/red.png',
20
+ :description => 'This is some alternative text'
21
+ )
22
+
23
+ workbook.close
24
+ compare_for_regression
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage53 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image53
14
+ @xlsx = 'image53.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image(
19
+ 'E9', 'test/regression/images/red.png',
20
+ :description => ''
21
+ )
22
+
23
+ workbook.close
24
+ compare_for_regression
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage54 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image54
14
+ @xlsx = 'image54.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image(
19
+ 'E9', 'test/regression/images/red.png',
20
+ :decorative => 1
21
+ )
22
+
23
+ workbook.close
24
+ compare_for_regression
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionImage55 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_image55
14
+ @xlsx = 'image55.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.insert_image(
19
+ 'E9', 'test/regression/images/red.png',
20
+ :url => 'https://github.com/jmcnamara',
21
+ :decorative => 1
22
+ )
23
+
24
+ workbook.close
25
+ compare_for_regression
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition12 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position12
14
+ @xlsx = 'object_position12.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil)
19
+
20
+ worksheet.insert_image('E9', 'test/regression/images/red.png')
21
+
22
+ workbook.close
23
+ compare_for_regression
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition13 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position13
14
+ @xlsx = 'object_position13.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, nil, nil, 1)
19
+
20
+ worksheet.insert_image('E9', 'test/regression/images/red.png')
21
+
22
+ workbook.close
23
+ compare_for_regression
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition14 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position14
14
+ @xlsx = 'object_position14.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil, 1)
19
+
20
+ worksheet.insert_image('E9', 'test/regression/images/red.png')
21
+
22
+ workbook.close
23
+ compare_for_regression
24
+ end
25
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition15 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position15
14
+ @xlsx = 'object_position15.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil)
19
+
20
+ # Same as testcase test_object_position12 except with an offset.
21
+ worksheet.insert_image(
22
+ 'A9', 'test/regression/images/red.png',
23
+ :x_offset => 232
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition16 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position16
14
+ @xlsx = 'object_position16.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, nil, nil, 1)
19
+
20
+ # Same as testcase test_object_position13 except with an offset.
21
+ worksheet.insert_image(
22
+ 'A9', 'test/regression/images/red.png',
23
+ :x_offset => 192
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition17 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position17
14
+ @xlsx = 'object_position17.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil, 1)
19
+
20
+ # Same as testcase test_object_position14 except with an offset.
21
+ worksheet.insert_image(
22
+ 'A9', 'test/regression/images/red.png',
23
+ :x_offset => 192
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition18 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position18
14
+ @xlsx = 'object_position18.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil)
19
+
20
+ # Same as testcase test_object_position12 except with an offset.
21
+ worksheet.insert_image(
22
+ 'B9', 'test/regression/images/red.png',
23
+ :x_offset => 168
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition19 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position19
14
+ @xlsx = 'object_position19.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, nil, nil, 1)
19
+
20
+ # Same as testcase test_object_position13 except with an offset.
21
+ worksheet.insert_image(
22
+ 'B9', 'test/regression/images/red.png',
23
+ :x_offset => 128
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionObjectPosition20 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_object_position20
14
+ @xlsx = 'object_position20.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.set_column(1, 1, 5, nil, 1)
19
+
20
+ # Same as testcase test_object_position14 except with an offset.
21
+ worksheet.insert_image(
22
+ 'B9', 'test/regression/images/red.png',
23
+ :x_offset => 128
24
+ )
25
+
26
+ workbook.close
27
+ compare_for_regression
28
+ end
29
+ end
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionProtect04 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_protect04
14
+ @xlsx = 'protect04.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ unlocked = workbook.add_format(:locked => 0, :hidden => 0)
19
+ hidden = workbook.add_format(:locked => 0, :hidden => 1)
20
+
21
+ worksheet.protect
22
+
23
+ worksheet.unprotect_range('A1')
24
+
25
+ worksheet.write('A1', 1)
26
+ worksheet.write('A2', 2, unlocked)
27
+ worksheet.write('A3', 3, hidden)
28
+
29
+ workbook.close
30
+ compare_for_regression
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionProtect05 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_protect05
14
+ @xlsx = 'protect05.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ unlocked = workbook.add_format(:locked => 0, :hidden => 0)
19
+ hidden = workbook.add_format(:locked => 0, :hidden => 1)
20
+
21
+ worksheet.protect
22
+
23
+ worksheet.unprotect_range('A1')
24
+ worksheet.unprotect_range('$C$1:$C$3')
25
+ worksheet.unprotect_range('G4:I6', 'MyRange')
26
+ worksheet.unprotect_range('K7')
27
+
28
+ worksheet.write('A1', 1)
29
+ worksheet.write('A2', 2, unlocked)
30
+ worksheet.write('A3', 3, hidden)
31
+
32
+ workbook.close
33
+ compare_for_regression
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionProtect06 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_protect06
14
+ @xlsx = 'protect06.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ unlocked = workbook.add_format(:locked => 0, :hidden => 0)
19
+ hidden = workbook.add_format(:locked => 0, :hidden => 1)
20
+
21
+ worksheet.protect
22
+
23
+ worksheet.unprotect_range('A1', nil, 'password')
24
+ worksheet.unprotect_range('C1:C3')
25
+ worksheet.unprotect_range('G4:I6', 'MyRange')
26
+ worksheet.unprotect_range('K7', nil, 'foobar')
27
+
28
+ worksheet.write('A1', 1)
29
+ worksheet.write('A2', 2, unlocked)
30
+ worksheet.write('A3', 3, hidden)
31
+
32
+ workbook.close
33
+ compare_for_regression
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionProtect07 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true)
11
+ end
12
+
13
+ def test_protect07
14
+ @xlsx = 'protect07.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ workbook.read_only_recommended
19
+
20
+ workbook.close
21
+ compare_for_regression
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionTable24 < Minitest::Test
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ @tempfile.close(true) if @tempfile
11
+ end
12
+
13
+ def test_table24
14
+ @xlsx = 'table24.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ # Set the column width to match the target worksheet.
19
+ worksheet.set_column('C:F', 10.288)
20
+
21
+ # Add the table.
22
+ worksheet.add_table('C3:F13', {:style => 'Table Style Medium 10'})
23
+
24
+ workbook.close
25
+ compare_for_regression
26
+ end
27
+ end