writeexcel 1.0.4 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +8 -0
  3. data/README.rdoc +9 -1
  4. data/examples/a_simple.rb +0 -1
  5. data/examples/chart_area.rb +0 -1
  6. data/examples/chart_legend.rb +0 -1
  7. data/examples/copyformat.rb +0 -1
  8. data/examples/data_validate.rb +1 -2
  9. data/examples/date_time.rb +0 -1
  10. data/examples/demo.rb +0 -1
  11. data/examples/diag_border.rb +0 -1
  12. data/examples/formats.rb +0 -1
  13. data/examples/header.rb +0 -1
  14. data/examples/hide_sheet.rb +0 -1
  15. data/examples/hyperlink.rb +0 -1
  16. data/examples/hyperlink2.rb +0 -1
  17. data/examples/images.rb +0 -1
  18. data/examples/merge1.rb +0 -1
  19. data/examples/merge2.rb +0 -1
  20. data/examples/merge3.rb +0 -1
  21. data/examples/merge4.rb +0 -1
  22. data/examples/merge5.rb +0 -1
  23. data/examples/password_protection.rb +0 -1
  24. data/examples/properties.rb +0 -1
  25. data/examples/properties_jp.rb +0 -1
  26. data/examples/protection.rb +0 -1
  27. data/examples/regions.rb +0 -1
  28. data/examples/repeat.rb +0 -1
  29. data/examples/set_first_sheet.rb +0 -1
  30. data/examples/stocks.rb +0 -1
  31. data/examples/store_formula.rb +0 -1
  32. data/examples/tab_colors.rb +0 -1
  33. data/examples/write_arrays.rb +0 -1
  34. data/lib/writeexcel/biffwriter.rb +2 -1
  35. data/lib/writeexcel/chart.rb +2 -3
  36. data/lib/writeexcel/charts/area.rb +1 -1
  37. data/lib/writeexcel/charts/pie.rb +1 -1
  38. data/lib/writeexcel/charts/scatter.rb +1 -1
  39. data/lib/writeexcel/charts/stock.rb +1 -1
  40. data/lib/writeexcel/col_info.rb +2 -2
  41. data/lib/writeexcel/comments.rb +1 -1
  42. data/lib/writeexcel/convert_date_time.rb +7 -7
  43. data/lib/writeexcel/excelformulaparser.rb +49 -49
  44. data/lib/writeexcel/format.rb +1 -1
  45. data/lib/writeexcel/formula.rb +2 -6
  46. data/lib/writeexcel/helper.rb +3 -3
  47. data/lib/writeexcel/properties.rb +1 -1
  48. data/lib/writeexcel/shared_string_table.rb +5 -5
  49. data/lib/writeexcel/storage_lite.rb +2 -9
  50. data/lib/writeexcel/version.rb +1 -1
  51. data/lib/writeexcel/workbook.rb +13 -14
  52. data/lib/writeexcel/worksheet.rb +43 -35
  53. data/test/helper.rb +12 -5
  54. data/test/test_00_IEEE_double.rb +1 -1
  55. data/test/test_04_dimensions.rb +2 -2
  56. data/test/test_05_rows.rb +1 -1
  57. data/test/test_06_extsst.rb +1 -1
  58. data/test/test_11_date_time.rb +1 -1
  59. data/test/test_12_date_only.rb +1 -1
  60. data/test/test_13_date_seconds.rb +1 -1
  61. data/test/test_21_escher.rb +1 -1
  62. data/test/test_22_mso_drawing_group.rb +1 -1
  63. data/test/test_23_note.rb +1 -1
  64. data/test/test_24_txo.rb +1 -1
  65. data/test/test_25_position_object.rb +1 -1
  66. data/test/test_26_autofilter.rb +1 -1
  67. data/test/test_27_autofilter.rb +1 -1
  68. data/test/test_28_autofilter.rb +1 -1
  69. data/test/test_29_process_jpg.rb +1 -43
  70. data/test/test_30_validation_dval.rb +1 -1
  71. data/test/test_31_validation_dv_strings.rb +1 -1
  72. data/test/test_32_validation_dv_formula.rb +1 -1
  73. data/test/test_40_property_types.rb +1 -1
  74. data/test/test_41_properties.rb +1 -1
  75. data/test/test_42_set_properties.rb +2 -2
  76. data/test/test_50_name_stored.rb +1 -9
  77. data/test/test_51_name_print_area.rb +3 -13
  78. data/test/test_52_name_print_titles.rb +3 -21
  79. data/test/test_53_autofilter.rb +1 -5
  80. data/test/test_60_chart_generic.rb +3 -3
  81. data/test/test_61_chart_subclasses.rb +2 -1
  82. data/test/test_62_chart_formats.rb +9 -21
  83. data/test/test_63_chart_area_formats.rb +1 -1
  84. data/test/test_compatibility.rb +1 -1
  85. data/test/test_example_match.rb +835 -835
  86. data/test/test_format.rb +1 -114
  87. data/test/test_formula.rb +1 -1
  88. data/test/test_properties.rb +1 -2
  89. data/test/test_storage_lite.rb +2 -2
  90. data/test/test_workbook.rb +1 -66
  91. data/test/test_worksheet.rb +1 -18
  92. data/test/test_write_formula_does_not_change_formula_string.rb +1 -1
  93. data/writeexcel.gemspec +4 -1
  94. metadata +38 -19
  95. data/test/test_01_add_worksheet.rb +0 -43
  96. data/test/test_02_merge_formats.rb +0 -49
  97. data/test/test_biff.rb +0 -71
  98. data/test/test_big_workbook.rb +0 -17
  99. data/test/test_ole.rb +0 -102
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cebe8b5ad6954bc1738d77487b127646a56d64e7
4
- data.tar.gz: 2a2f56b156a5509f8a4f2908da8add9882c1f3a6
2
+ SHA256:
3
+ metadata.gz: aef741d4929e644f22197dc922a779d1049e686bcda4458f8fdd07a1dc6d45a0
4
+ data.tar.gz: 7431195b6609b5220f0a72cab8df664594c2ad1a1f2124187fe13515c2dd9d16
5
5
  SHA512:
6
- metadata.gz: d4605d345ef34c4cd5dc42723e68fc81fd5c83d0abf8ae010b14a543dcb0ab1b43a5ecae351c912a49007766ab49c9feb4fb0fc2ac9fc09cf3c6b13b2ea39151
7
- data.tar.gz: e288110b5d45e81b4b38a095d48189b6e87b1384552b9dc9b4d15bede0d72c64adead6ba2f0dab29bffdf9bde6e26bc55e7825769aa9cf05d93bde8f77d188f7
6
+ metadata.gz: ced7ba9cea632a819acd69fd242a03939abd331eca99f3ff2604ea8429998fd467ee795bbbbef5a6ce1b3f66ed970b57583f6d0c85f9aefc311247aaba39c5ae
7
+ data.tar.gz: 38955288d47faa5dc1ec3b8aad5960b0bcac352b61c8503b975eb1c0446ae41785a306b84952797883621cc38f241a9e3343b364f5b8060abee869221fbff1aa
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.1.2
6
+ - 2.1.1
7
+ - 2.0.0
8
+ - 1.9.3
data/README.rdoc CHANGED
@@ -3,6 +3,7 @@
3
3
  Write to a cross-platform Excel binary file.
4
4
 
5
5
  {<img src="https://badge.fury.io/rb/writeexcel.png" alt="Gem Version" />}[http://badge.fury.io/rb/writeexcel]
6
+ {<img src="https://travis-ci.org/cxn03651/writeexcel.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/cxn03651/writeexcel]
6
7
 
7
8
  == Description
8
9
 
@@ -84,6 +85,13 @@ Example Code:
84
85
  * and ......
85
86
 
86
87
  == Recent Change
88
+ v1.0.6
89
+ * support Ruby 3.2
90
+ * use minitest gem instead of test-unit.
91
+
92
+ v1.0.5
93
+ * use test-unit gem instead of test/unit.
94
+
87
95
  v1.0.4
88
96
  * put formula parsers classes in a module to avoid namespace conflicts. (thanks Kevin)
89
97
 
@@ -105,7 +113,7 @@ v1.0.0
105
113
  Original was written in Perl by John McNamara (jmcnamara@cpan.org).
106
114
 
107
115
  Convert to ruby by Hideo Nakamura (cxn03651@msj.biglobe.ne.jp)
108
- Copyright (c) 2009-2013 Hideo NAKAMURA. See LICENSE.txt for details.
116
+ Copyright (c) 2009-2014 Hideo NAKAMURA. See LICENSE.txt for details.
109
117
 
110
118
  == License
111
119
 
data/examples/a_simple.rb CHANGED
@@ -9,7 +9,6 @@
9
9
  # original written in Perl by John McNamara
10
10
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
11
  #
12
- require 'rubygems'
13
12
  require 'writeexcel'
14
13
 
15
14
  # Create a new workbook called simple.xls and add a worksheet
@@ -10,7 +10,6 @@
10
10
  # original written in Perl by John McNamara
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
- require 'rubygems'
14
13
  require 'writeexcel'
15
14
 
16
15
  # Create a new workbook called simple.xls and add a worksheet
@@ -7,7 +7,6 @@
7
7
  #
8
8
  # copyright 2013 Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
9
9
  #
10
- require 'rubygems'
11
10
  require 'writeexcel'
12
11
 
13
12
  # Create a new workbook called chart_legend.xls and add a worksheet
@@ -9,7 +9,6 @@
9
9
  # original written in Perl by John McNamara
10
10
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
11
  #
12
- require 'rubygems'
13
12
  require 'writeexcel'
14
13
 
15
14
  # Create workbook1
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  workbook = WriteExcel.new('data_validate.xls')
@@ -152,7 +151,7 @@ worksheet.write(row, 0, txt)
152
151
  worksheet.data_validation(row, 1,
153
152
  {
154
153
  :validate => 'list',
155
- :source => '=E4:G4'
154
+ :source => '=$E$4:$G$4'
156
155
  })
157
156
 
158
157
 
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  # Create a new workbook and add a worksheet
data/examples/demo.rb CHANGED
@@ -13,7 +13,6 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'rubygems'
17
16
  require 'writeexcel'
18
17
 
19
18
  # $debug = true
@@ -13,7 +13,6 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'rubygems'
17
16
  require 'writeexcel'
18
17
 
19
18
  workbook = WriteExcel.new('diag_border.xls')
data/examples/formats.rb CHANGED
@@ -11,7 +11,6 @@
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
13
 
14
- require 'rubygems'
15
14
  require 'writeexcel'
16
15
 
17
16
 
data/examples/header.rb CHANGED
@@ -38,7 +38,6 @@
38
38
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
39
39
  #
40
40
 
41
- require 'rubygems'
42
41
  require 'writeexcel'
43
42
 
44
43
  workbook = WriteExcel.new("headers.xls")
@@ -10,7 +10,6 @@
10
10
  # original written in Perl by John McNamara
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
- require 'rubygems'
14
13
  require 'writeexcel'
15
14
 
16
15
 
@@ -11,7 +11,6 @@
11
11
  # original written in Perl by John McNamara
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
- require 'rubygems'
15
14
  require 'writeexcel'
16
15
 
17
16
  # Create a new workbook and add a worksheet
@@ -20,7 +20,6 @@
20
20
  # original written in Perl by John McNamara
21
21
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
22
22
  #
23
- require 'rubygems'
24
23
  require 'writeexcel'
25
24
 
26
25
  # Create three workbooks:
data/examples/images.rb CHANGED
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  # Create a new workbook called simple.xls and add a worksheet
data/examples/merge1.rb CHANGED
@@ -15,7 +15,6 @@
15
15
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
16
16
  #
17
17
 
18
- require 'rubygems'
19
18
  require 'writeexcel'
20
19
 
21
20
  # Create a new workbook and add a worksheet
data/examples/merge2.rb CHANGED
@@ -15,7 +15,6 @@
15
15
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
16
16
  #
17
17
 
18
- require 'rubygems'
19
18
  require 'writeexcel'
20
19
 
21
20
  # Create a new workbook and add a worksheet
data/examples/merge3.rb CHANGED
@@ -13,7 +13,6 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'rubygems'
17
16
  require 'writeexcel'
18
17
 
19
18
  # Create a new workbook and add a worksheet
data/examples/merge4.rb CHANGED
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  # Create a new workbook and add a worksheet
data/examples/merge5.rb CHANGED
@@ -13,7 +13,6 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'rubygems'
17
16
  require 'writeexcel'
18
17
 
19
18
  # Create a new workbook and add a worksheet
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'writeexcel'
3
2
 
4
3
  workbook = WriteExcel.new('password_protection.xls')
@@ -10,7 +10,6 @@
10
10
  # original written in Perl by John McNamara
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
- require 'rubygems'
14
13
  require 'writeexcel'
15
14
 
16
15
  workbook = WriteExcel.new('properties.xls')
@@ -10,7 +10,6 @@
10
10
  # original written in Perl by John McNamara
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
- require 'rubygems'
14
13
  require 'writeexcel'
15
14
 
16
15
  workbook = WriteExcel.new('properties_jp.xls')
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  workbook = WriteExcel.new("protection.xls")
data/examples/regions.rb CHANGED
@@ -12,7 +12,6 @@
12
12
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
13
  #
14
14
 
15
- require 'rubygems'
16
15
  require 'writeexcel'
17
16
 
18
17
  workbook = WriteExcel.new("regions.xls")
data/examples/repeat.rb CHANGED
@@ -11,7 +11,6 @@
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
13
 
14
- require 'rubygems'
15
14
  require 'writeexcel'
16
15
 
17
16
  workbook = WriteExcel.new("repeat.xls")
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- coding:utf-8 -*-
3
3
 
4
- require 'rubygems'
5
4
  require 'writeexcel'
6
5
 
7
6
  workbook = WriteExcel.new('set_first_sheet.xls')
data/examples/stocks.rb CHANGED
@@ -14,7 +14,6 @@
14
14
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
15
15
  #
16
16
 
17
- require 'rubygems'
18
17
  require 'writeexcel'
19
18
 
20
19
  # Create a new workbook and add a worksheet
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
3
  require 'writeexcel'
5
4
 
6
5
  # Create a new workbook called simple.xls and add a worksheet
@@ -11,7 +11,6 @@
11
11
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
12
  #
13
13
 
14
- require 'rubygems'
15
14
  require 'writeexcel'
16
15
 
17
16
  workbook = WriteExcel.new('tab_colors.xls')
@@ -6,7 +6,6 @@
6
6
  # Example of how to use the WriteExcel module to
7
7
  # write 1D and 2D arrays of data.
8
8
  #
9
- require 'rubygems'
10
9
  require 'writeexcel'
11
10
 
12
11
  workbook = WriteExcel.new("write_arrays.xls")
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # BIFFwriter - An abstract base class for Excel workbooks and worksheets.
4
5
  #
@@ -187,7 +188,7 @@ class BIFFWriter < WriteFile #:nodoc:
187
188
  # The header contains version and instance info packed into 2 bytes.
188
189
  header = version | (instance << 4)
189
190
 
190
- record = [header, type, length].pack('vvV') + data
191
+ [header, type, length].pack('vvV') + data
191
192
  end
192
193
 
193
194
  def not_using_tmpfile
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  ###############################################################################
3
4
  #
4
5
  # Chart - A writer class for Excel Charts.
@@ -649,8 +650,6 @@ class Chart < Worksheet
649
650
  # information required for _store_series() and the SERIES record.
650
651
  #
651
652
  def parse_series_formula(formula) # :nodoc:
652
- encoding = 0
653
- length = 0
654
653
  count = 0
655
654
  tokens = []
656
655
 
@@ -677,7 +676,7 @@ class Chart < Worksheet
677
676
 
678
677
  # Extract the range from the parse formula.
679
678
  if formula.ord == 0x3B
680
- ptg, ext_ref, row_1, row_2, col_1, col_2 = formula.unpack('Cv5')
679
+ row_1, row_2 = formula.unpack('Cv5')[2, 2]
681
680
 
682
681
  # TODO. Remove high bit on relative references.
683
682
  count = row_2 - row_1 + 1
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -13,7 +13,7 @@
13
13
  # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
14
  #
15
15
 
16
- require 'writeexcel'
16
+ require 'writeexcel/chart'
17
17
 
18
18
  module Writeexcel
19
19
 
@@ -54,9 +54,9 @@ class Worksheet < BIFFWriter
54
54
 
55
55
  def ixfe
56
56
  if @format && @format.respond_to?(:xf_index)
57
- ixfe = @format.xf_index
57
+ @format.xf_index
58
58
  else
59
- ixfe = 0x0F
59
+ 0x0F
60
60
  end
61
61
  end
62
62
 
@@ -252,7 +252,7 @@ class Worksheet < BIFFWriter
252
252
  when 65533 then 65529
253
253
  when 65534 then 65530
254
254
  when 65535 then 65531
255
- else @row -1
255
+ else @row - 1
256
256
  end
257
257
  end
258
258
 
@@ -81,7 +81,7 @@ module ConvertDateTime
81
81
  epoch = date_1904 ? 1904 : 1900
82
82
  offset = date_1904 ? 4 : 0
83
83
  norm = 300
84
- range = year -epoch
84
+ range = year - epoch
85
85
 
86
86
  # Set month days and check for leap year.
87
87
  mdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
@@ -92,15 +92,15 @@ module ConvertDateTime
92
92
  # Some boundary checks
93
93
  return nil if year < epoch or year > 9999
94
94
  return nil if month < 1 or month > 12
95
- return nil if day < 1 or day > mdays[month -1]
95
+ return nil if day < 1 or day > mdays[month - 1]
96
96
 
97
97
  # Accumulate the number of days since the epoch.
98
98
  days = mdays[0, month - 1].inject(day) {|result, mday| result + mday} # days from 1, Jan
99
- days += range *365 # Add days for past years
100
- days += ((range) / 4) # Add leapdays
101
- days -= ((range + offset) /100) # Subtract 100 year leapdays
102
- days += ((range + offset + norm)/400) # Add 400 year leapdays
103
- days -= leap # Already counted above
99
+ days += range * 365 # Add days for past years
100
+ days += ((range) / 4) # Add leapdays
101
+ days -= ((range + offset) / 100) # Subtract 100 year leapdays
102
+ days += ((range + offset + norm) / 400) # Add 400 year leapdays
103
+ days -= leap # Already counted above
104
104
 
105
105
  # Adjust for Excel erroneously treating 1900 as a leap year.
106
106
  days += 1 if !date_1904 and days > 59