write_xlsx 0.90.0 → 0.97.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +37 -0
  3. data/README.md +1 -1
  4. data/examples/a_simple.rb +1 -6
  5. data/examples/conditional_format.rb +73 -46
  6. data/examples/demo.rb +1 -7
  7. data/examples/hyperlink1.rb +4 -11
  8. data/lib/write_xlsx/chart.rb +81 -205
  9. data/lib/write_xlsx/chart/axis.rb +2 -2
  10. data/lib/write_xlsx/chart/caption.rb +3 -1
  11. data/lib/write_xlsx/chart/pie.rb +2 -0
  12. data/lib/write_xlsx/chart/series.rb +11 -7
  13. data/lib/write_xlsx/format.rb +15 -11
  14. data/lib/write_xlsx/package/conditional_format.rb +351 -38
  15. data/lib/write_xlsx/package/content_types.rb +10 -0
  16. data/lib/write_xlsx/package/custom.rb +125 -0
  17. data/lib/write_xlsx/package/packager.rb +26 -0
  18. data/lib/write_xlsx/package/styles.rb +53 -21
  19. data/lib/write_xlsx/package/table.rb +11 -4
  20. data/lib/write_xlsx/utility.rb +234 -34
  21. data/lib/write_xlsx/version.rb +1 -1
  22. data/lib/write_xlsx/workbook.rb +88 -1
  23. data/lib/write_xlsx/worksheet.rb +247 -23
  24. data/test/helper.rb +6 -1
  25. data/test/regression/_test_hyperlink31.rb +26 -0
  26. data/test/regression/images/zero_dpi.jpg +0 -0
  27. data/test/regression/test_chart_bar08.rb +3 -0
  28. data/test/regression/test_chart_bar11.rb +3 -0
  29. data/test/regression/test_chart_bar14.rb +3 -0
  30. data/test/regression/test_chart_chartarea05.rb +16 -17
  31. data/test/regression/test_chart_chartarea06.rb +49 -0
  32. data/test/regression/test_chart_data_labels25.rb +61 -0
  33. data/test/regression/test_chart_format26.rb +48 -0
  34. data/test/regression/test_chart_format27.rb +58 -0
  35. data/test/regression/test_chart_format28.rb +52 -0
  36. data/test/regression/test_chart_format29.rb +59 -0
  37. data/test/regression/test_chart_format30.rb +53 -0
  38. data/test/regression/test_chart_format31.rb +60 -0
  39. data/test/regression/test_chart_table03.rb +56 -0
  40. data/test/regression/test_cond_format14.rb +42 -0
  41. data/test/regression/test_cond_format15.rb +53 -0
  42. data/test/regression/test_cond_format16.rb +53 -0
  43. data/test/regression/test_cond_format17.rb +37 -0
  44. data/test/regression/test_cond_format18.rb +136 -0
  45. data/test/regression/test_date_1904_01.rb +1 -1
  46. data/test/regression/test_escapes04.rb +3 -0
  47. data/test/regression/test_escapes05.rb +3 -0
  48. data/test/regression/test_escapes07.rb +3 -0
  49. data/test/regression/test_escapes08.rb +3 -0
  50. data/test/regression/test_hyperlink01.rb +3 -0
  51. data/test/regression/test_hyperlink02.rb +3 -0
  52. data/test/regression/test_hyperlink03.rb +4 -0
  53. data/test/regression/test_hyperlink04.rb +3 -0
  54. data/test/regression/test_hyperlink05.rb +3 -0
  55. data/test/regression/test_hyperlink06.rb +3 -0
  56. data/test/regression/test_hyperlink07.rb +3 -0
  57. data/test/regression/test_hyperlink08.rb +3 -0
  58. data/test/regression/test_hyperlink09.rb +3 -0
  59. data/test/regression/test_hyperlink10.rb +3 -0
  60. data/test/regression/test_hyperlink11.rb +3 -0
  61. data/test/regression/test_hyperlink12.rb +3 -0
  62. data/test/regression/test_hyperlink13.rb +3 -0
  63. data/test/regression/test_hyperlink14.rb +3 -0
  64. data/test/regression/test_hyperlink15.rb +3 -0
  65. data/test/regression/test_hyperlink16.rb +3 -0
  66. data/test/regression/test_hyperlink17.rb +3 -0
  67. data/test/regression/test_hyperlink18.rb +3 -0
  68. data/test/regression/test_hyperlink20.rb +3 -0
  69. data/test/regression/test_hyperlink21.rb +3 -0
  70. data/test/regression/test_hyperlink22.rb +3 -0
  71. data/test/regression/test_hyperlink23.rb +3 -0
  72. data/test/regression/test_hyperlink24.rb +3 -0
  73. data/test/regression/test_hyperlink25.rb +3 -0
  74. data/test/regression/test_hyperlink26.rb +3 -0
  75. data/test/regression/test_hyperlink27.rb +3 -0
  76. data/test/regression/test_hyperlink28.rb +50 -0
  77. data/test/regression/test_hyperlink29.rb +27 -0
  78. data/test/regression/test_hyperlink30.rb +36 -0
  79. data/test/regression/test_image35.rb +26 -0
  80. data/test/regression/test_properties01.rb +1 -4
  81. data/test/regression/test_properties02.rb +1 -4
  82. data/test/regression/test_properties03.rb +26 -0
  83. data/test/regression/test_properties04.rb +61 -0
  84. data/test/regression/test_properties05.rb +30 -0
  85. data/test/regression/test_table03.rb +3 -0
  86. data/test/regression/test_table04.rb +3 -0
  87. data/test/regression/test_table05.rb +3 -0
  88. data/test/regression/test_table06.rb +3 -0
  89. data/test/regression/test_table20.rb +34 -0
  90. data/test/regression/test_table21.rb +36 -0
  91. data/test/regression/test_table22.rb +32 -0
  92. data/test/regression/xlsx_files/chart_chartarea05.xlsx +0 -0
  93. data/test/regression/xlsx_files/chart_chartarea06.xlsx +0 -0
  94. data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
  95. data/test/regression/xlsx_files/chart_format26.xlsx +0 -0
  96. data/test/regression/xlsx_files/chart_format27.xlsx +0 -0
  97. data/test/regression/xlsx_files/chart_format28.xlsx +0 -0
  98. data/test/regression/xlsx_files/chart_format29.xlsx +0 -0
  99. data/test/regression/xlsx_files/chart_format30.xlsx +0 -0
  100. data/test/regression/xlsx_files/chart_format31.xlsx +0 -0
  101. data/test/regression/xlsx_files/chart_table03.xlsx +0 -0
  102. data/test/regression/xlsx_files/cond_format14.xlsx +0 -0
  103. data/test/regression/xlsx_files/cond_format15.xlsx +0 -0
  104. data/test/regression/xlsx_files/cond_format16.xlsx +0 -0
  105. data/test/regression/xlsx_files/cond_format17.xlsx +0 -0
  106. data/test/regression/xlsx_files/cond_format18.xlsx +0 -0
  107. data/test/regression/xlsx_files/date_1904_01.xlsx +0 -0
  108. data/test/regression/xlsx_files/hyperlink28.xlsx +0 -0
  109. data/test/regression/xlsx_files/hyperlink29.xlsx +0 -0
  110. data/test/regression/xlsx_files/hyperlink30.xlsx +0 -0
  111. data/test/regression/xlsx_files/hyperlink31.xlsx +0 -0
  112. data/test/regression/xlsx_files/image35.xlsx +0 -0
  113. data/test/regression/xlsx_files/properties03.xlsx +0 -0
  114. data/test/regression/xlsx_files/properties04.xlsx +0 -0
  115. data/test/regression/xlsx_files/properties05.xlsx +0 -0
  116. data/test/regression/xlsx_files/table21.xlsx +0 -0
  117. data/test/regression/xlsx_files/table22.xlsx +0 -0
  118. data/test/workbook/test_write_workbook_view.rb +81 -0
  119. data/test/worksheet/test_cond_format_22.rb +266 -0
  120. data/test/worksheet/test_cond_format_23.rb +242 -0
  121. data/test/worksheet/test_cond_format_24.rb +303 -0
  122. data/test/worksheet/test_data_bar_01.rb +53 -0
  123. data/test/worksheet/test_data_bar_02.rb +79 -0
  124. data/test/worksheet/test_data_bar_03.rb +147 -0
  125. data/test/worksheet/test_data_bar_04.rb +145 -0
  126. data/test/worksheet/test_data_bar_05.rb +147 -0
  127. data/test/worksheet/test_data_bar_06.rb +145 -0
  128. data/test/worksheet/test_data_bar_07.rb +146 -0
  129. data/test/worksheet/test_data_bar_08.rb +54 -0
  130. data/test/worksheet/test_data_bar_09.rb +80 -0
  131. data/test/worksheet/test_data_bar_10.rb +165 -0
  132. data/test/worksheet/test_data_bar_11.rb +167 -0
  133. data/test/worksheet/test_data_bar_12.rb +104 -0
  134. data/test/worksheet/test_write_data_validation_02.rb +27 -0
  135. metadata +135 -2
@@ -18,7 +18,7 @@ def test_date_1904_01
18
18
 
19
19
  worksheet.set_column('A:A', 12)
20
20
 
21
- worksheet.write_date_time('A1', '1900-01-00T', format)
21
+ worksheet.write_date_time('A1', '1900-01-01T', format)
22
22
  worksheet.write_date_time('A2', '1902-09-26T', format)
23
23
  worksheet.write_date_time('A3', '1913-09-08T', format)
24
24
  worksheet.write_date_time('A4', '1927-05-18T', format)
@@ -15,6 +15,9 @@ def test_escapes04
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'http://www.perl.com/?a=1&b=2')
19
22
 
20
23
  workbook.close
@@ -16,6 +16,9 @@ def test_escapes05
16
16
  worksheet1 = workbook.add_worksheet('Start')
17
17
  worksheet2 = workbook.add_worksheet('A & B')
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet1.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet1.write_url('A1', "internal:'A & B'!A1", 'Jump to A & B')
20
23
 
21
24
  workbook.close
@@ -15,6 +15,9 @@ def test_escapes07
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url(
19
22
  'A1',
20
23
  "http://example.com/!\"$%&'( )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
@@ -15,6 +15,9 @@ def test_escapes08
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  # Test an already escaped string.
19
22
  worksheet.write_url(
20
23
  'A1',
@@ -15,6 +15,9 @@ def test_hyperlink01
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write('A1', 'http://www.perl.org/')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink02
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write('A1', 'http://www.perl.org/')
19
22
  worksheet.write('D4', 'http://www.perl.org/')
20
23
  worksheet.write('A8', 'http://www.perl.org/')
@@ -16,6 +16,10 @@ def test_hyperlink03
16
16
  worksheet1 = workbook.add_worksheet
17
17
  worksheet2 = workbook.add_worksheet
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet1.instance_variable_set(:@default_url_format, nil)
21
+ worksheet2.instance_variable_set(:@default_url_format, nil)
22
+
19
23
  worksheet1.write_url('A1', 'http://www.perl.org/')
20
24
  worksheet1.write_url('D4', 'http://www.perl.org/')
21
25
  worksheet1.write_url('A8', 'http://www.perl.org/')
@@ -17,6 +17,9 @@ def test_hyperlink04
17
17
  worksheet2 = workbook.add_worksheet
18
18
  worksheet3 = workbook.add_worksheet('Data Sheet')
19
19
 
20
+ # Turn off default URL format for testing.
21
+ worksheet1.instance_variable_set(:@default_url_format, nil)
22
+
20
23
  worksheet1.write_url('A1', "internal:Sheet2!A1")
21
24
  worksheet1.write_url('A3', "internal:Sheet2!A1:A5")
22
25
  worksheet1.write_url('A5', "internal:'Data Sheet'!D5", 'Some text')
@@ -15,6 +15,9 @@ def test_hyperlink05
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'http://www.perl.org/')
19
22
  worksheet.write_url('A3', 'http://www.perl.org/', 'Perl home')
20
23
  worksheet.write_url('A5', 'http://www.perl.org/', 'Perl home', nil, 'Tool Tip')
@@ -15,6 +15,9 @@ def test_hyperlink06
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'external:C:\Temp\foo.xlsx')
19
22
  worksheet.write_url('A3', 'external:C:\Temp\foo.xlsx#Sheet1!A1')
20
23
  worksheet.write_url('A5', 'external:C:\Temp\foo.xlsx#Sheet1!A1', 'External', nil, 'Tip')
@@ -11,6 +11,9 @@ def test_hyperlink07
11
11
  workbook = WriteXLSX.new(@io)
12
12
  worksheet = workbook.add_worksheet
13
13
 
14
+ # Turn off default URL format for testing.
15
+ worksheet.instance_variable_set(:@default_url_format, nil)
16
+
14
17
  worksheet.write_url('A1', 'external:\\\\VBOXSVR\share\foo.xlsx', 'J:\foo.xlsx')
15
18
  worksheet.write_url('A3', 'external:foo.xlsx')
16
19
 
@@ -15,6 +15,9 @@ def test_hyperlink08
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'external://VBOXSVR/share/foo.xlsx', 'J:/foo.xlsx')
19
22
  worksheet.write_url('A3', 'external:foo.xlsx')
20
23
 
@@ -15,6 +15,9 @@ def test_hyperlink09
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'external:..\foo.xlsx')
19
22
  worksheet.write_url('A3', 'external:..\foo.xlsx#Sheet1!A1')
20
23
  worksheet.write_url('A5', 'external:\\\\VBOXSVR\share\foo.xlsx#Sheet1!B2', 'J:\foo.xlsx#Sheet1!B2')
@@ -16,6 +16,9 @@ def test_hyperlink10
16
16
  worksheet = workbook.add_worksheet
17
17
  format = workbook.add_format(:color => 'red', :underline => 1)
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet.write_url('A1', 'http://www.perl.org/', format)
20
23
 
21
24
  workbook.close
@@ -16,6 +16,9 @@ def test_hyperlink11
16
16
  worksheet = workbook.add_worksheet
17
17
  format = workbook.add_format(:color => 'blue', :underline => 1)
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet.write_url('A1', 'http://www.perl.org/', format)
20
23
 
21
24
  workbook.close
@@ -16,6 +16,9 @@ def test_hyperlink12
16
16
  worksheet = workbook.add_worksheet
17
17
  format = workbook.add_format(:color => 'blue', :underline => 1)
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet.write_url('A1', 'mailto:jmcnamara@cpan.org', format)
20
23
  worksheet.write_url('A3', 'ftp://perl.org/', format)
21
24
 
@@ -16,6 +16,9 @@ def test_hyperlink13
16
16
  worksheet = workbook.add_worksheet
17
17
  format = workbook.add_format(:align => 'center')
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet.merge_range('C4:E5', 'http://www.perl.org/', format)
20
23
 
21
24
  workbook.close
@@ -16,6 +16,9 @@ def test_hyperlink14
16
16
  worksheet = workbook.add_worksheet
17
17
  format = workbook.add_format(:align => 'center')
18
18
 
19
+ # Turn off default URL format for testing.
20
+ worksheet.instance_variable_set(:@default_url_format, nil)
21
+
19
22
  worksheet.merge_range('C4:E5', 'http://www.perl.org/', format, 'Perl Home')
20
23
 
21
24
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink15
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('B2', 'external:./subdir/blank.xlsx')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink16
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('B2', 'external:./subdir/blank.xlsx')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink17
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  # Test URL with whitespace.
19
22
  worksheet.write_url('A1', 'http://google.com/some link')
20
23
 
@@ -15,6 +15,9 @@ def test_hyperlink18
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  # Test long URL at Excel limit.
19
22
  worksheet.write_url('A1', 'http://google.com/00000000001111111111222222222233333333334444444444555555555566666666666777777777778888888888999999999990000000000111111111122222222223333333333444444444455555555556666666666677777777777888888888899999999999000000000011111111112222222222x')
20
23
 
@@ -19,6 +19,9 @@ def test_hyperlink20
19
19
  format1 = workbook.add_format(:color => 'blue', :underline => 1)
20
20
  format2 = workbook.add_format(:color => 'red', :underline => 1)
21
21
 
22
+ # Turn off default URL format for testing.
23
+ worksheet.instance_variable_set(:@default_url_format, nil)
24
+
22
25
  worksheet.write_url('A1', 'http://www.python.org/1', format1)
23
26
  worksheet.write_url('A2', 'http://www.python.org/2', format2)
24
27
 
@@ -15,6 +15,9 @@ def test_hyperlink21
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'external:C:\Temp\Test 1')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink22
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'external:\\\\Vboxsvr\share\foo bar.xlsx')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink23
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'https://en.wikipedia.org/wiki/Microsoft_Excel#Data_storage_and_communication', 'Display text')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink24
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'http://www.example.com/some_long_url_that_is_255_characters_long_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_z#some_long_location_that_is_255_characters_long_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_abcdefgh_z')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink25
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'http://www.google.com/#foo#bar')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink26
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', 'http://www.google.com/foo#bar#baz')
19
22
 
20
23
  workbook.close
@@ -15,6 +15,9 @@ def test_hyperlink27
15
15
  workbook = WriteXLSX.new(@io)
16
16
  worksheet = workbook.add_worksheet
17
17
 
18
+ # Turn off default URL format for testing.
19
+ worksheet.instance_variable_set(:@default_url_format, nil)
20
+
18
21
  worksheet.write_url('A1', %q(external:\\\\Vboxsvr\share\foo bar.xlsx#'Some Sheet'!A1))
19
22
 
20
23
  workbook.close
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionHyperlink28 < 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_hyperlink28
14
+ @xlsx = 'hyperlink28.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ format = workbook.add_format(:hyperlink => 1)
18
+
19
+ worksheet.write_url('A1', 'http://www.perl.org/', format)
20
+
21
+ workbook.close
22
+
23
+ compare_for_regression
24
+ end
25
+
26
+ def test_hyperlink28_2
27
+ @xlsx = 'hyperlink28.xlsx'
28
+ workbook = WriteXLSX.new(@io)
29
+ worksheet = workbook.add_worksheet
30
+
31
+ worksheet.write_url('A1', 'http://www.perl.org/')
32
+
33
+ workbook.close
34
+
35
+ compare_for_regression
36
+ end
37
+
38
+ def test_hyperlink28_3
39
+ @xlsx = 'hyperlink28.xlsx'
40
+ workbook = WriteXLSX.new(@io)
41
+ worksheet = workbook.add_worksheet
42
+ format = workbook.get_default_url_format
43
+
44
+ worksheet.write_url('A1', 'http://www.perl.org/', format)
45
+
46
+ workbook.close
47
+
48
+ compare_for_regression
49
+ end
50
+ end
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionHyperlink29 < 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_hyperlink29
14
+ @xlsx = 'hyperlink29.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ format1 = workbook.add_format(:hyperlink => 1)
18
+ format2 = workbook.add_format(:color => 'red', :underline => 1)
19
+
20
+ worksheet.write_url('A1', 'http://www.perl.org/', format1)
21
+ worksheet.write_url('A2', 'http://www.perl.com/', format2)
22
+
23
+ workbook.close
24
+
25
+ compare_for_regression
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionHyperlink30 < 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_hyperlink30
14
+ @xlsx = 'hyperlink30.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+
17
+ # Simulate custom color for testing.
18
+ workbook.instance_variable_set(:@custom_colors, ['FF0000FF'])
19
+
20
+ worksheet = workbook.add_worksheet
21
+ format1 = workbook.add_format(:hyperlink => 1)
22
+ format2 = workbook.add_format(:color => 'red', :underline => 1)
23
+ format3 = workbook.add_format(:color => 'blue', :underline => 1)
24
+
25
+ # Turn off default URL format for testing.
26
+ worksheet.instance_variable_set(:@default_url_format, nil)
27
+
28
+ worksheet.write_url('A1', 'http://www.python.org/1', format1)
29
+ worksheet.write_url('A2', 'http://www.python.org/2', format2)
30
+ worksheet.write_url('A3', 'http://www.python.org/3', format3)
31
+
32
+ workbook.close
33
+
34
+ compare_for_regression
35
+ end
36
+ end