write_xlsx 0.97.0 → 0.99.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +27 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +2 -2
  5. data/lib/write_xlsx/chart.rb +25 -22
  6. data/lib/write_xlsx/chart/axis.rb +2 -2
  7. data/lib/write_xlsx/chart/legend.rb +14 -0
  8. data/lib/write_xlsx/chart/pie.rb +9 -7
  9. data/lib/write_xlsx/chartsheet.rb +30 -2
  10. data/lib/write_xlsx/format.rb +4 -4
  11. data/lib/write_xlsx/package/comments.rb +50 -47
  12. data/lib/write_xlsx/package/conditional_format.rb +9 -1
  13. data/lib/write_xlsx/package/table.rb +5 -0
  14. data/lib/write_xlsx/utility.rb +59 -1
  15. data/lib/write_xlsx/version.rb +1 -1
  16. data/lib/write_xlsx/workbook.rb +30 -5
  17. data/lib/write_xlsx/worksheet.rb +31 -13
  18. data/lib/write_xlsx/worksheet/data_validation.rb +10 -14
  19. data/test/chart/test_write_legend_pos.rb +9 -1
  20. data/test/chartsheet/test_write_sheet_protection.rb +91 -0
  21. data/test/package/comments/test_comments_01.rb +54 -0
  22. data/test/package/comments/test_comments_02.rb +54 -0
  23. data/test/perl_output/formats.xlsx +0 -0
  24. data/test/regression/images/happy.jpg +0 -0
  25. data/test/regression/test_array_formula03.rb +36 -0
  26. data/test/regression/test_autofilter08.rb +110 -0
  27. data/test/regression/test_autofilter09.rb +110 -0
  28. data/test/regression/test_autofilter10.rb +110 -0
  29. data/test/regression/test_chart_axis42.rb +44 -0
  30. data/test/regression/test_chart_axis43.rb +44 -0
  31. data/test/regression/test_chart_legend03.rb +41 -0
  32. data/test/regression/test_chart_legend04.rb +41 -0
  33. data/test/regression/test_chart_legend05.rb +41 -0
  34. data/test/regression/test_chart_legend06.rb +41 -0
  35. data/test/regression/test_chart_legend07.rb +38 -0
  36. data/test/regression/test_comment13.rb +36 -0
  37. data/test/regression/test_cond_format19.rb +64 -0
  38. data/test/regression/test_cond_format20.rb +43 -0
  39. data/test/regression/test_format15.rb +26 -0
  40. data/test/regression/test_image36.rb +26 -0
  41. data/test/regression/test_table23.rb +56 -0
  42. data/test/regression/xlsx_files/array_formula03.xlsx +0 -0
  43. data/test/regression/xlsx_files/autofilter08.xlsx +0 -0
  44. data/test/regression/xlsx_files/autofilter09.xlsx +0 -0
  45. data/test/regression/xlsx_files/autofilter10.xlsx +0 -0
  46. data/test/regression/xlsx_files/chart_axis42.xlsx +0 -0
  47. data/test/regression/xlsx_files/chart_axis43.xlsx +0 -0
  48. data/test/regression/xlsx_files/chart_legend03.xlsx +0 -0
  49. data/test/regression/xlsx_files/chart_legend04.xlsx +0 -0
  50. data/test/regression/xlsx_files/chart_legend05.xlsx +0 -0
  51. data/test/regression/xlsx_files/chart_legend06.xlsx +0 -0
  52. data/test/regression/xlsx_files/chart_legend07.xlsx +0 -0
  53. data/test/regression/xlsx_files/comment13.xlsx +0 -0
  54. data/test/regression/xlsx_files/cond_format19.xlsx +0 -0
  55. data/test/regression/xlsx_files/cond_format20.xlsx +0 -0
  56. data/test/regression/xlsx_files/format15.xlsx +0 -0
  57. data/test/regression/xlsx_files/image36.xlsx +0 -0
  58. data/test/regression/xlsx_files/table23.xlsx +0 -0
  59. data/test/workbook/test_write_workbook_view.rb +36 -0
  60. data/test/worksheet/test_write_data_validation_02.rb +17 -0
  61. data/test/worksheet/test_write_sheet_view.rb +19 -1
  62. metadata +79 -4
  63. data/test/package/comments/test_write_text_t.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1ecd38fb615885768458a04b082d759437fbaf7fb2e07900cc558d18e400e51
4
- data.tar.gz: d1fa5e1696685c9bba199b4ee922c488144f5a2f852644e24fcedd38fed29035
3
+ metadata.gz: a8880984e96fe4a8788fe6642220163ff36932dea018a335d00165a7b2d2ae04
4
+ data.tar.gz: 99153b43aba51974cca58ed8c38d6308814820846b4617444fcd302752843bc5
5
5
  SHA512:
6
- metadata.gz: 1162adaf9f347ef7f9e986b0596877edc9a4e059b1055e5913c576583017af41b78710c44252c2ced77b06dcdd818af269f3c98282e9bc767f211237e8313fac
7
- data.tar.gz: cd4eb41156f364e4685487ae32876d8b35d7907f7f7068442fb22d2afc6a24217794bea5e571720d6db14b80b7c7368ac08502071d5290cc696cd80588901cdd
6
+ metadata.gz: 1b5c868f6e42846e925282b0eed02064b4541e852e72012e083009dbaa44e6bc419f1ad5b630cfe3ca149b12832732b972f340e6038502e1c8acbce9358702d2
7
+ data.tar.gz: 8bc6c84b0bb6c5901516441c7a5b1e45044ba5c26d30c92ac773f0de521e8e78785cd8aa4759a0d0db96d629aedd4aaf2a7453cb1f075b36dd1e61fc34cb217d
data/Changes CHANGED
@@ -1,5 +1,32 @@
1
1
  Change history of write_xlsx rubygem.
2
2
 
3
+ 2021-01-08 v0.99.0
4
+
5
+ Added font and font_size parameters to write_comment().
6
+
7
+ Allow formulas in date field of data_validation().
8
+
9
+ Added top_left chart legend position.
10
+
11
+ Added legend formatting options.
12
+
13
+ Added set_tab_ratio() method to set the ratio between the worksheet tabs
14
+ and the horizontal slider.
15
+
16
+ Added worksheet hide_row_col_headers() method to turn off worksheet row
17
+ and column headings.
18
+
19
+ Add functionality to align chart category axis labels.
20
+
21
+ Fix for issue with special characters in worksheet table functions.
22
+
23
+ Fix handling of 'num_format': '0' in duplicate formats.
24
+
25
+
26
+ 2021-01-03 v0.98.0
27
+
28
+ fixed for autofilter rule with blanks plus another filter.
29
+
3
30
  2021-01-02 v0.97.0
4
31
 
5
32
  Added Excel 2010 data bar features such as solid fills and control over
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2020 Hideo NAKAMURA
1
+ Copyright (c) 2012-2021 Hideo NAKAMURA
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  gem to create a new file in the Excel 2007+ XLSX format, and you can use the
7
7
  same interface as writeexcel gem. write_xlsx is converted from Perl's module
8
- [Excel::Writer::XLSX-0.97](https://github.com/jmcnamara/excel-writer-xlsx) .
8
+ [Excel::Writer::XLSX-0.99](https://github.com/jmcnamara/excel-writer-xlsx) .
9
9
 
10
10
  ## Description
11
11
 
@@ -85,7 +85,7 @@ the first worksheet in an Excel XML spreadsheet called ruby.xlsx:
85
85
  Original Perl module was written by John McNamara(jmcnamara@cpan.org).
86
86
 
87
87
  Converted to ruby by Hideo NAKAMURA(nakamrua.hideo@gmail.com)
88
- Copyright (c) 2012-2020 Hideo NAKAMURA.
88
+ Copyright (c) 2012-2021 Hideo NAKAMURA.
89
89
 
90
90
  See LICENSE.txt for further details.
91
91
 
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'write_xlsx/package/xml_writer_simple'
3
3
  require 'write_xlsx/gradient'
4
+ require 'write_xlsx/chart/legend'
4
5
  require 'write_xlsx/utility'
5
6
  require 'write_xlsx/chart/axis'
6
7
  require 'write_xlsx/chart/caption'
@@ -162,6 +163,7 @@ def numeric_or_downcase(val)
162
163
 
163
164
  class Chart
164
165
  include Writexlsx::Utility
166
+ include Writexlsx::Gradient
165
167
 
166
168
  attr_accessor :id, :name # :nodoc:
167
169
  attr_writer :index, :palette, :protection # :nodoc:
@@ -352,16 +354,8 @@ def set_title(params)
352
354
  # Set the properties of the chart legend.
353
355
  #
354
356
  def set_legend(params)
355
- if params[:none]
356
- @legend_position = 'none'
357
- else
358
- @legend_position = params[:position] || 'right'
359
- end
360
- @legend_delete_series = params[:delete_series]
361
- @legend_font = convert_font_args(params[:font])
362
-
363
- # Set the legend layout.
364
- @legend_layout = layout_properties(params[:layout])
357
+ # Convert the user default properties to internal properties.
358
+ legend_properties(params)
365
359
  end
366
360
 
367
361
  #
@@ -611,7 +605,7 @@ def display_setup
611
605
  @y_scale = 1
612
606
  @x_offset = 0
613
607
  @y_offset = 0
614
- @legend_position = 'right'
608
+ @legend = Legend.new
615
609
  @smooth_allowed = 0
616
610
  @cross_between = 'between'
617
611
  @date_category = false
@@ -1240,7 +1234,7 @@ def write_cat_axis(params) # :nodoc:
1240
1234
  # Write the c:auto element.
1241
1235
  write_auto(1) unless x_axis.text_axis
1242
1236
  # Write the c:labelAlign element.
1243
- write_label_align('ctr')
1237
+ write_label_align(x_axis.label_align)
1244
1238
  # Write the c:labelOffset element.
1245
1239
  write_label_offset(100)
1246
1240
  # Write the c:tickLblSkip element.
@@ -1574,6 +1568,12 @@ def write_auto(val) # :nodoc:
1574
1568
  # Write the <c:labelAlign> element.
1575
1569
  #
1576
1570
  def write_label_align(val) # :nodoc:
1571
+ val ||= 'ctr'
1572
+ if val == 'right'
1573
+ val = 'r'
1574
+ elsif val == 'left'
1575
+ val = 'l'
1576
+ end
1577
1577
  @writer.empty_tag('c:lblAlgn', [ ['val', val] ])
1578
1578
  end
1579
1579
 
@@ -1676,10 +1676,10 @@ def write_c_minor_time_unit(val) # :nodoc:
1676
1676
  # Write the <c:legend> element.
1677
1677
  #
1678
1678
  def write_legend # :nodoc:
1679
- position = @legend_position.sub(/^overlay_/, '')
1679
+ position = @legend.position.sub(/^overlay_/, '')
1680
1680
  return if position == 'none' || (not position_allowed.has_key?(position))
1681
1681
 
1682
- @delete_series = @legend_delete_series if @legend_delete_series.kind_of?(Array)
1682
+ @delete_series = @legend.delete_series if @legend.delete_series.kind_of?(Array)
1683
1683
  @writer.tag_elements('c:legend') do
1684
1684
  # Write the c:legendPos element.
1685
1685
  write_legend_pos(position_allowed[position])
@@ -1687,20 +1687,23 @@ def write_legend # :nodoc:
1687
1687
  # Write the c:legendEntry element.
1688
1688
  @delete_series.each { |i| write_legend_entry(i) } if @delete_series
1689
1689
  # Write the c:layout element.
1690
- write_layout(@legend_layout, 'legend')
1691
- # Write the c:txPr element.
1692
- write_tx_pr(nil, @legend_font) if ptrue?(@legend_font)
1690
+ write_layout(@legend.layout, 'legend')
1693
1691
  # Write the c:overlay element.
1694
- write_overlay if @legend_position =~ /^overlay_/
1692
+ write_overlay if @legend.position =~ /^overlay_/
1693
+ # Write the c:spPr element.
1694
+ write_sp_pr(@legend)
1695
+ # Write the c:txPr element.
1696
+ write_tx_pr(nil, @legend.font) if ptrue?(@legend.font)
1695
1697
  end
1696
1698
  end
1697
1699
 
1698
1700
  def position_allowed
1699
1701
  {
1700
- 'right' => 'r',
1701
- 'left' => 'l',
1702
- 'top' => 't',
1703
- 'bottom' => 'b'
1702
+ 'right' => 'r',
1703
+ 'left' => 'l',
1704
+ 'top' => 't',
1705
+ 'bottom' => 'b',
1706
+ 'top_right' => 'tr'
1704
1707
  }
1705
1708
  end
1706
1709
 
@@ -16,7 +16,7 @@ class Axis < Caption
16
16
  attr_reader :log_base, :crossing, :position_axis, :label_position, :visible
17
17
  attr_reader :num_format_linked, :num_font, :layout, :interval_unit
18
18
  attr_reader :interval_tick, :major_gridlines, :minor_gridlines, :reverse
19
- attr_reader :line, :fill, :text_axis
19
+ attr_reader :line, :fill, :text_axis, :label_align
20
20
  #
21
21
  # Convert user defined axis values into axis instance.
22
22
  #
@@ -28,7 +28,7 @@ def merge_with_hash(params) # :nodoc:
28
28
  :reverse, :min, :max, :minor_unit, :major_unit, :minor_unit_type,
29
29
  :major_unit_type, :log_base, :crossing, :position_axis,
30
30
  :label_position, :num_format, :num_format_linked, :interval_unit,
31
- :interval_tick, :line, :fill
31
+ :interval_tick, :line, :fill, :label_align
32
32
  ].each { |val| instance_variable_set("@#{val}", args[val]) }
33
33
  set_major_minor_gridlines(args)
34
34
 
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ module Writexlsx
4
+ class Chart
5
+ class Legend
6
+ attr_accessor :line, :fill, :pattern, :gradient
7
+ attr_accessor :position, :delete_series, :layout, :font
8
+
9
+ def initialize
10
+ @position = 'right'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -107,15 +107,15 @@ def write_plot_area
107
107
  # Write the <c:legend> element.
108
108
  #
109
109
  def write_legend
110
- position = @legend_position
110
+ position = @legend.position
111
111
  allowed = %w(right left top bottom)
112
- delete_series = @legend_delete_series || []
112
+ delete_series = @legend.delete_series || []
113
113
 
114
- if @legend_position =~ /^overlay_/
115
- position = @legend_position.sub(/^overlay_/, '')
114
+ if @legend.position =~ /^overlay_/
115
+ position = @legend.position.sub(/^overlay_/, '')
116
116
  overlay = true
117
117
  else
118
- position = @legend_position
118
+ position = @legend.position
119
119
  overlay = false
120
120
  end
121
121
 
@@ -129,11 +129,13 @@ def write_legend
129
129
  # Write the c:legendEntry element.
130
130
  delete_series.each { |index| write_legend_entry(index) }
131
131
  # Write the c:layout element.
132
- write_layout(@legend_layout, 'legend')
132
+ write_layout(@legend.layout, 'legend')
133
133
  # Write the c:overlay element.
134
134
  write_overlay if overlay
135
+ # Write the c:spPr element.
136
+ write_sp_pr(@legend)
135
137
  # Write the c:txPr element. Over-ridden.
136
- write_tx_pr_legend(0, @legend_font)
138
+ write_tx_pr_legend(0, @legend.font)
137
139
  end
138
140
  end
139
141
 
@@ -57,11 +57,39 @@ def assemble_xml_file # :nodoc:
57
57
  end
58
58
  end
59
59
 
60
- def protect(password = '', options = {})
60
+ def protect(password = '', user_options = nil, options = {})
61
+ # Objects are default on for chartsheets.
62
+ if user_options
63
+ if user_options.has_key?(:objects)
64
+ if ptrue?(user_options[:objects])
65
+ options[:objects] = 0
66
+ else
67
+ options[:objects] = 1
68
+ end
69
+ else
70
+ options[:objects] = 0
71
+ end
72
+
73
+ if user_options.has_key?(:content)
74
+ options[:content] = user_options[:content]
75
+ else
76
+ options[:content] = 1
77
+ end
78
+ else
79
+ options[:objects] = 0
80
+ options[:content] = 1
81
+ end
82
+
83
+ # Is objects and content are off then the chartsheet isn't locked.
84
+ # except if it has a password.
85
+ if password == '' && ptrue?(options[:objects]) && !ptrue?(options[:content])
86
+ return
87
+ end
88
+
61
89
  @chart.protection = 1
62
90
 
91
+ # Turn off worksheet defaults.
63
92
  options[:sheet] = 0
64
- options[:content] = 1
65
93
  options[:scenarios] = 1
66
94
 
67
95
  super(password, options)
@@ -180,7 +180,7 @@ def initialize(formats, params = {}) # :nodoc:
180
180
  @xf_index = nil
181
181
  @dxf_index = nil
182
182
 
183
- @num_format = 0
183
+ @num_format = 'General'
184
184
  @num_format_index = 0
185
185
  @font_index = 0
186
186
  @font = 'Calibri'
@@ -478,13 +478,13 @@ def self.color(color_code)
478
478
 
479
479
  colors = Colors::COLORS
480
480
 
481
+ # Return the default color if nil,
482
+ return 0x00 unless color_code
483
+
481
484
  if color_code.respond_to?(:to_str)
482
485
  # Return RGB style colors for processing later.
483
486
  return color_code if color_code =~ /^#[0-9A-F]{6}$/i
484
487
 
485
- # Return the default color if undef,
486
- return 0x00 unless color_code
487
-
488
488
  # or the color string converted to an integer,
489
489
  return colors[color_code.downcase.to_sym] if colors[color_code.downcase.to_sym]
490
490
 
@@ -14,28 +14,29 @@ class Comment
14
14
  DEFAULT_HEIGHT = 74
15
15
 
16
16
  attr_reader :row, :col, :string, :color, :vertices
17
+ attr_reader :font_size, :font_family
17
18
  attr_accessor :author, :visible
18
19
 
19
20
  def initialize(workbook, worksheet, row, col, string, options = {})
20
21
  options ||= {}
21
- @workbook = workbook
22
- @worksheet = worksheet
23
- @row, @col = row, col
22
+ @workbook = workbook
23
+ @worksheet = worksheet
24
+ @row, @col = row, col
24
25
  options_parse(row, col, options)
25
- @string = string[0, STR_MAX]
26
- @start_row ||= default_start_row(row)
27
- @start_col ||= default_start_col(col)
28
- @visible = options[:visible]
29
- @x_offset = options[:x_offset] || default_x_offset(col)
30
- @y_offset = options[:y_offset] || default_y_offset(row)
31
- @x_scale = options[:x_scale] || 1
32
- @y_scale = options[:y_scale] || 1
33
- @width = (0.5 + (options[:width] || DEFAULT_WIDTH) * @x_scale).to_i
34
- @height = (0.5 + (options[:height] || DEFAULT_HEIGHT) * @y_scale).to_i
35
- @vertices = @worksheet.position_object_pixels(
36
- @start_col, @start_row, @x_offset, @y_offset,
37
- @width, @height
38
- ) << [@width, @height]
26
+ @string = string[0, STR_MAX]
27
+ @start_row ||= default_start_row(row)
28
+ @start_col ||= default_start_col(col)
29
+ @visible = options[:visible]
30
+ @x_offset = options[:x_offset] || default_x_offset(col)
31
+ @y_offset = options[:y_offset] || default_y_offset(row)
32
+ @x_scale = options[:x_scale] || 1
33
+ @y_scale = options[:y_scale] || 1
34
+ @width = (0.5 + (options[:width] || DEFAULT_WIDTH) * @x_scale).to_i
35
+ @height = (0.5 + (options[:height] || DEFAULT_HEIGHT) * @y_scale).to_i
36
+ @vertices = @worksheet.position_object_pixels(
37
+ @start_col, @start_row, @x_offset, @y_offset,
38
+ @width, @height
39
+ ) << [@width, @height]
39
40
  end
40
41
 
41
42
  def backgrount_color(color)
@@ -213,24 +214,31 @@ def writer=(w)
213
214
  @writer = w
214
215
  end
215
216
 
217
+ def font_name
218
+ @font
219
+ end
220
+
216
221
  private
217
222
 
218
223
  def options_parse(row, col, options)
219
- @color = backgrount_color(options[:color] || DEFAULT_COLOR)
220
- @author = options[:author]
221
- @start_cell = options[:start_cell]
224
+ @color = backgrount_color(options[:color] || DEFAULT_COLOR)
225
+ @author = options[:author]
226
+ @start_cell = options[:start_cell]
222
227
  @start_row, @start_col = if @start_cell
223
228
  substitute_cellref(@start_cell)
224
229
  else
225
230
  [ options[:start_row], options[:start_col] ]
226
231
  end
227
- @visible = options[:visible]
228
- @x_offset = options[:x_offset] || default_x_offset(col)
229
- @y_offset = options[:y_offset] || default_y_offset(row)
230
- @x_scale = options[:x_scale] || 1
231
- @y_scale = options[:y_scale] || 1
232
- @width = (0.5 + (options[:width] || DEFAULT_WIDTH) * @x_scale).to_i
233
- @height = (0.5 + (options[:height] || DEFAULT_HEIGHT) * @y_scale).to_i
232
+ @visible = options[:visible]
233
+ @x_offset = options[:x_offset] || default_x_offset(col)
234
+ @y_offset = options[:y_offset] || default_y_offset(row)
235
+ @x_scale = options[:x_scale] || 1
236
+ @y_scale = options[:y_scale] || 1
237
+ @font = options[:font] || 'Tahoma'
238
+ @font_size = options[:font_size] || 8
239
+ @font_family = options[:font_family] || 2
240
+ @width = (0.5 + (options[:width] || DEFAULT_WIDTH) * @x_scale).to_i
241
+ @height = (0.5 + (options[:height] || DEFAULT_HEIGHT) * @y_scale).to_i
234
242
  end
235
243
  end
236
244
 
@@ -366,36 +374,37 @@ def write_comment(comment)
366
374
  attributes << ['authorId', author_id]
367
375
 
368
376
  @writer.tag_elements('comment', attributes) do
369
- write_text(comment.string)
377
+ write_text(comment)
370
378
  end
371
379
  end
372
380
 
373
381
  #
374
382
  # Write the <text> element.
375
383
  #
376
- def write_text(text)
384
+ def write_text(comment)
377
385
  @writer.tag_elements('text') do
378
386
  # Write the text r element.
379
- write_text_r(text)
387
+ write_text_r(comment)
380
388
  end
381
389
  end
382
390
 
383
391
  #
384
392
  # Write the <r> element.
385
393
  #
386
- def write_text_r(text)
394
+ def write_text_r(comment)
387
395
  @writer.tag_elements('r') do
388
396
  # Write the rPr element.
389
- write_r_pr
397
+ write_r_pr(comment)
390
398
  # Write the text r element.
391
- write_text_t(text)
399
+ write_text_t(comment)
392
400
  end
393
401
  end
394
402
 
395
403
  #
396
404
  # Write the text <t> element.
397
405
  #
398
- def write_text_t(text)
406
+ def write_text_t(comment)
407
+ text = comment.string
399
408
  attributes = []
400
409
 
401
410
  attributes << ['xml:space', 'preserve'] if text =~ /^\s/ || text =~ /\s$/
@@ -406,25 +415,23 @@ def write_text_t(text)
406
415
  #
407
416
  # Write the <rPr> element.
408
417
  #
409
- def write_r_pr
418
+ def write_r_pr(comment)
410
419
  @writer.tag_elements('rPr') do
411
420
  # Write the sz element.
412
- write_sz
421
+ write_sz(comment.font_size)
413
422
  # Write the color element.
414
423
  write_color
415
424
  # Write the rFont element.
416
- write_r_font
425
+ write_r_font(comment.font_name)
417
426
  # Write the family element.
418
- write_family
427
+ write_family(comment.font_family)
419
428
  end
420
429
  end
421
430
 
422
431
  #
423
432
  # Write the <sz> element.
424
433
  #
425
- def write_sz
426
- val = 8
427
-
434
+ def write_sz(val)
428
435
  attributes = [ ['val', val] ]
429
436
 
430
437
  @writer.empty_tag('sz', attributes)
@@ -440,9 +447,7 @@ def write_color
440
447
  #
441
448
  # Write the <rFont> element.
442
449
  #
443
- def write_r_font
444
- val = 'Tahoma'
445
-
450
+ def write_r_font(val)
446
451
  attributes = [ ['val', val] ]
447
452
 
448
453
  @writer.empty_tag('rFont', attributes)
@@ -451,9 +456,7 @@ def write_r_font
451
456
  #
452
457
  # Write the <family> element.
453
458
  #
454
- def write_family
455
- val = 2
456
-
459
+ def write_family(val)
457
460
  attributes = [ ['val', val] ]
458
461
 
459
462
  @writer.empty_tag('family', attributes)