write_xlsx 1.02.0 → 1.04.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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +22 -0
  3. data/README.md +1 -1
  4. data/examples/chart_line.rb +85 -10
  5. data/examples/tables.rb +77 -42
  6. data/lib/write_xlsx/chart/line.rb +15 -1
  7. data/lib/write_xlsx/format.rb +5 -5
  8. data/lib/write_xlsx/package/comments.rb +4 -4
  9. data/lib/write_xlsx/package/relationships.rb +2 -2
  10. data/lib/write_xlsx/package/styles.rb +26 -8
  11. data/lib/write_xlsx/package/table.rb +8 -7
  12. data/lib/write_xlsx/package/vml.rb +20 -19
  13. data/lib/write_xlsx/sheets.rb +12 -20
  14. data/lib/write_xlsx/version.rb +1 -1
  15. data/lib/write_xlsx/workbook.rb +53 -35
  16. data/lib/write_xlsx/worksheet.rb +37 -20
  17. data/test/perl_output/chart_line.xlsx +0 -0
  18. data/test/perl_output/comments2.xlsx +0 -0
  19. data/test/perl_output/tables.xlsx +0 -0
  20. data/test/regression/images/red2.png +0 -0
  21. data/test/regression/test_chart_line05.rb +43 -0
  22. data/test/regression/test_chart_line06.rb +43 -0
  23. data/test/regression/test_comment15.rb +28 -0
  24. data/test/regression/test_comment16.rb +34 -0
  25. data/test/regression/test_header_image15.rb +36 -0
  26. data/test/regression/test_header_image16.rb +42 -0
  27. data/test/regression/test_header_image17.rb +46 -0
  28. data/test/regression/test_header_image18.rb +48 -0
  29. data/test/regression/test_header_image19.rb +36 -0
  30. data/test/regression/test_hyperlink48.rb +31 -0
  31. data/test/regression/test_hyperlink49.rb +29 -0
  32. data/test/regression/test_image45.rb +2 -1
  33. data/test/regression/test_image46.rb +1 -1
  34. data/test/regression/test_image48.rb +32 -0
  35. data/test/regression/test_image49.rb +38 -0
  36. data/test/regression/test_image50.rb +24 -0
  37. data/test/regression/test_image51.rb +30 -0
  38. data/test/regression/test_object_position12.rb +25 -0
  39. data/test/regression/test_object_position13.rb +25 -0
  40. data/test/regression/test_object_position14.rb +25 -0
  41. data/test/regression/test_object_position15.rb +29 -0
  42. data/test/regression/test_object_position16.rb +29 -0
  43. data/test/regression/test_object_position17.rb +29 -0
  44. data/test/regression/test_object_position18.rb +29 -0
  45. data/test/regression/test_object_position19.rb +29 -0
  46. data/test/regression/test_object_position20.rb +29 -0
  47. data/test/regression/test_table24.rb +27 -0
  48. data/test/regression/test_table25.rb +27 -0
  49. data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
  50. data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
  51. data/test/regression/xlsx_files/comment15.xlsx +0 -0
  52. data/test/regression/xlsx_files/comment16.xlsx +0 -0
  53. data/test/regression/xlsx_files/header_image15.xlsx +0 -0
  54. data/test/regression/xlsx_files/header_image16.xlsx +0 -0
  55. data/test/regression/xlsx_files/header_image17.xlsx +0 -0
  56. data/test/regression/xlsx_files/header_image18.xlsx +0 -0
  57. data/test/regression/xlsx_files/header_image19.xlsx +0 -0
  58. data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
  59. data/test/regression/xlsx_files/image45.xlsx +0 -0
  60. data/test/regression/xlsx_files/image46.xlsx +0 -0
  61. data/test/regression/xlsx_files/image48.xlsx +0 -0
  62. data/test/regression/xlsx_files/image49.xlsx +0 -0
  63. data/test/regression/xlsx_files/image50.xlsx +0 -0
  64. data/test/regression/xlsx_files/image51.xlsx +0 -0
  65. data/test/regression/xlsx_files/object_position12.xlsx +0 -0
  66. data/test/regression/xlsx_files/object_position13.xlsx +0 -0
  67. data/test/regression/xlsx_files/object_position14.xlsx +0 -0
  68. data/test/regression/xlsx_files/object_position15.xlsx +0 -0
  69. data/test/regression/xlsx_files/object_position16.xlsx +0 -0
  70. data/test/regression/xlsx_files/object_position17.xlsx +0 -0
  71. data/test/regression/xlsx_files/object_position18.xlsx +0 -0
  72. data/test/regression/xlsx_files/object_position19.xlsx +0 -0
  73. data/test/regression/xlsx_files/object_position20.xlsx +0 -0
  74. data/test/regression/xlsx_files/table24.xlsx +0 -0
  75. data/test/regression/xlsx_files/table25.xlsx +0 -0
  76. data/test/test_example_match.rb +119 -9
  77. data/test/workbook/test_check_sheetname.rb +0 -10
  78. data/write_xlsx.gemspec +1 -0
  79. metadata +120 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd25c9e7242d84cbaa3f58304d292275f56e89353b61f151e9beb2bf9e740e46
4
- data.tar.gz: 6ac71db1cf2089932e2381cb6c20d2b1fa0a82493bc00bafc307d4efbd2da048
3
+ metadata.gz: 9c3893d317a3ab9f246b62c9d6b6b3a727abd9ab539da4edf52c4029f076d566
4
+ data.tar.gz: 64861b9ce57ebd55ce67508b33be19705049a8db520edfacc1fd40d8547c2b9c
5
5
  SHA512:
6
- metadata.gz: aada5fa6d8a1034743af39bcc352b2e15120493c47c4f048006f6db3869c3f1eb8652e437ffb4bdf441b0280596f314bc06d436178c4bd82ea39e8e9dafcc5b8
7
- data.tar.gz: db54ce603031240fe4e5081603042f804a9dd4566e6bd4e5d1b7124fd9f064748654552bb7297881cfc72915e959f26c7459777fd4cceddaee27aeb726aec798
6
+ metadata.gz: c3870b13ed05dca60597ecc86662d15d2ec143667e6ff29349c4409d2dd7966eb9f7246f14071a06524a15f5039cb8ec2d4c6c4fb99206b1377f452abe94eddc
7
+ data.tar.gz: b776541fecba7724e59e5742939e331944ea9a08d87eba2528d29404f9f34bbab8a8abe548fd52735a15c72e42e54c54cc73ad5c06765521647771178229fab0
data/Changes CHANGED
@@ -1,5 +1,27 @@
1
1
  Change history of write_xlsx rubygem.
2
2
 
3
+ 2021-02-14 v1.04.0
4
+
5
+ Added support for "stacked" and "percent_stacked" Line charts.
6
+
7
+ Fix for worksheet objects (charts and images) that are inserted with an
8
+ offset that starts in a hidden cell.
9
+
10
+ Removed error in add_worksheet() for sheet name "History" which is a
11
+ reserved name in English version of Excel. However, this is an allowed
12
+ worksheet name in some Excel variants so the warning has been turned into
13
+ a documentation note instead.
14
+
15
+
16
+ 2021-02-13 v1.03.0
17
+
18
+ Fix for duplicate images being copied to an Excel::Writer::XLSX
19
+ file. Excel uses an optimization where it only stores one copy of a
20
+ repeated/duplicate image in a workbook. WriteXLSX didn't do
21
+ this which meant that the file size would increase when then was a large
22
+ number of repeated images. This release fixes that issue and replicates
23
+ Excel's behaviour.
24
+
3
25
  2021-02-12 v1.02.0
4
26
 
5
27
  Added support for hyperlinks in worksheet images.
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-1.02](https://github.com/jmcnamara/excel-writer-xlsx/tree/CPAN_1.02)
8
+ [Excel::Writer::XLSX-1.04](https://github.com/jmcnamara/excel-writer-xlsx/tree/CPAN_1.04)
9
9
 
10
10
  ## Description
11
11
 
@@ -18,9 +18,9 @@
18
18
  # Add the worksheet data that the charts will refer to.
19
19
  headings = [ 'Number', 'Batch 1', 'Batch 2' ]
20
20
  data = [
21
- [ 2, 3, 4, 5, 6, 7 ],
22
- [ 10, 40, 50, 20, 10, 50 ],
23
- [ 30, 60, 70, 50, 40, 30 ]
21
+ [ 2, 3, 4, 5, 6, 7 ],
22
+ [ 10, 40, 50, 20, 10, 50 ],
23
+ [ 30, 60, 70, 50, 40, 30 ]
24
24
  ]
25
25
 
26
26
  worksheet.write('A1', headings, bold)
@@ -31,21 +31,21 @@
31
31
 
32
32
  # Configure the first series.
33
33
  chart.add_series(
34
- :name => '=Sheet1!$B$1',
35
- :categories => '=Sheet1!$A$2:$A$7',
36
- :values => '=Sheet1!$B$2:$B$7'
34
+ :name => '=Sheet1!$B$1',
35
+ :categories => '=Sheet1!$A$2:$A$7',
36
+ :values => '=Sheet1!$B$2:$B$7'
37
37
  )
38
38
 
39
39
  # Configure second series. Note alternative use of array ref to define
40
40
  # ranges: [ sheetname, row_start, row_end, col_start, col_end ].
41
41
  chart.add_series(
42
- :name => '=Sheet1!$C$1',
43
- :categories => [ 'Sheet1', 1, 6, 0, 0 ],
44
- :values => [ 'Sheet1', 1, 6, 2, 2 ]
42
+ :name => '=Sheet1!$C$1',
43
+ :categories => [ 'Sheet1', 1, 6, 0, 0 ],
44
+ :values => [ 'Sheet1', 1, 6, 2, 2 ]
45
45
  )
46
46
 
47
47
  # Add a chart title and some axis labels.
48
- chart.set_title(:name => 'Results of sample analysis')
48
+ chart.set_title(:name => 'Results of sample analysis')
49
49
  chart.set_x_axis(:name => 'Test number')
50
50
  chart.set_y_axis(:name => 'Sample length (mm)')
51
51
 
@@ -58,4 +58,79 @@
58
58
  :x_offset => 25, :y_offset => 10
59
59
  )
60
60
 
61
+ #
62
+ # Create a stacked chart sub-type
63
+ #
64
+ chart2 = workbook.add_chart(
65
+ :type => 'line',
66
+ :embedded => 1,
67
+ :subtype => 'stacked'
68
+ )
69
+
70
+ # Configure the first series.
71
+ chart2.add_series(
72
+ :name => '=Sheet1!$B$1',
73
+ :categories => '=Sheet1!$A$2:$A$7',
74
+ :values => '=Sheet1!$B$2:$B$7'
75
+ )
76
+
77
+ # Configure second series.
78
+ chart2.add_series(
79
+ :name => '=Sheet1!$C$1',
80
+ :categories => [ 'Sheet1', 1, 6, 0, 0 ],
81
+ :values => [ 'Sheet1', 1, 6, 2, 2 ]
82
+ )
83
+
84
+ # Add a chart title and some axis labels.
85
+ chart2.set_title ( :name => 'Stacked Chart' )
86
+ chart2.set_x_axis( :name => 'Test number' )
87
+ chart2.set_y_axis( :name => 'Sample length (mm)' )
88
+
89
+ # Set an Excel chart style. Blue colors with white outline and shadow.
90
+ chart2.set_style( 12 )
91
+
92
+ # Insert the chart into the worksheet (with an offset).
93
+ worksheet.insert_chart(
94
+ 'D18', chart2,
95
+ { :x_offset => 25, :y_offset => 10 }
96
+ )
97
+
98
+
99
+ #
100
+ # Create a percent stacked chart sub-type
101
+ #
102
+ chart3 = workbook.add_chart(
103
+ :type => 'line',
104
+ :embedded => 1,
105
+ :subtype => 'percent_stacked'
106
+ )
107
+
108
+ # Configure the first series.
109
+ chart3.add_series(
110
+ :name => '=Sheet1!$B$1',
111
+ :categories => '=Sheet1!$A$2:$A$7',
112
+ :values => '=Sheet1!$B$2:$B$7'
113
+ )
114
+
115
+ # Configure second series.
116
+ chart3.add_series(
117
+ :name => '=Sheet1!$C$1',
118
+ :categories => [ 'Sheet1', 1, 6, 0, 0 ],
119
+ :values => [ 'Sheet1', 1, 6, 2, 2 ]
120
+ )
121
+
122
+ # Add a chart title and some axis labels.
123
+ chart3.set_title ( :name => 'Percent Stacked Chart' )
124
+ chart3.set_x_axis( :name => 'Test number' )
125
+ chart3.set_y_axis( :name => 'Sample length (mm)' )
126
+
127
+ # Set an Excel chart style. Blue colors with white outline and shadow.
128
+ chart3.set_style( 13 )
129
+
130
+ # Insert the chart into the worksheet (with an offset).
131
+ worksheet.insert_chart(
132
+ 'D34', chart3,
133
+ { :x_offset => 25, :y_offset => 10 }
134
+ )
135
+
61
136
  workbook.close
data/examples/tables.rb CHANGED
@@ -28,6 +28,7 @@
28
28
  worksheet10 = workbook.add_worksheet
29
29
  worksheet11 = workbook.add_worksheet
30
30
  worksheet12 = workbook.add_worksheet
31
+ worksheet13 = workbook.add_worksheet
31
32
 
32
33
  currency_format = workbook.add_format(:num_format => '$#,##0')
33
34
 
@@ -60,7 +61,7 @@
60
61
  #
61
62
  # Example 2.
62
63
  #
63
- caption = 'Default table with data.';
64
+ caption = 'Default table with data.'
64
65
 
65
66
  # Set the columns widths.
66
67
  worksheet2.set_column('B:G', 12)
@@ -130,7 +131,7 @@
130
131
  #
131
132
  # Example 6.
132
133
  #
133
- caption = 'Table with banded columns but without default banded rows.';
134
+ caption = 'Table with banded columns but without default banded rows.'
134
135
 
135
136
  # Set the columns widths.
136
137
  worksheet6.set_column('B:G', 12)
@@ -149,7 +150,7 @@
149
150
  #
150
151
  # Example 7.
151
152
  #
152
- caption = 'Table with user defined column headers';
153
+ caption = 'Table with user defined column headers'
153
154
 
154
155
  # Set the columns widths.
155
156
  worksheet7.set_column('B:G', 12)
@@ -176,7 +177,7 @@
176
177
  #
177
178
  # Example 8.
178
179
  #
179
- caption = 'Table with user defined column headers';
180
+ caption = 'Table with user defined column headers'
180
181
 
181
182
  # Set the columns widths.
182
183
  worksheet8.set_column('B:G', 12)
@@ -208,7 +209,7 @@
208
209
  #
209
210
  # Example 9.
210
211
  #
211
- caption = 'Table with totals row (but no caption or totals).';
212
+ caption = 'Table with totals row (but no caption or totals).'
212
213
 
213
214
  # Set the columns widths.
214
215
  worksheet9.set_column('B:G', 12)
@@ -241,7 +242,7 @@
241
242
  #
242
243
  # Example 10.
243
244
  #
244
- caption = 'Table with totals row with user captions and functions.';
245
+ caption = 'Table with totals row with user captions and functions.'
245
246
 
246
247
  # Set the columns widths.
247
248
  worksheet10.set_column('B:G', 12)
@@ -275,7 +276,7 @@
275
276
  #
276
277
  # Example 11.
277
278
  #
278
- caption = 'Table with alternative Excel style.';
279
+ caption = 'Table with alternative Excel style.'
279
280
 
280
281
  # Set the columns widths.
281
282
  worksheet11.set_column('B:G', 12)
@@ -310,7 +311,7 @@
310
311
  #
311
312
  # Example 12.
312
313
  #
313
- caption = 'Table with column formats.';
314
+ caption = 'Table with no Excel style.'
314
315
 
315
316
  # Set the columns widths.
316
317
  worksheet12.set_column('B:G', 12)
@@ -320,40 +321,74 @@
320
321
 
321
322
  # Add a table to the worksheet.
322
323
  worksheet12.add_table(
323
- 'B3:G8',
324
- {
325
- :data => data,
326
- :total_row => 1,
327
- :columns => [
328
- { :header => 'Product', :total_string => 'Totals' },
329
- {
330
- :header => 'Quarter 1',
331
- :total_function => 'sum',
332
- :format => currency_format,
333
- },
334
- {
335
- :header => 'Quarter 2',
336
- :total_function => 'sum',
337
- :format => currency_format,
338
- },
339
- {
340
- :header => 'Quarter 3',
341
- :total_function => 'sum',
342
- :format => currency_format,
343
- },
344
- {
345
- :header => 'Quarter 4',
346
- :total_function => 'sum',
347
- :format => currency_format,
348
- },
349
- {
350
- :header => 'Year',
351
- :formula => '=SUM(Table8[@[Quarter 1]:[Quarter 4]])',
352
- :total_function => 'sum',
353
- :format => currency_format,
354
- }
355
- ]
356
- }
324
+ 'B3:G8',
325
+ {
326
+ :data => data,
327
+ :style => 'None',
328
+ :total_row => 1,
329
+ :columns => [
330
+ { :header => 'Product', :total_string => 'Totals' },
331
+ { :header => 'Quarter 1', :total_function => 'sum' },
332
+ { :header => 'Quarter 2', :total_function => 'sum' },
333
+ { :header => 'Quarter 3', :total_function => 'sum' },
334
+ { :header => 'Quarter 4', :total_function => 'sum' },
335
+ {
336
+ :header => 'Year',
337
+ :formula => '=SUM(Table12[@[Quarter 1]:[Quarter 4]])',
338
+ :total_function => 'sum'
339
+ }
340
+ ]
341
+ }
342
+ )
343
+
344
+ ###############################################################################
345
+ #
346
+ # Example 13.
347
+ #
348
+ caption = 'Table with column formats.'
349
+
350
+ # Set the columns widths.
351
+ worksheet13.set_column('B:G', 12)
352
+
353
+ # Write the caption.
354
+ worksheet13.write('B1', caption)
355
+
356
+ # Add a table to the worksheet.
357
+ worksheet13.add_table(
358
+ 'B3:G8',
359
+ {
360
+ :data => data,
361
+ :total_row => 1,
362
+ :columns => [
363
+ { :header => 'Product', :total_string => 'Totals' },
364
+ {
365
+ :header => 'Quarter 1',
366
+ :total_function => 'sum',
367
+ :format => currency_format,
368
+ },
369
+ {
370
+ :header => 'Quarter 2',
371
+ :total_function => 'sum',
372
+ :format => currency_format,
373
+ },
374
+ {
375
+ :header => 'Quarter 3',
376
+ :total_function => 'sum',
377
+ :format => currency_format,
378
+ },
379
+ {
380
+ :header => 'Quarter 4',
381
+ :total_function => 'sum',
382
+ :format => currency_format,
383
+ },
384
+ {
385
+ :header => 'Year',
386
+ :formula => '=SUM(Table8[@[Quarter 1]:[Quarter 4]])',
387
+ :total_function => 'sum',
388
+ :format => currency_format,
389
+ }
390
+ ]
391
+ }
357
392
  )
358
393
 
359
394
  workbook.close
@@ -22,9 +22,17 @@ class Line < self
22
22
 
23
23
  def initialize(subtype)
24
24
  super(subtype)
25
+ @subtype = @subtype || 'standard'
25
26
  @default_marker = Marker.new(:type => 'none')
26
27
  @smooth_allowed = 1
27
28
 
29
+ # Override and reset the default axis values.
30
+ if @subtype == 'percent_stacked'
31
+ @y_axis.defaults[:num_format] = '0%'
32
+ end
33
+
34
+ set_y_axis
35
+
28
36
  # Set the available data label positions for this chart type.
29
37
  @label_position_default = 'right'
30
38
  @label_positions = {
@@ -54,9 +62,15 @@ def write_line_chart(params)
54
62
  series = axes_series(params)
55
63
  return if series.empty?
56
64
 
65
+ if @subtype == 'percent_stacked'
66
+ subtype = 'percentStacked'
67
+ else
68
+ subtype = @subtype
69
+ end
70
+
57
71
  @writer.tag_elements('c:lineChart') do
58
72
  # Write the c:grouping element.
59
- write_grouping('standard')
73
+ write_grouping(subtype)
60
74
  # Write the series elements.
61
75
  series.each {|s| write_series(s)}
62
76
 
@@ -248,11 +248,11 @@ def initialize(formats, params = {}) # :nodoc:
248
248
  #
249
249
  def copy(other)
250
250
  reserve = [
251
- :xf_index,
252
- :dxf_index,
253
- :xdf_format_indices,
254
- :palette
255
- ]
251
+ :xf_index,
252
+ :dxf_index,
253
+ :xdf_format_indices,
254
+ :palette
255
+ ]
256
256
  (instance_variables - reserve).each do |v|
257
257
  instance_variable_set(v, other.instance_variable_get(v))
258
258
  end
@@ -155,7 +155,7 @@ def visibility
155
155
  #
156
156
  def fill_attributes
157
157
  [
158
- ['color2', '#ffffe1']
158
+ ['color2', '#ffffe1']
159
159
  ]
160
160
  end
161
161
 
@@ -164,9 +164,9 @@ def fill_attributes
164
164
  #
165
165
  def write_shadow
166
166
  attributes = [
167
- ['on', 't'],
168
- ['color', 'black'],
169
- ['obscured', 't']
167
+ ['on', 't'],
168
+ ['color', 'black'],
169
+ ['obscured', 't']
170
170
  ]
171
171
 
172
172
  @writer.empty_tag('v:shadow', attributes)
@@ -64,8 +64,8 @@ def add_worksheet_relationship(type, target, target_mode = nil)
64
64
  #
65
65
  def write_relationships
66
66
  attributes = [
67
- ['xmlns', Package_schema]
68
- ]
67
+ ['xmlns', Package_schema]
68
+ ]
69
69
 
70
70
  @writer.tag_elements('Relationships', attributes) do
71
71
  @rels.each { |rel| write_relationship(*rel) }
@@ -20,6 +20,7 @@ def initialize
20
20
  @dxf_formats = []
21
21
  @has_hyperlink = 0
22
22
  @hyperlink_font_id = 0
23
+ @has_comments = false
23
24
  end
24
25
 
25
26
  def set_xml_writer(filename)
@@ -37,7 +38,7 @@ def assemble_xml_file
37
38
  #
38
39
  def set_style_properties(
39
40
  xf_formats, palette, font_count, num_format_count, border_count,
40
- fill_count, custom_colors, dxf_formats
41
+ fill_count, custom_colors, dxf_formats, has_comments
41
42
  )
42
43
  @xf_formats = xf_formats
43
44
  @palette = palette
@@ -47,6 +48,7 @@ def set_style_properties(
47
48
  @fill_count = fill_count
48
49
  @custom_colors = custom_colors
49
50
  @dxf_formats = dxf_formats
51
+ @has_comments = has_comments
50
52
  end
51
53
 
52
54
  #
@@ -148,7 +150,14 @@ def write_num_fmt(num_fmt_id, format_code)
148
150
  # Write the <fonts> element.
149
151
  #
150
152
  def write_fonts
151
- write_format_elements('fonts', @font_count) do
153
+ count = @font_count
154
+
155
+ if @has_comments
156
+ # Add an extra font for comments.
157
+ count += 1
158
+ end
159
+
160
+ write_format_elements('fonts', count) do
152
161
  write_font_base
153
162
  end
154
163
  end
@@ -161,6 +170,21 @@ def write_font_base
161
170
  @hyperlink_font_id = format.font_index unless ptrue?(@hyperlink_font_id)
162
171
  end
163
172
  end
173
+ if @has_comments
174
+ write_comment_font
175
+ end
176
+ end
177
+
178
+ #
179
+ # Write the <font> element used for comments.
180
+ #
181
+ def write_comment_font
182
+ @writer.tag_elements('font') do
183
+ @writer.empty_tag('sz', [['val', 8]])
184
+ write_color('indexed', 81)
185
+ @writer.empty_tag( 'name', [['val', 'Tahoma']])
186
+ @writer.empty_tag( 'family', [['val', 2]])
187
+ end
164
188
  end
165
189
 
166
190
  #
@@ -394,12 +418,6 @@ def write_cell_style_xfs
394
418
  def write_cell_xfs
395
419
  formats = @xf_formats
396
420
 
397
- # Workaround for when the last format is used for the comment font
398
- # and shouldn't be used for cellXfs.
399
- last_format = formats[-1]
400
-
401
- formats.pop if last_format && last_format.font_only != 0
402
-
403
421
  attributes = [ ['count', formats.size] ]
404
422
 
405
423
  @writer.tag_elements('cellXfs', attributes) do