writeexcel 0.6.9 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/README.rdoc +2 -0
  2. data/VERSION +1 -1
  3. data/lib/writeexcel/biffwriter.rb +29 -43
  4. data/lib/writeexcel/cell_range.rb +332 -0
  5. data/lib/writeexcel/chart.rb +50 -51
  6. data/lib/writeexcel/col_info.rb +87 -0
  7. data/lib/writeexcel/comments.rb +456 -0
  8. data/lib/writeexcel/convert_date_time.rb +117 -0
  9. data/lib/writeexcel/data_validations.rb +370 -0
  10. data/lib/writeexcel/debug_info.rb +5 -1
  11. data/lib/writeexcel/embedded_chart.rb +35 -0
  12. data/lib/writeexcel/format.rb +1 -1
  13. data/lib/writeexcel/formula.rb +3 -3
  14. data/lib/writeexcel/helper.rb +3 -0
  15. data/lib/writeexcel/image.rb +61 -1
  16. data/lib/writeexcel/olewriter.rb +2 -8
  17. data/lib/writeexcel/outline.rb +24 -0
  18. data/lib/writeexcel/shared_string_table.rb +153 -0
  19. data/lib/writeexcel/workbook.rb +86 -444
  20. data/lib/writeexcel/worksheet.rb +693 -2029
  21. data/lib/writeexcel/worksheets.rb +25 -0
  22. data/lib/writeexcel/write_file.rb +34 -15
  23. data/test/test_02_merge_formats.rb +0 -4
  24. data/test/test_04_dimensions.rb +0 -4
  25. data/test/test_05_rows.rb +0 -4
  26. data/test/test_06_extsst.rb +3 -6
  27. data/test/test_11_date_time.rb +0 -4
  28. data/test/test_12_date_only.rb +262 -231
  29. data/test/test_13_date_seconds.rb +0 -4
  30. data/test/test_21_escher.rb +71 -84
  31. data/test/test_22_mso_drawing_group.rb +0 -4
  32. data/test/test_23_note.rb +5 -21
  33. data/test/test_24_txo.rb +6 -7
  34. data/test/test_25_position_object.rb +0 -4
  35. data/test/test_26_autofilter.rb +0 -5
  36. data/test/test_27_autofilter.rb +0 -5
  37. data/test/test_28_autofilter.rb +0 -5
  38. data/test/test_29_process_jpg.rb +1 -1
  39. data/test/test_30_validation_dval.rb +4 -7
  40. data/test/test_31_validation_dv_strings.rb +9 -12
  41. data/test/test_32_validation_dv_formula.rb +11 -14
  42. data/test/test_42_set_properties.rb +0 -3
  43. data/test/test_50_name_stored.rb +0 -4
  44. data/test/test_51_name_print_area.rb +0 -4
  45. data/test/test_52_name_print_titles.rb +0 -4
  46. data/test/test_53_autofilter.rb +0 -4
  47. data/test/test_60_chart_generic.rb +42 -46
  48. data/test/test_61_chart_subclasses.rb +7 -11
  49. data/test/test_62_chart_formats.rb +12 -16
  50. data/test/test_63_chart_area_formats.rb +3 -7
  51. data/test/test_biff.rb +0 -4
  52. data/test/test_big_workbook.rb +17 -0
  53. data/test/test_format.rb +0 -3
  54. data/test/test_ole.rb +0 -4
  55. data/test/test_storage_lite.rb +0 -9
  56. data/test/test_workbook.rb +0 -4
  57. data/test/test_worksheet.rb +3 -7
  58. data/writeexcel.gemspec +12 -2
  59. metadata +12 -2
@@ -19,12 +19,8 @@ def setup
19
19
  @workbook = WriteExcel.new(io)
20
20
  end
21
21
 
22
- def teardown
23
- @workbook.close
24
- end
25
-
26
22
  def test_store_chart_type_of_column
27
- chart = Writeexcel::Chart.factory('Chart::Column', @workbook, nil, nil, nil)
23
+ chart = Writeexcel::Chart.factory('Chart::Column', @workbook, nil, nil)
28
24
  expected = %w(
29
25
  17 10 06 00 00 00 96 00 00 00
30
26
  ).join(' ')
@@ -33,7 +29,7 @@ def test_store_chart_type_of_column
33
29
  end
34
30
 
35
31
  def test_store_chart_type_of_bar
36
- chart = Writeexcel::Chart.factory('Chart::Bar', @workbook, nil, nil, nil)
32
+ chart = Writeexcel::Chart.factory('Chart::Bar', @workbook, nil, nil)
37
33
  expected = %w(
38
34
  17 10 06 00 00 00 96 00 01 00
39
35
  ).join(' ')
@@ -42,7 +38,7 @@ def test_store_chart_type_of_bar
42
38
  end
43
39
 
44
40
  def test_store_chart_type_of_line
45
- chart = Writeexcel::Chart.factory('Chart::Line', @workbook, nil, nil, nil)
41
+ chart = Writeexcel::Chart.factory('Chart::Line', @workbook, nil, nil)
46
42
  expected = %w(
47
43
  18 10 02 00 00 00
48
44
  ).join(' ')
@@ -51,7 +47,7 @@ def test_store_chart_type_of_line
51
47
  end
52
48
 
53
49
  def test_store_chart_type_of_area
54
- chart = Writeexcel::Chart.factory('Chart::Area', @workbook, nil, nil, nil)
50
+ chart = Writeexcel::Chart.factory('Chart::Area', @workbook, nil, nil)
55
51
  expected = %w(
56
52
  1A 10 02 00 01 00
57
53
  ).join(' ')
@@ -60,7 +56,7 @@ def test_store_chart_type_of_area
60
56
  end
61
57
 
62
58
  def test_store_chart_type_of_pie
63
- chart = Writeexcel::Chart.factory('Chart::Pie', @workbook, nil, nil, nil)
59
+ chart = Writeexcel::Chart.factory('Chart::Pie', @workbook, nil, nil)
64
60
  expected = %w(
65
61
  19 10 06 00 00 00 00 00 02 00
66
62
  ).join(' ')
@@ -69,7 +65,7 @@ def test_store_chart_type_of_pie
69
65
  end
70
66
 
71
67
  def test_store_chart_type_of_scatter
72
- chart = Writeexcel::Chart.factory('Chart::Scatter', @workbook, nil, nil, nil)
68
+ chart = Writeexcel::Chart.factory('Chart::Scatter', @workbook, nil, nil)
73
69
  expected = %w(
74
70
  1B 10 06 00 64 00 01 00 00 00
75
71
  ).join(' ')
@@ -78,7 +74,7 @@ def test_store_chart_type_of_scatter
78
74
  end
79
75
 
80
76
  def test_store_chart_type_of_stock
81
- chart = Writeexcel::Chart.factory('Chart::Stock', @workbook, nil, nil, nil)
77
+ chart = Writeexcel::Chart.factory('Chart::Stock', @workbook, nil, nil)
82
78
  expected = %w(
83
79
  18 10 02 00 00 00
84
80
  ).join(' ')
@@ -20,10 +20,6 @@ def setup
20
20
  @chart = @workbook.add_chart(:type => 'Chart::Column')
21
21
  end
22
22
 
23
- def teardown
24
- @workbook.close
25
- end
26
-
27
23
  ###############################################################################
28
24
  #
29
25
  # Test. User defined colour as string.
@@ -36,7 +32,7 @@ def test_user_defined_color_as_string
36
32
  expected_index = 0x0A
37
33
  expected_rgb = 0x000000FF
38
34
 
39
- got_index, got_rgb = @chart.get_color_indices(color)
35
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
40
36
 
41
37
  assert_equal(expected_index, got_index, caption1)
42
38
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -48,7 +44,7 @@ def test_user_defined_color_as_string
48
44
  expected_index = 0x08
49
45
  expected_rgb = 0x00000000
50
46
 
51
- got_index, got_rgb = @chart.get_color_indices(color)
47
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
52
48
 
53
49
  assert_equal(expected_index, got_index, caption1)
54
50
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -60,7 +56,7 @@ def test_user_defined_color_as_string
60
56
  expected_index = 0x09
61
57
  expected_rgb = 0x00FFFFFF
62
58
 
63
- got_index, got_rgb = @chart.get_color_indices(color)
59
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
64
60
 
65
61
  assert_equal(expected_index, got_index, caption1)
66
62
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -79,7 +75,7 @@ def test_user_defined_color_as_an_index
79
75
  expected_rgb = 0x000000FF
80
76
 
81
77
 
82
- got_index, got_rgb = @chart.get_color_indices(color)
78
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
83
79
 
84
80
  assert_equal(expected_index, got_index, caption1)
85
81
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -97,7 +93,7 @@ def test_user_defined_color_as_an_out_of_range_index
97
93
  expected_index = nil
98
94
  expected_rgb = nil
99
95
 
100
- got_index, got_rgb = @chart.get_color_indices(color)
96
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
101
97
 
102
98
  assert_equal(expected_index, got_index, caption1)
103
99
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -109,7 +105,7 @@ def test_user_defined_color_as_an_out_of_range_index
109
105
  expected_index = nil
110
106
  expected_rgb = nil
111
107
 
112
- got_index, got_rgb = @chart.get_color_indices(color)
108
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
113
109
 
114
110
  assert_equal(expected_index, got_index, caption1)
115
111
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -127,7 +123,7 @@ def test_user_defined_color_as_an_invalid_string
127
123
  expected_index = nil
128
124
  expected_rgb = nil
129
125
 
130
- got_index, got_rgb = @chart.get_color_indices(color)
126
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
131
127
 
132
128
  assert_equal(expected_index, got_index, caption1)
133
129
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -145,7 +141,7 @@ def test_user_defined_color_as_an_nil_property
145
141
  expected_index = nil
146
142
  expected_rgb = nil
147
143
 
148
- got_index, got_rgb = @chart.get_color_indices(color)
144
+ got_index, got_rgb = @chart.__send__("get_color_indices", color)
149
145
 
150
146
  assert_equal(expected_index, got_index, caption1)
151
147
  assert_equal(expected_rgb, got_rgb, caption2)
@@ -176,7 +172,7 @@ def test_line_patterns_with_indices
176
172
  got = []
177
173
 
178
174
  values.each do |user, excel|
179
- got.push(@chart.get_line_pattern(user))
175
+ got.push(@chart.__send__("get_line_pattern", user))
180
176
  expected.push(excel)
181
177
  end
182
178
 
@@ -208,7 +204,7 @@ def test_line_patterns_with_names
208
204
  got = []
209
205
 
210
206
  values.each do |user, excel|
211
- got.push(@chart.get_line_pattern(user))
207
+ got.push(@chart.__send__("get_line_pattern", user))
212
208
  expected.push(excel)
213
209
  end
214
210
 
@@ -236,7 +232,7 @@ def test_line_weights_with_indices
236
232
  got = []
237
233
 
238
234
  values.each do |user, excel|
239
- got.push(@chart.get_line_weight(user))
235
+ got.push(@chart.__send__("get_line_weight", user))
240
236
  expected.push(excel)
241
237
  end
242
238
 
@@ -263,7 +259,7 @@ def test_line_weights_with_names
263
259
  got = []
264
260
 
265
261
  values.each do |user, excel|
266
- got.push(@chart.get_line_weight(user))
262
+ got.push(@chart.__send__("get_line_weight", user))
267
263
  expected.push(excel)
268
264
  end
269
265
 
@@ -27,10 +27,6 @@ def setup
27
27
  @plotarea_caption2 = " \tChart: plotarea format - area";
28
28
  end
29
29
 
30
- def teardown
31
- @workbook.close
32
- end
33
-
34
30
  ###############################################################################
35
31
  #
36
32
  # 1. Test the chartarea format methods. See the set_*area() properties below.
@@ -610,7 +606,7 @@ def test_the_chartarea_format_methods
610
606
  def reset_chart(chart, embedded = nil)
611
607
  # Reset the chart data.
612
608
  chart.data = ''
613
- chart.set_default_properties
609
+ chart.__send__("set_default_properties")
614
610
 
615
611
  if embedded
616
612
  chart.set_embedded_config_data
@@ -622,7 +618,7 @@ def reset_chart(chart, embedded = nil)
622
618
  # Extract Line and Area format records from the Chartarea Frame stream.
623
619
  #
624
620
  def get_chartarea_formats(chart)
625
- chart.store_chartarea_frame_stream
621
+ chart.__send__("store_chartarea_frame_stream")
626
622
 
627
623
  line = unpack_record(chart.data[12, 16])
628
624
  area = unpack_record(chart.data[28, 20])
@@ -635,7 +631,7 @@ def get_chartarea_formats(chart)
635
631
  # Extract Line and Area format records from the Chartarea Frame stream.
636
632
  #
637
633
  def get_plotarea_formats(chart)
638
- chart.store_plotarea_frame_stream
634
+ chart.__send__("store_plotarea_frame_stream")
639
635
 
640
636
  line = unpack_record(chart.data[12, 16])
641
637
  area = unpack_record(chart.data[28, 20])
@@ -12,10 +12,6 @@ def setup
12
12
  @ruby_file = StringIO.new
13
13
  end
14
14
 
15
- def teardown
16
- @biff = nil
17
- end
18
-
19
15
  def test_append_no_error
20
16
  assert_nothing_raised{ @biff.append("World") }
21
17
  end
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+ require 'stringio'
4
+
5
+ class TC_BigWorkbook < Test::Unit::TestCase
6
+
7
+ def test_big_workbook_saves
8
+ workbook = Workbook.new(StringIO.new)
9
+ 4.times do
10
+ worksheet = workbook.add_worksheet
11
+ 500.times {|i| worksheet.write_row(i, 0, [rand(10000).to_s])}
12
+ end
13
+
14
+ assert_nothing_raised { workbook.close }
15
+ end
16
+
17
+ end
@@ -12,9 +12,6 @@ def setup
12
12
  @format = Writeexcel::Format.new
13
13
  end
14
14
 
15
- def teardown
16
- end
17
-
18
15
  def test_set_format_properties
19
16
  end
20
17
 
@@ -99,8 +99,4 @@ def test_write_property_storage_size
99
99
  #assert_nothing_raised{ @ole.close }
100
100
  #assert_equal(512, File.size(@file))
101
101
  end
102
-
103
- def teardown
104
- @ole.close rescue nil
105
- end
106
102
  end
@@ -11,9 +11,6 @@ def setup
11
11
  @ole = OLEStorageLite.new
12
12
  end
13
13
 
14
- def teardown
15
- end
16
-
17
14
  def test_olestoragelite_new
18
15
  ole = OLEStorageLite.new
19
16
  assert_nil(ole.file)
@@ -54,12 +51,6 @@ def unpack_record(data)
54
51
  end
55
52
 
56
53
  class TC_OLEStorageLitePPSFile < Test::Unit::TestCase
57
- def setup
58
- end
59
-
60
- def teardown
61
- end
62
-
63
54
  def test_constructor
64
55
  data = [
65
56
  { :name => 'name', :data => 'data' },
@@ -9,10 +9,6 @@ def setup
9
9
  @workbook = Workbook.new(@test_file)
10
10
  end
11
11
 
12
- def teardown
13
- @workbook.close
14
- end
15
-
16
12
  def test_new
17
13
  assert_kind_of(Workbook, @workbook)
18
14
  end
@@ -15,12 +15,6 @@ def setup
15
15
  @format = Writeexcel::Format.new(:color=>"green")
16
16
  end
17
17
 
18
- def teardown
19
- @ws = nil
20
- @format = nil
21
- @workbook.close
22
- end
23
-
24
18
  def test_methods_exist
25
19
  assert_respond_to(@ws, :write)
26
20
  assert_respond_to(@ws, :write_blank)
@@ -57,8 +51,10 @@ def test_store_dimensions
57
51
  end
58
52
 
59
53
  def test_store_colinfo
54
+ colinfo = Writeexcel::Worksheet::ColInfo.new(0, 0, 8.43, nil, false, 0, false)
55
+
60
56
  file = "delete_this"
61
- File.open(file,"w+"){ |f| f.print @ws.__send__("store_colinfo") }
57
+ File.open(file,"w+"){ |f| f.print @ws.__send__("store_colinfo", colinfo) }
62
58
  pf = @perldir + "ws_store_colinfo"
63
59
  p_od = IO.readlines(pf).to_s.dump
64
60
  r_od = IO.readlines(file).to_s.dump
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{writeexcel}
8
- s.version = "0.6.9"
8
+ s.version = "0.6.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hideo NAKAMURA"]
12
- s.date = %q{2011-08-25}
12
+ s.date = %q{2011-10-20}
13
13
  s.description = %q{Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells.}
14
14
  s.email = %q{cxn03651@msj.biglobe.ne.jp}
15
15
  s.extra_rdoc_files = [
@@ -102,6 +102,7 @@ Gem::Specification.new do |s|
102
102
  "lib/writeexcel.rb",
103
103
  "lib/writeexcel/biffwriter.rb",
104
104
  "lib/writeexcel/caller_info.rb",
105
+ "lib/writeexcel/cell_range.rb",
105
106
  "lib/writeexcel/chart.rb",
106
107
  "lib/writeexcel/charts/area.rb",
107
108
  "lib/writeexcel/charts/bar.rb",
@@ -111,9 +112,14 @@ Gem::Specification.new do |s|
111
112
  "lib/writeexcel/charts/pie.rb",
112
113
  "lib/writeexcel/charts/scatter.rb",
113
114
  "lib/writeexcel/charts/stock.rb",
115
+ "lib/writeexcel/col_info.rb",
114
116
  "lib/writeexcel/colors.rb",
117
+ "lib/writeexcel/comments.rb",
115
118
  "lib/writeexcel/compatibility.rb",
119
+ "lib/writeexcel/convert_date_time.rb",
120
+ "lib/writeexcel/data_validations.rb",
116
121
  "lib/writeexcel/debug_info.rb",
122
+ "lib/writeexcel/embedded_chart.rb",
117
123
  "lib/writeexcel/excelformula.y",
118
124
  "lib/writeexcel/excelformulaparser.rb",
119
125
  "lib/writeexcel/format.rb",
@@ -121,10 +127,13 @@ Gem::Specification.new do |s|
121
127
  "lib/writeexcel/helper.rb",
122
128
  "lib/writeexcel/image.rb",
123
129
  "lib/writeexcel/olewriter.rb",
130
+ "lib/writeexcel/outline.rb",
124
131
  "lib/writeexcel/properties.rb",
132
+ "lib/writeexcel/shared_string_table.rb",
125
133
  "lib/writeexcel/storage_lite.rb",
126
134
  "lib/writeexcel/workbook.rb",
127
135
  "lib/writeexcel/worksheet.rb",
136
+ "lib/writeexcel/worksheets.rb",
128
137
  "lib/writeexcel/write_file.rb",
129
138
  "test/excelfile/Chart1.xls",
130
139
  "test/excelfile/Chart2.xls",
@@ -236,6 +245,7 @@ Gem::Specification.new do |s|
236
245
  "test/test_62_chart_formats.rb",
237
246
  "test/test_63_chart_area_formats.rb",
238
247
  "test/test_biff.rb",
248
+ "test/test_big_workbook.rb",
239
249
  "test/test_compatibility.rb",
240
250
  "test/test_example_match.rb",
241
251
  "test/test_format.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: writeexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-25 00:00:00.000000000 +09:00
12
+ date: 2011-10-20 00:00:00.000000000 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: Multiple worksheets can be added to a workbook and formatting can be
@@ -107,6 +107,7 @@ files:
107
107
  - lib/writeexcel.rb
108
108
  - lib/writeexcel/biffwriter.rb
109
109
  - lib/writeexcel/caller_info.rb
110
+ - lib/writeexcel/cell_range.rb
110
111
  - lib/writeexcel/chart.rb
111
112
  - lib/writeexcel/charts/area.rb
112
113
  - lib/writeexcel/charts/bar.rb
@@ -116,9 +117,14 @@ files:
116
117
  - lib/writeexcel/charts/pie.rb
117
118
  - lib/writeexcel/charts/scatter.rb
118
119
  - lib/writeexcel/charts/stock.rb
120
+ - lib/writeexcel/col_info.rb
119
121
  - lib/writeexcel/colors.rb
122
+ - lib/writeexcel/comments.rb
120
123
  - lib/writeexcel/compatibility.rb
124
+ - lib/writeexcel/convert_date_time.rb
125
+ - lib/writeexcel/data_validations.rb
121
126
  - lib/writeexcel/debug_info.rb
127
+ - lib/writeexcel/embedded_chart.rb
122
128
  - lib/writeexcel/excelformula.y
123
129
  - lib/writeexcel/excelformulaparser.rb
124
130
  - lib/writeexcel/format.rb
@@ -126,10 +132,13 @@ files:
126
132
  - lib/writeexcel/helper.rb
127
133
  - lib/writeexcel/image.rb
128
134
  - lib/writeexcel/olewriter.rb
135
+ - lib/writeexcel/outline.rb
129
136
  - lib/writeexcel/properties.rb
137
+ - lib/writeexcel/shared_string_table.rb
130
138
  - lib/writeexcel/storage_lite.rb
131
139
  - lib/writeexcel/workbook.rb
132
140
  - lib/writeexcel/worksheet.rb
141
+ - lib/writeexcel/worksheets.rb
133
142
  - lib/writeexcel/write_file.rb
134
143
  - test/excelfile/Chart1.xls
135
144
  - test/excelfile/Chart2.xls
@@ -241,6 +250,7 @@ files:
241
250
  - test/test_62_chart_formats.rb
242
251
  - test/test_63_chart_area_formats.rb
243
252
  - test/test_biff.rb
253
+ - test/test_big_workbook.rb
244
254
  - test/test_compatibility.rb
245
255
  - test/test_example_match.rb
246
256
  - test/test_format.rb