writeexcel 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,8 @@
15
15
 
16
16
  require 'writeexcel'
17
17
 
18
+ module Writeexcel
19
+
18
20
  class Chart
19
21
 
20
22
  # ==SYNOPSIS
@@ -28,7 +30,7 @@ class Chart
28
30
  # workbook = Spreadsheet::WriteExcel.new('chart.xls')
29
31
  # worksheet = workbook.add_worksheet
30
32
  #
31
- # chart = workbook.add_chart(:type => Chart::Pie)
33
+ # chart = workbook.add_chart(:type => 'Chart::Pie')
32
34
  #
33
35
  # # Configure the chart.
34
36
  # chart.add_series(
@@ -51,7 +53,7 @@ class Chart
51
53
  # This module implements Pie charts for Spreadsheet::WriteExcel. The chart
52
54
  # object is created via the Workbook add_chart() method:
53
55
  #
54
- # chart = workbook.add_chart(:type => Chart::Pie)
56
+ # chart = workbook.add_chart(:type => 'Chart::Pie')
55
57
  #
56
58
  # Once the object is created it can be configured via the following methods
57
59
  # that are common to all chart classes:
@@ -97,7 +99,7 @@ class Chart
97
99
  # worksheet.write('A2', data)
98
100
  #
99
101
  # # Create a new chart object. In this case an embedded chart.
100
- # chart = workbook.add_chart(:type => Chart::Pie, :embedded => 1)
102
+ # chart = workbook.add_chart(:type => 'Chart::Pie', :embedded => 1)
101
103
  #
102
104
  # # Configure the series.
103
105
  # chart.add_series(
@@ -141,12 +143,7 @@ class Chart
141
143
  donut = 0x0000 # Donut hole size.
142
144
  grbit = 0x0002 # Option flags.
143
145
 
144
- header = [record, length].pack('vv')
145
- data = [angle].pack('v')
146
- data += [donut].pack('v')
147
- data += [grbit].pack('v')
148
-
149
- append(header, data)
146
+ store_simple(record, length, angle, donut, grbit)
150
147
  end
151
148
 
152
149
  ###############################################################################
@@ -167,4 +164,6 @@ class Chart
167
164
  store_end
168
165
  end
169
166
  end
170
- end
167
+ end # class Chart
168
+
169
+ end # module Writeexcel
@@ -15,6 +15,8 @@
15
15
 
16
16
  require 'writeexcel'
17
17
 
18
+ module Writeexcel
19
+
18
20
  class Chart
19
21
 
20
22
  # ==SYNOPSIS
@@ -28,7 +30,7 @@ class Chart
28
30
  # workbook = Spreadsheet::WriteExcel.new('chart.xls')
29
31
  # worksheet = workbook.add_worksheet
30
32
  #
31
- # chart = workbook.add_chart(:type => Chart::Scatter)
33
+ # chart = workbook.add_chart(:type => 'Chart::Scatter')
32
34
  #
33
35
  # # Configure the chart.
34
36
  # chart.add_series(
@@ -51,7 +53,7 @@ class Chart
51
53
  # This module implements Scatter charts for WriteExcel.
52
54
  # The chart object is created via the Workbook add_chart() method:
53
55
  #
54
- # chart = workbook.add_chart(:type => Chart::Scatter)
56
+ # chart = workbook.add_chart(:type => 'Chart::Scatter')
55
57
  #
56
58
  # Once the object is created it can be configured via the following
57
59
  # methods that are common to all chart classes:
@@ -94,7 +96,7 @@ class Chart
94
96
  # worksheet.write('A2', data)
95
97
  #
96
98
  # # Create a new chart object. In this case an embedded chart.
97
- # chart = workbook.add_chart(:type => Chart::Scatter, :embedded => 1)
99
+ # chart = workbook.add_chart(:type => 'Chart::Scatter', :embedded => 1)
98
100
  #
99
101
  # # Configure the first series. (Sample 1)
100
102
  # chart.add_series(
@@ -145,12 +147,7 @@ class Chart
145
147
  bubble_type = 0x0001 # Bubble type.
146
148
  grbit = 0x0000 # Option flags.
147
149
 
148
- header = [record, length].pack('vv')
149
- data = [bubble_ratio].pack('v')
150
- data += [bubble_type].pack('v')
151
- data += [grbit].pack('v')
152
-
153
- append(header, data)
150
+ store_simple(record, length, bubble_ratio, bubble_type, grbit)
154
151
  end
155
152
 
156
153
  ###############################################################################
@@ -190,4 +187,6 @@ class Chart
190
187
  store_end
191
188
  end
192
189
  end
193
- end
190
+ end # class Chart
191
+
192
+ end # module Writeexcel
@@ -15,6 +15,8 @@
15
15
 
16
16
  require 'writeexcel'
17
17
 
18
+ module Writeexcel
19
+
18
20
  class Chart
19
21
 
20
22
  # ==SYNOPSIS
@@ -28,7 +30,7 @@ class Chart
28
30
  # workbook = Spreadsheet::WriteExcel.new('chart.xls')
29
31
  # worksheet = workbook.add_worksheet
30
32
  #
31
- # chart = workbook.add_chart(:type => Chart::Stock)
33
+ # chart = workbook.add_chart(:type => 'Chart::Stock')
32
34
  #
33
35
  # # Add a series for each Open-High-Low-Close.
34
36
  # chart.add_series(:categories => '=Sheet1!$A$2:$A$6', :values => '=Sheet1!$B$2:$B$6')
@@ -46,7 +48,7 @@ class Chart
46
48
  # This module implements Stock charts for WriteExcel. The chart object
47
49
  # is created via the Workbook add_chart() method:
48
50
  #
49
- # chart = workbook.add_chart(:type => Chart::Stock)
51
+ # chart = workbook.add_chart(:type => 'Chart::Stock')
50
52
  #
51
53
  # Once the object is created it can be configured via the following methods
52
54
  # that are common to all chart classes:
@@ -107,7 +109,7 @@ class Chart
107
109
  # end
108
110
  #
109
111
  # # Create a new chart object. In this case an embedded chart.
110
- # chart = workbook.add_chart(:type => Chart::Stock, ::embedded => 1)
112
+ # chart = workbook.add_chart(:type => 'Chart::Stock', ::embedded => 1)
111
113
  #
112
114
  # # Add a series for each of the Open-High-Low-Close columns.
113
115
  # chart.add_series(
@@ -169,10 +171,7 @@ class Chart
169
171
  length = 0x0002 # Number of bytes to follow.
170
172
  grbit = 0x0000 # Option flags.
171
173
 
172
- header = [record, length].pack('vv')
173
- data = [grbit].pack('v')
174
-
175
- append(header, data)
174
+ store_simple(record, length, grbit)
176
175
  end
177
176
 
178
177
  ###############################################################################
@@ -209,4 +208,6 @@ class Chart
209
208
  store_end
210
209
  end
211
210
  end
212
- end
211
+ end # class Chart
212
+
213
+ end # module Writeexcel
@@ -1,5 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ module Writeexcel
4
+
3
5
  class Colors
4
6
  COLORS = {
5
7
  :aqua => 0x0F,
@@ -56,4 +58,7 @@ class Colors
56
58
  0x7FFF
57
59
  end
58
60
  end
59
- end
61
+ end # class Colors
62
+
63
+ end # module Writeexcel
64
+
@@ -89,7 +89,7 @@ class String #:nodoc:
89
89
  end
90
90
  elsif @encoding == Encoding::BINARY
91
91
  case encoding
92
- when /ASCII/i
92
+ when /ASCII/i, /EUCJP/i, /SJIS/i
93
93
  if self.ascii_only? || self.mbchar?('UTF8') || self.mbchar?('EUCJP') || self.mbchar?('SJIS')
94
94
  raise Encoding::UndefinedConversionError
95
95
  else
@@ -99,14 +99,6 @@ class String #:nodoc:
99
99
  end
100
100
  when /BINARY/i
101
101
  self
102
- when /EUCJP/i, /SJIS/i
103
- if self.ascii_only? || self.mbchar?('UTF8') || self.mbchar?('EUCJP') || self.mbchar?('SJIS')
104
- raise Encoding::UndefinedConversionError
105
- else
106
- str = String.new(self)
107
- str.force_encoding(encoding)
108
- str
109
- end
110
102
  when /UTF_8/i, /UTF_16LE/i, /UTF_16BE/i
111
103
  raise Encoding::ConverterNotFoundError
112
104
  else
@@ -20,6 +20,8 @@
20
20
  require 'writeexcel/compatibility'
21
21
  require 'writeexcel/colors'
22
22
 
23
+ module Writeexcel
24
+
23
25
  class Format < Colors
24
26
 
25
27
  ###############################################################################
@@ -1592,4 +1594,7 @@ class Format < Colors
1592
1594
  end
1593
1595
  eval s
1594
1596
  end
1595
- end
1597
+ end # class Format
1598
+
1599
+ end # module Writeexcel
1600
+
@@ -14,6 +14,8 @@
14
14
  require 'strscan'
15
15
  require 'writeexcel/excelformulaparser'
16
16
 
17
+ module Writeexcel
18
+
17
19
  class Formula < ExcelFormulaParser #:nodoc:
18
20
  require 'writeexcel/helper'
19
21
  private :convert_to_ascii_if_ascii
@@ -640,21 +642,11 @@ class Formula < ExcelFormulaParser #:nodoc:
640
642
  cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/
641
643
 
642
644
  col_rel = $1 == "" ? 1 : 0
643
- col = $2
644
645
  row_rel = $3 == "" ? 1 : 0
645
646
  row = $4.to_i
646
647
 
647
- # Convert base26 column string to a number.
648
- # All your Base are belong to us.
649
- chars = col.split(//)
650
- expn = 0
651
- col = 0
648
+ col = chars_to_col($2.split(//))
652
649
 
653
- while (!chars.empty?)
654
- char = chars.pop # LS char first
655
- col += (char.ord - "A".ord + 1) * (26 ** expn)
656
- expn += 1
657
- end
658
650
  # Convert 1-index to zero-index
659
651
  row -= 1
660
652
  col -= 1
@@ -1054,4 +1046,6 @@ if $0 ==__FILE__
1054
1046
  end
1055
1047
  end
1056
1048
 
1057
- end
1049
+ end # class Formula
1050
+
1051
+ end # module Writeexcel
@@ -40,3 +40,25 @@
40
40
  ascii.force_encoding('UTF-16BE')
41
41
  end
42
42
  private :ascii_to_16be
43
+
44
+ def store_simple(record, length, *args)
45
+ header = [record, length].pack('vv')
46
+ data = args.collect { |arg| [arg].pack('v') }.join('')
47
+
48
+ append(header, data)
49
+ end
50
+ private :store_simple
51
+
52
+ # Convert base26 column string to a number.
53
+ # All your Base are belong to us.
54
+ def chars_to_col(chars)
55
+ expn = 0
56
+ col = 0
57
+ while (!chars.empty?)
58
+ char = chars.pop # LS char first
59
+ col += (char.ord - "A".ord + 1) * (26 ** expn)
60
+ expn += 1
61
+ end
62
+ col
63
+ end
64
+ private :chars_to_col
@@ -671,14 +671,7 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
671
671
  iBlCnt -= 1 #the BlCnt is reduced in the count of the last sect is used for a pointer the next Bl
672
672
  iBBleftover = iAll - i1stBdMax
673
673
  if iAll >i1stBdMax
674
- while true
675
- iBdCnt = iBBleftover / iBlCnt
676
- iBdCnt += 1 if iBBleftover % iBlCnt > 0
677
- iBdExL = iBdCnt / iBlCnt
678
- iBdExL += 1 if iBdCnt % iBlCnt > 0
679
- iBBleftover += iBdExL
680
- break if iBdCnt == iBBleftover / iBlCnt + (iBBleftover % iBlCnt > 0 ? 1 : 0)
681
- end
674
+ iBdCnt, iBdExL, iBBleftover = calc_idbcnt_idbexl_ibbleftover(iBBleftover, iBlCnt, iBdCnt, iBdExL)
682
675
  end
683
676
  iBdCnt += i1stBdL
684
677
  #print "iBdCnt = iBdCnt \n"
@@ -784,7 +777,6 @@ class OLEStorageLitePPSRoot < OLEStorageLitePPS #:nodoc:
784
777
  def _savePpsSetPnt(pps_array, aList, rh_info)
785
778
  #1. make Array as Children-Relations
786
779
  #1.1 if No Children
787
- bpp=1
788
780
  if pps_array.nil? || pps_array.size == 0
789
781
  return 0xFFFFFFFF
790
782
  #1.2 Just Only one
@@ -869,15 +861,7 @@ bpp=1
869
861
  #0.1 Calculate BD count
870
862
  iBBleftover = iAll - i1stBdMax
871
863
  if iAll >i1stBdMax
872
- while true
873
- iBdCnt = iBBleftover / iBlCnt
874
- iBdCnt += 1 if iBBleftover % iBlCnt > 0
875
-
876
- iBdExL = iBdCnt / iBlCnt
877
- iBdExL += 1 if iBdCnt % iBlCnt > 0
878
- iBBleftover += iBdExL
879
- break if iBdCnt == (iBBleftover / iBlCnt + ((iBBleftover % iBlCnt) > 0 ? 1: 0))
880
- end
864
+ iBdCnt, iBdExL, iBBleftover = calc_idbcnt_idbexl_ibbleftover(iBBleftover, iBlCnt, iBdCnt, iBdExL)
881
865
  end
882
866
  iAllW += iBdExL
883
867
  iBdCnt += i1stBdL
@@ -933,6 +917,19 @@ bpp=1
933
917
  file.write([-2].pack('V'))
934
918
  end
935
919
  end
920
+
921
+ def calc_idbcnt_idbexl_ibbleftover(iBBleftover, iBlCnt, iBdCnt, iBdExL)
922
+ while true
923
+ iBdCnt = iBBleftover / iBlCnt
924
+ iBdCnt += 1 if iBBleftover % iBlCnt > 0
925
+ iBdExL = iBdCnt / iBlCnt
926
+ iBdExL += 1 if iBdCnt % iBlCnt > 0
927
+ iBBleftover += iBdExL
928
+ break if iBdCnt == iBBleftover / iBlCnt + (iBBleftover % iBlCnt > 0 ? 1 : 0)
929
+ end
930
+ [iBdCnt, iBdExL, iBBleftover]
931
+ end
932
+ private :calc_idbcnt_idbexl_ibbleftover
936
933
  end
937
934
 
938
935
  class OLEStorageLitePPSFile < OLEStorageLitePPS #:nodoc:
@@ -70,7 +70,7 @@ class Workbook < BIFFWriter
70
70
  super()
71
71
  @file = file
72
72
  @default_formats = default_formats
73
- @parser = Formula.new(@byte_order)
73
+ @parser = Writeexcel::Formula.new(@byte_order)
74
74
  @tempdir = nil
75
75
  @date_1904 = false
76
76
  @sheet =
@@ -305,7 +305,7 @@ class Workbook < BIFFWriter
305
305
  nil, # Palette. Not used yet. See add_chart().
306
306
  @sinfo,
307
307
  ]
308
- worksheet = Worksheet.new(*init_data)
308
+ worksheet = Writeexcel::Worksheet.new(*init_data)
309
309
  @worksheets[index] = worksheet # Store ref for iterator
310
310
  @sheetnames[index] = name # Store EXTERNSHEET names
311
311
  @parser.set_ext_sheets(name, index) # Store names in Formula.rb
@@ -322,7 +322,7 @@ class Workbook < BIFFWriter
322
322
  # (the default) or as an embeddable object that can be inserted into a
323
323
  # worksheet via the insert_chart() Worksheet method.
324
324
  #
325
- # chart = workbook.add_chart(:type => Chart::Column)
325
+ # chart = workbook.add_chart(:type => 'Chart::Column')
326
326
  #
327
327
  # The properties that can be set are:
328
328
  #
@@ -334,17 +334,17 @@ class Workbook < BIFFWriter
334
334
  #
335
335
  # This is a required parameter. It defines the type of chart that will be created.
336
336
  #
337
- # chart = workbook.add_chart(:type => Chart::Line)
337
+ # chart = workbook.add_chart(:type => 'Chart::Line')
338
338
  #
339
339
  # The available types are:
340
340
  #
341
- # Chart::Column
342
- # Chart::Bar
343
- # Chart::Line
344
- # Chart::Area
345
- # Chart::Pie
346
- # Chart::Scatter
347
- # Chart::Stock
341
+ # 'Chart::Column'
342
+ # 'Chart::Bar'
343
+ # 'Chart::Line'
344
+ # 'Chart::Area'
345
+ # 'Chart::Pie'
346
+ # 'Chart::Scatter'
347
+ # 'Chart::Stock'
348
348
  #
349
349
  # * :name
350
350
  #
@@ -355,7 +355,7 @@ class Workbook < BIFFWriter
355
355
  # charts.
356
356
  #
357
357
  # chart = workbook.add_chart(
358
- # :type => Chart::Line,
358
+ # :type => 'Chart::Line',
359
359
  # :name => 'Results Chart'
360
360
  # )
361
361
  #
@@ -365,7 +365,7 @@ class Workbook < BIFFWriter
365
365
  # the insert_chart() Worksheet method. It is an error to try insert a
366
366
  # Chart that doesn't have this flag set.
367
367
  #
368
- # chart = workbook.add_chart(:type => Chart::Line, :embedded => 1)
368
+ # chart = workbook.add_chart(:type => 'Chart::Line', :embedded => 1)
369
369
  #
370
370
  # # Configure the chart.
371
371
  # ...
@@ -407,7 +407,7 @@ class Workbook < BIFFWriter
407
407
  @sinfo
408
408
  ]
409
409
 
410
- chart = Chart.factory(type, *init_data)
410
+ chart = Writeexcel::Chart.factory(type, *init_data)
411
411
  # If the chart isn't embedded let the workbook control it.
412
412
  if !embedded
413
413
  @worksheets[index] = chart # Store ref for iterator
@@ -451,7 +451,7 @@ class Workbook < BIFFWriter
451
451
  @sinfo
452
452
  ]
453
453
 
454
- chart = Chart.factory(self, type, init_data)
454
+ chart = Writeexcel::Chart.factory(self, type, init_data)
455
455
  @worksheets[index] = chart # Store ref for iterator
456
456
  @sheetnames[index] = name # Store EXTERNSHEET names
457
457
  chart
@@ -577,7 +577,7 @@ class Workbook < BIFFWriter
577
577
  def add_format(*args)
578
578
  formats = {}
579
579
  args.each { |arg| formats = formats.merge(arg) }
580
- format = Format.new(@xf_index, @default_formats.merge(formats))
580
+ format = Writeexcel::Format.new(@xf_index, @default_formats.merge(formats))
581
581
  @xf_index += 1
582
582
  @formats.push format # Store format reference
583
583
  format
@@ -1691,21 +1691,21 @@ class Workbook < BIFFWriter
1691
1691
  # chart fonts are set in the FBI record of the chart.
1692
1692
 
1693
1693
  # Index 5. Axis numbers.
1694
- tmp_format = Format.new(
1694
+ tmp_format = Writeexcel::Format.new(
1695
1695
  nil,
1696
1696
  :font_only => 1
1697
1697
  )
1698
1698
  append(tmp_format.get_font)
1699
1699
 
1700
1700
  # Index 6. Series names.
1701
- tmp_format = Format.new(
1701
+ tmp_format = Writeexcel::Format.new(
1702
1702
  nil,
1703
1703
  :font_only => 1
1704
1704
  )
1705
1705
  append(tmp_format.get_font)
1706
1706
 
1707
1707
  # Index 7. Title.
1708
- tmp_format = Format.new(
1708
+ tmp_format = Writeexcel::Format.new(
1709
1709
  nil,
1710
1710
  :font_only => 1,
1711
1711
  :bold => 1
@@ -1713,7 +1713,7 @@ class Workbook < BIFFWriter
1713
1713
  append(tmp_format.get_font)
1714
1714
 
1715
1715
  # Index 8. Axes.
1716
- tmp_format = Format.new(
1716
+ tmp_format = Writeexcel::Format.new(
1717
1717
  nil,
1718
1718
  :font_only => 1,
1719
1719
  :bold => 1
@@ -1721,7 +1721,7 @@ class Workbook < BIFFWriter
1721
1721
  append(tmp_format.get_font)
1722
1722
 
1723
1723
  # Index 9. Comments.
1724
- tmp_format = Format.new(
1724
+ tmp_format = Writeexcel::Format.new(
1725
1725
  nil,
1726
1726
  :font_only => 1,
1727
1727
  :font => 'Tahoma',
@@ -30,6 +30,9 @@ end
30
30
  # worksheet1 = workbook.add_worksheet
31
31
  # worksheet2 = workbook.add_worksheet
32
32
  #
33
+
34
+ module Writeexcel
35
+
33
36
  class Worksheet < BIFFWriter
34
37
  require 'writeexcel/helper'
35
38
  private :convert_to_ascii_if_ascii
@@ -3725,17 +3728,7 @@ class Worksheet < BIFFWriter
3725
3728
  col = $1
3726
3729
  row = $2.to_i
3727
3730
 
3728
- # Convert base26 column string to number
3729
- # All your Base are belong to us.
3730
- chars = col.split(//)
3731
- expn = 0
3732
- col = 0
3733
-
3734
- while (!chars.empty?)
3735
- char = chars.pop # LS char first
3736
- col += (char.ord - "A".ord + 1) * (26 ** expn)
3737
- expn += 1
3738
- end
3731
+ col = chars_to_col($1.split(//))
3739
3732
 
3740
3733
  # Convert 1-index to zero-index
3741
3734
  row -= 1
@@ -4843,10 +4836,8 @@ class Worksheet < BIFFWriter
4843
4836
  grbit = 0x0100 # Option flags
4844
4837
  ixfe = 0x0F # XF index
4845
4838
 
4846
- header = [record, length].pack("vv")
4847
- data = [row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe].pack("vvvvvvvv")
4848
-
4849
- append(header, data)
4839
+ store_simple(record, length,
4840
+ row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe)
4850
4841
  end
4851
4842
  private :write_row_default
4852
4843
 
@@ -5013,11 +5004,8 @@ class Worksheet < BIFFWriter
5013
5004
  zero = 0x0000
5014
5005
  unknown = 0x0014
5015
5006
 
5016
- header = [record, length].pack("vv")
5017
- data = [record, zero, zero, zero, zero,
5018
- zero, unknown, zero, color, zero].pack("vvvvvvvvvv")
5019
-
5020
- append(header, data)
5007
+ store_simple(record, length, record, zero, zero, zero, zero,
5008
+ zero, unknown, zero, color, zero)
5021
5009
  end
5022
5010
  private :store_tab_color
5023
5011
 
@@ -5050,7 +5038,6 @@ class Worksheet < BIFFWriter
5050
5038
  def store_defcol #:nodoc:
5051
5039
  record = 0x0055 # Record identifier
5052
5040
  length = 0x0002 # Number of bytes to follow
5053
-
5054
5041
  colwidth = 0x0008 # Default column width
5055
5042
 
5056
5043
  header = [record, length].pack("vv")
@@ -5319,10 +5306,7 @@ class Worksheet < BIFFWriter
5319
5306
 
5320
5307
  @active_pane = pnnAct # Used in _store_selection
5321
5308
 
5322
- header = [record, length].pack('vv')
5323
- data = [x, y, rwtop, colleft, pnnAct].pack('vvvvv')
5324
-
5325
- append(header, data)
5309
+ store_simple(record, length, x, y, rwtop, colleft, pnnAct)
5326
5310
  end
5327
5311
  private :store_panes
5328
5312
 
@@ -5549,10 +5533,7 @@ class Worksheet < BIFFWriter
5549
5533
  rwFirst, rwLast = rwLast, rwFirst if rwFirst > rwLast
5550
5534
  colFirst, colLast = colLast, colFirst if colFirst > colLast
5551
5535
 
5552
- header = [record, length].pack("vv")
5553
- data = [cref, rwFirst, rwLast, colFirst, colLast].pack("vvvvv")
5554
-
5555
- append(header, data)
5536
+ store_simple(record, length, cref, rwFirst, rwLast, colFirst, colLast)
5556
5537
  end
5557
5538
 
5558
5539
  ###############################################################################
@@ -5978,7 +5959,7 @@ class Worksheet < BIFFWriter
5978
5959
  # The Chart must be created by the add_chart() Workbook method and it must
5979
5960
  # have the embedded option set.
5980
5961
  #
5981
- # chart = workbook.add_chart(:type => Chart::Line, :embedded => 1 )
5962
+ # chart = workbook.add_chart(:type => 'Chart::Line', :embedded => 1 )
5982
5963
  #
5983
5964
  # # Configure the chart.
5984
5965
  # ...
@@ -6321,10 +6302,7 @@ class Worksheet < BIFFWriter
6321
6302
  record = 0x00A0 # Record identifier
6322
6303
  length = 0x0004 # Bytes to follow
6323
6304
 
6324
- header = [record, header].pack("vv")
6325
- data = [@zoom, 100].pack("vv")
6326
-
6327
- append(header, data)
6305
+ store_simple(record, length, @zoom, 100)
6328
6306
  end
6329
6307
  private :store_zoom
6330
6308
 
@@ -8710,7 +8688,7 @@ class Worksheet < BIFFWriter
8710
8688
  end
8711
8689
 
8712
8690
  # Pack the record.
8713
- data = [flags].pack('V') +
8691
+ data = [flags].pack('V') +
8714
8692
  input_title +
8715
8693
  error_title +
8716
8694
  input_message +
@@ -8818,4 +8796,6 @@ class Worksheet < BIFFWriter
8818
8796
 
8819
8797
  [formula.length, unused].pack('vv') + formula
8820
8798
  end
8821
- end
8799
+ end # class Worksheet
8800
+
8801
+ end # module Writeexcel
data/lib/writeexcel.rb CHANGED
@@ -748,7 +748,7 @@ require 'writeexcel/debug_info'
748
748
  # set_column(first_col, last_col, width, format, hidden, level, collapsed)
749
749
  #
750
750
  # The following example sets an outline level of 1 for rows 1 and 2
751
- # (zero-indexed) and columns B to G. The parameters _height_ and _XF_ are
751
+ # (zero-indexed) and columns B to G. The parameters _height_ and _format_ are
752
752
  # assigned default values since they are undefined:
753
753
  #
754
754
  # worksheet.set_row(1, nil, nil, 0, 1)
@@ -773,9 +773,7 @@ require 'writeexcel/debug_info'
773
773
  # compatibility with OpenOffice.org and Gnumeric.
774
774
  #
775
775
  # For a more complete example see the outline.rb
776
- #--
777
776
  # and outline_collapsed.rb
778
- #++
779
777
  # programs in the examples directory of the distro.
780
778
  #
781
779
  # Some additional outline properties can be set via the outline_settings()
@@ -1060,7 +1058,7 @@ require 'writeexcel/debug_info'
1060
1058
  # workbook = WriteExcel.new('chart.xls')
1061
1059
  # worksheet = workbook.add_worksheet
1062
1060
  #
1063
- # chart = workbook.add_chart(:type => Chart::Column)
1061
+ # chart = workbook.add_chart(:type => 'Chart::Column')
1064
1062
  #
1065
1063
  # # Configure the chart.
1066
1064
  # chart.add_series(
@@ -1087,16 +1085,16 @@ require 'writeexcel/debug_info'
1087
1085
  # The Chart module isn't used directly, a chart object is created via the
1088
1086
  # Workbook add_chart() method where the chart type is specified:
1089
1087
  #
1090
- # chart = workbook.add_chart(:type => Chart::Column)
1088
+ # chart = workbook.add_chart(:type => 'Chart::Column')
1091
1089
  #
1092
1090
  # Currently the supported chart types are:
1093
1091
  #
1094
- # * Chart::Column: Creates a column style (histogram) chart. See Column.
1095
- # * Chart::Bar: Creates a Bar style (transposed histogram) chart. See Bar.
1096
- # * Chart::Line: Creates a Line style chart. See Line.
1097
- # * Chart::Area: Creates an Area (filled line) style chart. See Area.
1098
- # * Chart::Scatter: Creates an Scatter style chart. See Scatter.
1099
- # * Chart::Stock: Creates an Stock style chart. See Stock.
1092
+ # * 'Chart::Column': Creates a column style (histogram) chart. See Column.
1093
+ # * 'Chart::Bar': Creates a Bar style (transposed histogram) chart. See Bar.
1094
+ # * 'Chart::Line': Creates a Line style chart. See Line.
1095
+ # * 'Chart::Area': Creates an Area (filled line) style chart. See Area.
1096
+ # * 'Chart::Scatter': Creates an Scatter style chart. See Scatter.
1097
+ # * 'Chart::Stock': Creates an Stock style chart. See Stock.
1100
1098
  #
1101
1099
  # More chart types will be supported in time. See the "TODO" section.
1102
1100
  #
@@ -17,7 +17,7 @@ class TC_ChartGeneric < Test::Unit::TestCase
17
17
  def setup
18
18
  io = StringIO.new
19
19
  workbook = WriteExcel.new(io)
20
- @chart = Chart.new('', 'chart', 0, 0, 0, 0, 0, 0, 0, 0)
20
+ @chart = Writeexcel::Chart.new('', 'chart', 0, 0, 0, 0, 0, 0, 0, 0)
21
21
  end
22
22
 
23
23
  def teardown