writeexcel 0.1.0 → 0.3.0

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 (143) hide show
  1. data/README +26 -31
  2. data/examples/a_simple.rb +42 -42
  3. data/examples/{autofilters.rb → autofilter.rb} +264 -266
  4. data/examples/bigfile.rb +29 -0
  5. data/examples/chart_area.rb +120 -0
  6. data/examples/chart_bar.rb +119 -0
  7. data/examples/chart_column.rb +119 -0
  8. data/examples/chart_line.rb +119 -0
  9. data/examples/chart_pie.rb +107 -0
  10. data/examples/chart_scatter.rb +120 -0
  11. data/examples/chart_stock.rb +147 -0
  12. data/examples/copyformat.rb +51 -51
  13. data/examples/data_validate.rb +278 -278
  14. data/examples/date_time.rb +86 -86
  15. data/examples/defined_name.rb +31 -0
  16. data/examples/demo.rb +120 -118
  17. data/examples/diag_border.rb +35 -35
  18. data/examples/formats.rb +489 -489
  19. data/examples/header.rb +136 -136
  20. data/examples/hidden.rb +28 -28
  21. data/examples/hyperlink.rb +42 -42
  22. data/examples/images.rb +52 -52
  23. data/examples/merge1.rb +39 -39
  24. data/examples/merge2.rb +44 -44
  25. data/examples/merge3.rb +65 -65
  26. data/examples/merge4.rb +82 -82
  27. data/examples/merge5.rb +79 -79
  28. data/examples/properties.rb +33 -0
  29. data/examples/properties_jp.rb +32 -0
  30. data/examples/protection.rb +46 -46
  31. data/examples/regions.rb +52 -52
  32. data/examples/repeat.rb +42 -42
  33. data/examples/stats.rb +75 -75
  34. data/examples/stocks.rb +80 -80
  35. data/examples/tab_colors.rb +30 -30
  36. data/examples/write_arrays.rb +82 -0
  37. data/lib/writeexcel.rb +1134 -18
  38. data/lib/writeexcel/biffwriter.rb +273 -260
  39. data/lib/writeexcel/chart.rb +2306 -217
  40. data/lib/writeexcel/charts/area.rb +152 -0
  41. data/lib/writeexcel/charts/bar.rb +177 -0
  42. data/lib/writeexcel/charts/column.rb +156 -0
  43. data/lib/writeexcel/charts/external.rb +61 -0
  44. data/lib/writeexcel/charts/line.rb +152 -0
  45. data/lib/writeexcel/charts/pie.rb +169 -0
  46. data/lib/writeexcel/charts/scatter.rb +192 -0
  47. data/lib/writeexcel/charts/stock.rb +211 -0
  48. data/lib/writeexcel/excelformulaparser.rb +208 -195
  49. data/lib/writeexcel/format.rb +1697 -1108
  50. data/lib/writeexcel/formula.rb +1050 -986
  51. data/lib/writeexcel/olewriter.rb +322 -322
  52. data/lib/writeexcel/properties.rb +251 -250
  53. data/lib/writeexcel/storage_lite.rb +968 -0
  54. data/lib/writeexcel/workbook.rb +3294 -2630
  55. data/lib/writeexcel/worksheet.rb +9012 -6377
  56. data/test/excelfile/Chart1.xls +0 -0
  57. data/test/excelfile/Chart2.xls +0 -0
  58. data/test/excelfile/Chart3.xls +0 -0
  59. data/test/excelfile/Chart4.xls +0 -0
  60. data/test/excelfile/Chart5.xls +0 -0
  61. data/test/perl_output/Chart1.xls.data +0 -0
  62. data/test/perl_output/Chart2.xls.data +0 -0
  63. data/test/perl_output/Chart3.xls.data +0 -0
  64. data/test/perl_output/Chart4.xls.data +0 -0
  65. data/test/perl_output/Chart5.xls.data +0 -0
  66. data/test/perl_output/a_simple.xls +0 -0
  67. data/test/perl_output/autofilter.xls +0 -0
  68. data/test/perl_output/chart_area.xls +0 -0
  69. data/test/perl_output/chart_bar.xls +0 -0
  70. data/test/perl_output/chart_column.xls +0 -0
  71. data/test/perl_output/chart_line.xls +0 -0
  72. data/test/perl_output/data_validate.xls +0 -0
  73. data/test/perl_output/date_time.xls +0 -0
  74. data/test/perl_output/demo.xls +0 -0
  75. data/test/perl_output/demo101.bin +0 -0
  76. data/test/perl_output/demo201.bin +0 -0
  77. data/test/perl_output/demo301.bin +0 -0
  78. data/test/perl_output/demo401.bin +0 -0
  79. data/test/perl_output/demo501.bin +0 -0
  80. data/test/perl_output/diag_border.xls +0 -0
  81. data/test/perl_output/headers.xls +0 -0
  82. data/test/perl_output/hyperlink.xls +0 -0
  83. data/test/perl_output/images.xls +0 -0
  84. data/test/perl_output/merge1.xls +0 -0
  85. data/test/perl_output/merge2.xls +0 -0
  86. data/test/perl_output/merge3.xls +0 -0
  87. data/test/perl_output/merge4.xls +0 -0
  88. data/test/perl_output/merge5.xls +0 -0
  89. data/test/perl_output/protection.xls +0 -0
  90. data/test/perl_output/regions.xls +0 -0
  91. data/test/perl_output/stats.xls +0 -0
  92. data/test/perl_output/stocks.xls +0 -0
  93. data/test/perl_output/tab_colors.xls +0 -0
  94. data/test/perl_output/unicode_cyrillic.xls +0 -0
  95. data/test/perl_output/workbook1.xls +0 -0
  96. data/test/perl_output/workbook2.xls +0 -0
  97. data/test/tc_all.rb +32 -31
  98. data/test/tc_biff.rb +104 -104
  99. data/test/tc_chart.rb +22 -22
  100. data/test/tc_example_match.rb +1944 -1280
  101. data/test/tc_format.rb +1254 -1267
  102. data/test/tc_formula.rb +63 -63
  103. data/test/tc_ole.rb +110 -110
  104. data/test/tc_storage_lite.rb +149 -0
  105. data/test/tc_workbook.rb +140 -115
  106. data/test/tc_worksheet.rb +115 -115
  107. data/test/test_00_IEEE_double.rb +14 -14
  108. data/test/test_01_add_worksheet.rb +12 -12
  109. data/test/test_02_merge_formats.rb +58 -58
  110. data/test/test_04_dimensions.rb +397 -397
  111. data/test/test_05_rows.rb +182 -182
  112. data/test/test_06_extsst.rb +80 -80
  113. data/test/test_11_date_time.rb +484 -484
  114. data/test/test_12_date_only.rb +506 -506
  115. data/test/test_13_date_seconds.rb +486 -486
  116. data/test/test_21_escher.rb +642 -629
  117. data/test/test_22_mso_drawing_group.rb +750 -739
  118. data/test/test_23_note.rb +78 -78
  119. data/test/test_24_txo.rb +80 -80
  120. data/test/test_25_position_object.rb +82 -0
  121. data/test/test_26_autofilter.rb +327 -327
  122. data/test/test_27_autofilter.rb +144 -144
  123. data/test/test_28_autofilter.rb +174 -174
  124. data/test/test_29_process_jpg.rb +681 -131
  125. data/test/test_30_validation_dval.rb +82 -82
  126. data/test/test_31_validation_dv_strings.rb +131 -131
  127. data/test/test_32_validation_dv_formula.rb +211 -211
  128. data/test/test_40_property_types.rb +191 -191
  129. data/test/test_41_properties.rb +238 -238
  130. data/test/test_42_set_properties.rb +442 -419
  131. data/test/test_50_name_stored.rb +305 -0
  132. data/test/test_51_name_print_area.rb +363 -0
  133. data/test/test_52_name_print_titles.rb +460 -0
  134. data/test/test_53_autofilter.rb +209 -0
  135. data/test/test_60_chart_generic.rb +576 -0
  136. data/test/test_61_chart_subclasses.rb +97 -0
  137. data/test/test_62_chart_formats.rb +270 -0
  138. data/test/test_63_chart_area_formats.rb +647 -0
  139. data/test/test_chartex.rb +35 -0
  140. data/test/ts_all.rb +46 -34
  141. data/writeexcel.gemspec +18 -0
  142. data/writeexcel.rdoc +583 -0
  143. metadata +162 -108
@@ -0,0 +1,152 @@
1
+ ###############################################################################
2
+ #
3
+ # Area - A writer class for Excel Area charts.
4
+ #
5
+ # Used in conjunction with Chart.
6
+ #
7
+ # See formatting note in Chart.
8
+ #
9
+ # Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
10
+ #
11
+ # original written in Perl by John McNamara
12
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
+ #
14
+
15
+ require 'writeexcel'
16
+
17
+ class Chart
18
+
19
+ #
20
+ # ==SYNOPSIS
21
+ #
22
+ # To create a simple Excel file with a Area chart using WriteExcel:
23
+ #
24
+ # #!/usr/bin/ruby -w
25
+ #
26
+ # require 'writeexcel'
27
+ #
28
+ # workbook = WriteExcel.new('chart.xls')
29
+ # worksheet = workbook.add_worksheet
30
+ #
31
+ # chart = workbook.add_chart(:type => Chart::Area)
32
+ #
33
+ # # Configure the chart.
34
+ # chart.add_series(
35
+ # :categories => '=Sheet1!$A$2:$A$7',
36
+ # :values => '=Sheet1!$B$2:$B$7',
37
+ # )
38
+ #
39
+ # # Add the worksheet data the chart refers to.
40
+ # data = [
41
+ # [ 'Category', 2, 3, 4, 5, 6, 7 ],
42
+ # [ 'Value', 1, 4, 5, 2, 1, 5 ]
43
+ # ]
44
+ #
45
+ # worksheet.write('A1', data)
46
+ #
47
+ # workbook.close
48
+ #
49
+ # ==DESCRIPTION
50
+ #
51
+ # This module implements Area charts for WriteExcel. The chart object is
52
+ # created via the Workbook add_chart method:
53
+ #
54
+ # chart = workbook.add_chart(:type => Chart::Area)
55
+ #
56
+ # Once the object is created it can be configured via the following methods
57
+ # that are common to all chart classes:
58
+ #
59
+ # chart.add_series
60
+ # chart.set_x_axis
61
+ # chart.set_y_axis
62
+ # chart.set_title
63
+ #
64
+ # These methods are explained in detail in Chart section of WriteExcel.
65
+ # Class specific methods or settings, if any, are explained below.
66
+ #
67
+ # ==Area Chart Methods
68
+ #
69
+ # There aren't currently any area chart specific methods. See the TODO
70
+ # section of Chart of Writeexcel.
71
+ #
72
+ # ==EXAMPLE
73
+ #
74
+ # Here is a complete example that demonstrates most of the available
75
+ # features when creating a chart.
76
+ #
77
+ # #!/usr/bin/ruby -w
78
+ #
79
+ # require 'writeexcel'
80
+ #
81
+ # workbook = WriteExcel.new('chart_area.xls')
82
+ # worksheet = workbook.add_worksheet
83
+ # bold = workbook.add_format(:bold => 1)
84
+ #
85
+ # # Add the worksheet data that the charts will refer to.
86
+ # headings = [ 'Number', 'Sample 1', 'Sample 2' ]
87
+ # data = [
88
+ # [ 2, 3, 4, 5, 6, 7 ],
89
+ # [ 1, 4, 5, 2, 1, 5 ],
90
+ # [ 3, 6, 7, 5, 4, 3 ]
91
+ # ]
92
+ #
93
+ # worksheet.write('A1', headings, bold)
94
+ # worksheet.write('A2', data)
95
+ #
96
+ # # Create a new chart object. In this case an embedded chart.
97
+ # chart = workbook.add_chart(:type => Chart::Area, :embedded => 1)
98
+ #
99
+ # # Configure the first series. (Sample 1)
100
+ # chart.add_series(
101
+ # :name => 'Sample 1',
102
+ # :categories => '=Sheet1!$A$2:$A$7',
103
+ # :values => '=Sheet1!$B$2:$B$7',
104
+ # )
105
+ #
106
+ # # Configure the second series. (Sample 2)
107
+ # chart.add_series(
108
+ # :name => 'Sample 2',
109
+ # :categories => '=Sheet1!$A$2:$A$7',
110
+ # :values => '=Sheet1!$C$2:$C$7',
111
+ # )
112
+ #
113
+ # # Add a chart title and some axis labels.
114
+ # chart.set_title (:name => 'Results of sample analysis')
115
+ # chart.set_x_axis(:name => 'Test number')
116
+ # chart.set_y_axis(:name => 'Sample length (cm)')
117
+ #
118
+ # # Insert the chart into the worksheet (with an offset).
119
+ # worksheet.insert_chart('D2', chart, 25, 10)
120
+ #
121
+ # workbook.close
122
+ #
123
+ class Area < Chart
124
+ ###############################################################################
125
+ #
126
+ # new()
127
+ #
128
+ #
129
+ def initialize(*args) # :nodoc:
130
+ super
131
+ end
132
+
133
+ ###############################################################################
134
+ #
135
+ # _store_chart_type()
136
+ #
137
+ # Implementation of the abstract method from the specific chart class.
138
+ #
139
+ # Write the AREA chart BIFF record. Defines a area chart type.
140
+ #
141
+ def store_chart_type # :nodoc:
142
+ record = 0x101A # Record identifier.
143
+ length = 0x0002 # Number of bytes to follow.
144
+ grbit = 0x0001 # Option flags.
145
+
146
+ header = [record, length].pack('vv')
147
+ data = [grbit].pack('v')
148
+
149
+ append(header, data)
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,177 @@
1
+ ###############################################################################
2
+ #
3
+ # Bar - A writer class for Excel Bar charts.
4
+ #
5
+ # Used in conjunction with Chart.
6
+ #
7
+ # See formatting note in Chart.
8
+ #
9
+ # Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
10
+ #
11
+ # original written in Perl by John McNamara
12
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
+ #
14
+
15
+ require 'writeexcel/chart'
16
+
17
+ class Chart
18
+
19
+ #
20
+ # ==SYNOPSIS
21
+ #
22
+ # To create a simple Excel file with a Bar chart using WriteExcel:
23
+ #
24
+ # #!/usr/bin/ruby -w
25
+ #
26
+ # require 'writeexcel'
27
+ #
28
+ # workbook = WriteExcel.new('chart.xls')
29
+ # worksheet = workbook.add_worksheet
30
+ #
31
+ # chart = workbook.add_chart(:type => Chart::Bar)
32
+ #
33
+ # # Configure the chart.
34
+ # chart.add_series(
35
+ # :categories => '=Sheet1!$A$2:$A$7',
36
+ # :values => '=Sheet1!$B$2:$B$7',
37
+ # )
38
+ #
39
+ # # Add the worksheet data the chart refers to.
40
+ # data = [
41
+ # [ 'Category', 2, 3, 4, 5, 6, 7 ],
42
+ # [ 'Value', 1, 4, 5, 2, 1, 5 ]
43
+ # ]
44
+ #
45
+ # worksheet.write('A1', data)
46
+ #
47
+ # workbook.close
48
+ #
49
+ # ==DESCRIPTION
50
+ #
51
+ # This module implements Bar charts for WriteExcel. The chart object is
52
+ # created via the Workbook add_chart method:
53
+ #
54
+ # chart = workbook.add_chart(:type => Chart::Bar)
55
+ #
56
+ # Once the object is created it can be configured via the following methods
57
+ # that are common to all chart classes:
58
+ #
59
+ # chart.add_series
60
+ # chart.set_x_axis
61
+ # chart.set_y_axis
62
+ # chart.set_title
63
+ #
64
+ # These methods are explained in detail in Chart section of WriteExcel.
65
+ # Class specific methods or settings, if any, are explained below.
66
+ #
67
+ # ==Bar Chart Methods
68
+ #
69
+ # There aren't currently any bar chart specific methods. See the TODO
70
+ # section of Chart of Writeexcel.
71
+ #
72
+ # ==EXAMPLE
73
+ #
74
+ # Here is a complete example that demonstrates most of the available
75
+ # features when creating a chart.
76
+ #
77
+ # #!/usr/bin/ruby -w
78
+ #
79
+ # require 'writeexcel'
80
+ #
81
+ # workbook = WriteExcel.new('chart_bar.xls')
82
+ # worksheet = workbook.add_worksheet
83
+ # bold = workbook.add_format(:bold => 1)
84
+ #
85
+ # # Add the worksheet data that the charts will refer to.
86
+ # headings = [ 'Number', 'Sample 1', 'Sample 2' ]
87
+ # data = [
88
+ # [ 2, 3, 4, 5, 6, 7 ],
89
+ # [ 1, 4, 5, 2, 1, 5 ],
90
+ # [ 3, 6, 7, 5, 4, 3 ]
91
+ # ]
92
+ #
93
+ # worksheet.write('A1', headings, bold)
94
+ # worksheet.write('A2', data)
95
+ #
96
+ # # Create a new chart object. In this case an embedded chart.
97
+ # chart = workbook.add_chart(:type => Chart::Bar, :embedded => 1)
98
+ #
99
+ # # Configure the first series. (Sample 1)
100
+ # chart.add_series(
101
+ # :name => 'Sample 1',
102
+ # :categories => '=Sheet1!$A$2:$A$7',
103
+ # :values => '=Sheet1!$B$2:$B$7',
104
+ # )
105
+ #
106
+ # # Configure the second series. (Sample 2)
107
+ # chart.add_series(
108
+ # :name => 'Sample 2',
109
+ # :categories => '=Sheet1!$A$2:$A$7',
110
+ # :values => '=Sheet1!$C$2:$C$7',
111
+ # )
112
+ #
113
+ # # Add a chart title and some axis labels.
114
+ # chart.set_title (:name => 'Results of sample analysis')
115
+ # chart.set_x_axis(:name => 'Test number')
116
+ # chart.set_y_axis(:name => 'Sample length (cm)')
117
+ #
118
+ # # Insert the chart into the worksheet (with an offset).
119
+ # worksheet.insert_chart('D2', chart, 25, 10)
120
+ #
121
+ # workbook.close
122
+ #
123
+ class Bar < Chart
124
+ ###############################################################################
125
+ #
126
+ # new()
127
+ #
128
+ #
129
+ def initialize(*args) # :nodoc:
130
+ super
131
+ @config[:x_axis_text] = [ 0x2D, 0x6D9, 0x5F, 0x1CC, 0x281, 0x0, 90 ]
132
+ @config[:x_axis_text_pos] = [ 2, 2, 0, 0, 0x17, 0x2A ]
133
+ @config[:y_axis_text] = [ 0x078A, 0x0DFC, 0x011D, 0x9C, 0x0081, 0x0000 ]
134
+ @config[:y_axis_text_pos] = [ 2, 2, 0, 0, 0x45, 0x17 ]
135
+ end
136
+
137
+ ###############################################################################
138
+ #
139
+ # _store_chart_type()
140
+ #
141
+ # Implementation of the abstract method from the specific chart class.
142
+ #
143
+ # Write the BAR chart BIFF record. Defines a bar or column chart type.
144
+ #
145
+ def store_chart_type # :nodoc:
146
+ record = 0x1017 # Record identifier.
147
+ length = 0x0006 # Number of bytes to follow.
148
+ pcOverlap = 0x0000 # Space between bars.
149
+ pcGap = 0x0096 # Space between cats.
150
+ grbit = 0x0001 # Option flags.
151
+
152
+ header = [record, length].pack('vv')
153
+ data = [pcOverlap].pack('v')
154
+ data += [pcGap].pack('v')
155
+ data += [grbit].pack('v')
156
+
157
+ append(header, data)
158
+ end
159
+
160
+ ###############################################################################
161
+ #
162
+ # _set_embedded_config_data()
163
+ #
164
+ # Override some of the default configuration data for an embedded chart.
165
+ #
166
+ def set_embedded_config_data # :nodoc:
167
+ # Set the parent configuration first.
168
+ super
169
+
170
+ # The axis positions are reversed for a bar chart so we change the config.
171
+ @config[:x_axis_text] = [ 0x57, 0x5BC, 0xB5, 0x214, 0x281, 0x0, 90 ]
172
+ @config[:x_axis_text_pos] = [ 2, 2, 0, 0, 0x17, 0x2A ]
173
+ @config[:y_axis_text] = [ 0x074A, 0x0C8F, 0x021F, 0x123, 0x81, 0x0000 ]
174
+ @config[:y_axis_text_pos] = [ 2, 2, 0, 0, 0x45, 0x17 ]
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,156 @@
1
+ ###############################################################################
2
+ #
3
+ # Column - A writer class for Excel Column charts.
4
+ #
5
+ # Used in conjunction with Chart.
6
+ #
7
+ # See formatting note in Chart.
8
+ #
9
+ # Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
10
+ #
11
+ # original written in Perl by John McNamara
12
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
13
+ #
14
+
15
+ require 'writeexcel/chart'
16
+
17
+ class Chart
18
+
19
+ #
20
+ # ==SYNOPSIS
21
+ #
22
+ # To create a simple Excel file with a Column chart using WriteExcel:
23
+ #
24
+ # #!/usr/bin/ruby -w
25
+ #
26
+ # require 'writeexcel'
27
+ #
28
+ # workbook = WriteExcel.new('chart.xls')
29
+ # worksheet = workbook.add_worksheet
30
+ #
31
+ # chart = workbook.add_chart(:type => Chart::Column)
32
+ #
33
+ # # Configure the chart.
34
+ # chart.add_series(
35
+ # :categories => '=Sheet1!$A$2:$A$7',
36
+ # :values => '=Sheet1!$B$2:$B$7',
37
+ # )
38
+ #
39
+ # # Add the worksheet data the chart refers to.
40
+ # data = [
41
+ # [ 'Category', 2, 3, 4, 5, 6, 7 ],
42
+ # [ 'Value', 1, 4, 5, 2, 1, 5 ]
43
+ # ]
44
+ #
45
+ # worksheet.write('A1', data)
46
+ #
47
+ # workbook.close
48
+ #
49
+ # ==DESCRIPTION
50
+ #
51
+ # This module implements Column charts for WriteExcel. The chart object is
52
+ # created via the Workbook add_chart method:
53
+ #
54
+ # chart = workbook.add_chart(:type => Chart::Column)
55
+ #
56
+ # Once the object is created it can be configured via the following methods
57
+ # that are common to all chart classes:
58
+ #
59
+ # chart.add_series
60
+ # chart.set_x_axis
61
+ # chart.set_y_axis
62
+ # chart.set_title
63
+ #
64
+ # These methods are explained in detail in Chart section of WriteExcel.
65
+ # Class specific methods or settings, if any, are explained below.
66
+ #
67
+ # ==Column Chart Methods
68
+ #
69
+ # There aren't currently any column chart specific methods. See the TODO
70
+ # section of Chart of Writeexcel.
71
+ #
72
+ # ==EXAMPLE
73
+ #
74
+ # Here is a complete example that demonstrates most of the available
75
+ # features when creating a chart.
76
+ #
77
+ # #!/usr/bin/ruby -w
78
+ #
79
+ # require 'writeexcel'
80
+ #
81
+ # workbook = WriteExcel.new('chart_column.xls')
82
+ # worksheet = workbook.add_worksheet
83
+ # bold = workbook.add_format(:bold => 1)
84
+ #
85
+ # # Add the worksheet data that the charts will refer to.
86
+ # headings = [ 'Number', 'Sample 1', 'Sample 2' ]
87
+ # data = [
88
+ # [ 2, 3, 4, 5, 6, 7 ],
89
+ # [ 1, 4, 5, 2, 1, 5 ],
90
+ # [ 3, 6, 7, 5, 4, 3 ]
91
+ # ]
92
+ #
93
+ # worksheet.write('A1', headings, bold)
94
+ # worksheet.write('A2', data)
95
+ #
96
+ # # Create a new chart object. In this case an embedded chart.
97
+ # chart = workbook.add_chart(:type => Chart::Column, :embedded => 1)
98
+ #
99
+ # # Configure the first series. (Sample 1)
100
+ # chart.add_series(
101
+ # :name => 'Sample 1',
102
+ # :categories => '=Sheet1!$A$2:$A$7',
103
+ # :values => '=Sheet1!$B$2:$B$7',
104
+ # )
105
+ #
106
+ # # Configure the second series. (Sample 2)
107
+ # chart.add_series(
108
+ # :name => 'Sample 2',
109
+ # :categories => '=Sheet1!$A$2:$A$7',
110
+ # :values => '=Sheet1!$C$2:$C$7',
111
+ # )
112
+ #
113
+ # # Add a chart title and some axis labels.
114
+ # chart.set_title (:name => 'Results of sample analysis')
115
+ # chart.set_x_axis(:name => 'Test number')
116
+ # chart.set_y_axis(:name => 'Sample length (cm)')
117
+ #
118
+ # # Insert the chart into the worksheet (with an offset).
119
+ # worksheet.insert_chart('D2', chart, 25, 10)
120
+ #
121
+ # workbook.close
122
+ #
123
+ class Column < Chart
124
+ ###############################################################################
125
+ #
126
+ # new()
127
+ #
128
+ #
129
+ def initialize(*args) # :nodoc:
130
+ super(*args)
131
+ end
132
+
133
+ ###############################################################################
134
+ #
135
+ # _store_chart_type()
136
+ #
137
+ # Implementation of the abstract method from the specific chart class.
138
+ #
139
+ # Write the BAR chart BIFF record. Defines a bar or column chart type.
140
+ #
141
+ def store_chart_type # :nodoc:
142
+ record = 0x1017 # Record identifier.
143
+ length = 0x0006 # Number of bytes to follow.
144
+ pcOverlap = 0x0000 # Space between bars.
145
+ pcGap = 0x0096 # Space between cats.
146
+ grbit = 0x0000 # Option flags.
147
+
148
+ header = [record, length].pack('vv')
149
+ data = [pcOverlap].pack('v')
150
+ data += [pcGap].pack('v')
151
+ data += [grbit].pack('v')
152
+
153
+ append(header, data)
154
+ end
155
+ end
156
+ end