write_xlsx 0.55.0 → 0.56.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -8,17 +8,18 @@ The WriteXLSX supports the following features:
8
8
  * Multiple worksheets
9
9
  * Strings and numbers
10
10
  * Unicode text
11
- * Rich string formats
11
+ * Cell formatting
12
12
  * Formulas (including array formats)
13
- * cell formatting
14
- * Embedded images
13
+ * Images
15
14
  * Charts
16
15
  * Autofilters
17
16
  * Data validation
18
17
  * Conditional formatting
19
18
  * Tables
20
19
  * Shapes
20
+ * Sparklines
21
21
  * Hyperlinks
22
+ * Rich string formats
22
23
  * Defined names
23
24
  * Grouping/Outlines
24
25
  * Cell comments
@@ -27,6 +28,20 @@ The WriteXLSX supports the following features:
27
28
 
28
29
  write_xlsx uses the same interface as writeexcel gem.
29
30
 
31
+ == Installation
32
+
33
+ Add this line to your application's Gemfile:
34
+
35
+ gem 'writeexcel'
36
+
37
+ And then execute:
38
+
39
+ $ bundle
40
+
41
+ Or install it yourself as:
42
+
43
+ $ gem install writeexcel
44
+
30
45
  == Synopsis
31
46
 
32
47
  To write a string, a formatted string, a number and a formula to
@@ -59,6 +74,9 @@ the first worksheet in an Excel XML spreadsheet called ruby.xlsx:
59
74
  workbook.close
60
75
 
61
76
  == Recent change
77
+ 2013-02-09 v0.56.0
78
+ Fix for issue where chart creation order had to be the same as the insertion order or charts would be out of sync.
79
+ Fixed issue where gridlines didn't work in Scatter and Stock charts.
62
80
 
63
81
  2013-02-09 v0.55.0
64
82
  Added Sparklines.
@@ -2178,6 +2178,9 @@ def write_cat_val_axis(params) # :nodoc:
2178
2178
  # Write the c:axPos element.
2179
2179
  write_axis_pos(position, y_axis[:_reverse])
2180
2180
 
2181
+ # Write the c:majorGridlines element.
2182
+ write_major_gridlines(x_axis[:_major_gridlines])
2183
+
2181
2184
  # Write the axis title elements.
2182
2185
  if title = x_axis[:_formula]
2183
2186
  write_title_formula(title, y_axis[:_data_id], horiz, x_axis[:_name_font])
@@ -2277,6 +2280,10 @@ def write_date_axis(params) # :nodoc:
2277
2280
 
2278
2281
  # Write the c:axPos element.
2279
2282
  write_axis_pos(position, y_axis[:reverse])
2283
+
2284
+ # Write the c:majorGridlines element.
2285
+ write_major_gridlines(x_axis[:_major_gridlines])
2286
+
2280
2287
  # Write the axis title elements.
2281
2288
  if title = x_axis[:_formula]
2282
2289
  write_title_formula(title, x_axis[:_data_id], nil, x_axis[:_name_font])
@@ -138,6 +138,8 @@ def show_hidden_data(*args)
138
138
  # Set up chart/drawings.
139
139
  #
140
140
  def prepare_chart(index, chart_id, drawing_id) # :nodoc:
141
+ @chart.id = chart_id - 1
142
+
141
143
  drawing = Drawing.new
142
144
  @drawing = drawing
143
145
  @drawing.orientation = @print_style.orientation
@@ -49,7 +49,7 @@ def empty_tag_encoded(tag, attr = [])
49
49
  end
50
50
 
51
51
  def data_element(tag, data, attr = [])
52
- tag_elements(tag, attr) { io_write("#{escape_xml_chars(data)}") }
52
+ tag_elements(tag, attr) { io_write("#{escape_data(data)}") }
53
53
  end
54
54
 
55
55
  #
@@ -67,7 +67,7 @@ def si_rich_element(data)
67
67
  end
68
68
 
69
69
  def characters(data)
70
- io_write(escape_xml_chars(data))
70
+ io_write(escape_data(data))
71
71
  end
72
72
 
73
73
  def crlf
@@ -96,17 +96,27 @@ def key_val(key, val)
96
96
  def key_vals(attr)
97
97
  array = []
98
98
  (0 .. attr.size-1).step(2) do |i|
99
- array << key_val(attr[i], escape_xml_chars(attr[i+1]))
99
+ array << key_val(attr[i], escape_attributes(attr[i+1]))
100
100
  end
101
101
  array.join('')
102
102
  end
103
103
 
104
- def escape_xml_chars(str = '')
104
+ def escape_attributes(str = '')
105
+ return str if !(str =~ /["&<>]/)
106
+
107
+ str.
108
+ gsub(/&/, "&amp;").
109
+ gsub(/"/, "&quot;").
110
+ gsub(/</, "&lt;").
111
+ gsub(/>/, "&gt;")
112
+ end
113
+
114
+ def escape_data(str = '')
105
115
  if str =~ /[&<>"]/
106
116
  str.gsub(/&/, '&amp;').
107
117
  gsub(/</, '&lt;').
108
118
  gsub(/>/, '&gt;')
109
- else
119
+ else
110
120
  str
111
121
  end
112
122
  end
@@ -1,5 +1,5 @@
1
1
  require 'write_xlsx/workbook'
2
2
 
3
3
  class WriteXLSX < Writexlsx::Workbook
4
- VERSION = "0.55.0"
4
+ VERSION = "0.56.0"
5
5
  end
@@ -358,9 +358,6 @@ def add_chart(params = {})
358
358
  chart = Chart.factory(type, params[:subtype])
359
359
  chart.palette = @palette
360
360
 
361
- # Get an incremental id to use for axes ids.
362
- chart.id = @charts.size
363
-
364
361
  # If the chart isn't embedded let the workbook control it.
365
362
  if ptrue?(embedded)
366
363
  chart.name = name if name
@@ -1638,8 +1635,6 @@ def prepare_drawings #:nodoc:
1638
1635
  shape_count = sheet.shapes.size
1639
1636
  next if chart_count + image_count + shape_count == 0
1640
1637
 
1641
- sheet.sort_charts
1642
-
1643
1638
  drawing_id += 1
1644
1639
 
1645
1640
  (0 .. chart_count - 1).each do |index|
@@ -1665,6 +1660,10 @@ def prepare_drawings #:nodoc:
1665
1660
  @drawings << drawing
1666
1661
  end
1667
1662
 
1663
+ # Sort the workbook charts references into the order that the were
1664
+ # written from the worksheets above.
1665
+ @charts = @charts.sort_by { |chart| chart.id }
1666
+
1668
1667
  @drawing_count = drawing_id
1669
1668
  end
1670
1669
 
@@ -2797,17 +2797,6 @@ def insert_chart(*args)
2797
2797
  @charts << [row, col, chart, x_offset, y_offset, scale_x, scale_y]
2798
2798
  end
2799
2799
 
2800
- #
2801
- # Sort the worksheet charts into the order that they were created in rather
2802
- # than the insertion order. This is ensure that the chart and drawing objects
2803
- # written in the same order. The chart id is used to sort back into creation
2804
- # order.
2805
- #
2806
- def sort_charts
2807
- return if @charts.size < 2
2808
- @charts = @charts.sort {|a, b| a[2].id <=> b[2].id}
2809
- end
2810
-
2811
2800
  #
2812
2801
  # :call-seq:
2813
2802
  # insert_image(row, column, filename [ , x, y, scale_x, scale_y ] )
@@ -3641,7 +3630,7 @@ def valid_table_parameter
3641
3630
  private :valid_table_parameter
3642
3631
 
3643
3632
  #
3644
- # add_sparkline
3633
+ # Add sparklines to the worksheet.
3645
3634
  #
3646
3635
  def add_sparkline(param)
3647
3636
  sparkline = {}
@@ -4652,6 +4641,7 @@ def prepare_chart(index, chart_id, drawing_id) # :nodoc:
4652
4641
  drawing_type = 1
4653
4642
 
4654
4643
  row, col, chart, x_offset, y_offset, scale_x, scale_y = @charts[index]
4644
+ chart.id = chart_id - 1
4655
4645
  scale_x ||= 0
4656
4646
  scale_y ||= 0
4657
4647
 
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartGridlines01 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_gridlines01
14
+ @xlsx = 'chart_gridlines01.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'column', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xls file.
20
+ chart.instance_variable_set(:@axis_ids, [67390848, 68472192])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(:major_gridlines => { :visible => 1 })
35
+ chart.set_y_axis(:major_gridlines => { :visible => 0 })
36
+
37
+ worksheet.insert_chart('E9', chart)
38
+
39
+ workbook.close
40
+ compare_xlsx_for_regression(
41
+ File.join(@regression_output, @xlsx),
42
+ @xlsx
43
+ )
44
+ end
45
+ end
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartGridlines02 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_gridlines02
14
+ @xlsx = 'chart_gridlines02.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'scatter', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xls file.
20
+ chart.instance_variable_set(:@axis_ids, [57940608, 57938688])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(
31
+ :categories => '=Sheet1!$A$1:$A$5',
32
+ :values => '=Sheet1!$B$1:$B$5'
33
+ )
34
+ chart.add_series(
35
+ :categories => '=Sheet1!$A$1:$A$5',
36
+ :values => '=Sheet1!$C$1:$C$5'
37
+ )
38
+
39
+ chart.set_x_axis(:major_gridlines => { :visible => 1 })
40
+ chart.set_y_axis(:major_gridlines => { :visible => 0 })
41
+
42
+ worksheet.insert_chart('E9', chart)
43
+
44
+ workbook.close
45
+ compare_xlsx_for_regression(
46
+ File.join(@regression_output, @xlsx),
47
+ @xlsx
48
+ )
49
+ end
50
+ end
@@ -0,0 +1,65 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartGridlines03 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_gridlines03
14
+ @xlsx = 'chart_gridlines03.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'stock', :embedded => 1)
18
+ data_format = workbook.add_format(:num_format => 14)
19
+
20
+ # For testing, copy the randomly generated axis ids in the target xls file.
21
+ chart.instance_variable_set(:@axis_ids, [54553600, 54977280])
22
+
23
+ data = [
24
+ [ '2007-01-01T', '2007-01-02T', '2007-01-03T', '2007-01-04T', '2007-01-05T' ],
25
+ [ 27.2, 25.03, 19.05, 20.34, 18.5 ],
26
+ [ 23.49, 19.55, 15.12, 17.84, 16.34 ],
27
+ [ 25.45, 23.05, 17.32, 20.45, 17.34 ]
28
+ ]
29
+
30
+ (0..4).each do |row|
31
+ worksheet.write_date_time(row, 0, data[0][row], data_format)
32
+ worksheet.write(row, 1, data[1][row])
33
+ worksheet.write(row, 2, data[2][row])
34
+ worksheet.write(row, 3, data[3][row])
35
+ end
36
+
37
+ worksheet.set_column('A:D', 11)
38
+
39
+ chart.add_series(
40
+ :categories => '=Sheet1!$A$1:$A$5',
41
+ :values => '=Sheet1!$B$1:$B$5'
42
+ )
43
+ chart.add_series(
44
+ :categories => '=Sheet1!$A$1:$A$5',
45
+ :values => '=Sheet1!$C$1:$C$5'
46
+ )
47
+ chart.add_series(
48
+ :categories => '=Sheet1!$A$1:$A$5',
49
+ :values => '=Sheet1!$D$1:$D$5'
50
+ )
51
+
52
+ chart.set_x_axis(:major_gridlines => { :visible => 1 })
53
+ chart.set_y_axis(:major_gridlines => { :visible => 0 })
54
+
55
+ worksheet.insert_chart('E9', chart)
56
+
57
+ workbook.close
58
+ compare_xlsx_for_regression(
59
+ File.join(@regression_output, @xlsx),
60
+ @xlsx,
61
+ [],
62
+ {'xl/charts/chart1.xml' => ['<c:formatCode', '<c:pageMargins']}
63
+ )
64
+ end
65
+ end
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartGridlines04 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_gridlines04
14
+ @xlsx = 'chart_gridlines04.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'radar', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xls file.
20
+ chart.instance_variable_set(:@axis_ids, [54977280, 54978816])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_y_axis(:major_gridlines => { :visible => 0 })
35
+ chart.instance_variable_get(:@y_axis)[:_major_tick_mark] = 'cross'
36
+
37
+ worksheet.insert_chart('E9', chart)
38
+
39
+ workbook.close
40
+ compare_xlsx_for_regression(
41
+ File.join(@regression_output, @xlsx),
42
+ @xlsx
43
+ )
44
+ end
45
+ end
@@ -46,8 +46,8 @@ def test_chart_name03
46
46
  chart2.add_series(:values => '=Sheet1!$B$1:$B$5')
47
47
  chart2.add_series(:values => '=Sheet1!$C$1:$C$5')
48
48
 
49
- worksheet.insert_chart('E24', chart2)
50
49
  worksheet.insert_chart('E9', chart1)
50
+ worksheet.insert_chart('E24', chart2)
51
51
 
52
52
  workbook.close
53
53
  compare_xlsx_for_regression(
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartOrder01 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_order01
14
+ @xlsx = 'chart_order01.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet1 = workbook.add_worksheet
17
+ worksheet2 = workbook.add_worksheet
18
+ worksheet3 = workbook.add_worksheet
19
+
20
+ chart1 = workbook.add_chart(:type => 'column', :embedded => 1)
21
+ chart2 = workbook.add_chart(:type => 'bar', :embedded => 1)
22
+ chart3 = workbook.add_chart(:type => 'line', :embedded => 1)
23
+ chart4 = workbook.add_chart(:type => 'pie', :embedded => 1)
24
+
25
+ # For testing, copy the randomly generated axis ids in the target xls file.
26
+ chart1.instance_variable_set(:@axis_ids, [54976896, 54978432])
27
+ chart2.instance_variable_set(:@axis_ids, [54310784, 54312320])
28
+ chart3.instance_variable_set(:@axis_ids, [69816704, 69818240])
29
+ chart4.instance_variable_set(:@axis_ids, [69816704, 69818240])
30
+
31
+ data = [
32
+ [ 1, 2, 3, 4, 5 ],
33
+ [ 2, 4, 6, 8, 10 ],
34
+ [ 3, 6, 9, 12, 15 ]
35
+ ]
36
+
37
+ worksheet1.write('A1', data)
38
+ worksheet2.write('A1', data)
39
+ worksheet3.write('A1', data)
40
+
41
+ chart1.add_series(:values => '=Sheet1!$A$1:$A$5')
42
+ chart2.add_series(:values => '=Sheet2!$A$1:$A$5')
43
+ chart3.add_series(:values => '=Sheet3!$A$1:$A$5')
44
+ chart4.add_series(:values => '=Sheet1!$B$1:$B$5')
45
+
46
+ worksheet1.insert_chart('E9', chart1)
47
+ worksheet2.insert_chart('E9', chart2)
48
+ worksheet3.insert_chart('E9', chart3)
49
+ worksheet1.insert_chart('E24', chart4)
50
+
51
+ workbook.close
52
+ compare_xlsx_for_regression(
53
+ File.join(@regression_output, @xlsx),
54
+ @xlsx
55
+ )
56
+ end
57
+ end
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartOrder02 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_order02
14
+ @xlsx = 'chart_order01.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet1 = workbook.add_worksheet
17
+ worksheet2 = workbook.add_worksheet
18
+ worksheet3 = workbook.add_worksheet
19
+
20
+ chart4 = workbook.add_chart(:type => 'pie', :embedded => 1)
21
+ chart3 = workbook.add_chart(:type => 'line', :embedded => 1)
22
+ chart2 = workbook.add_chart(:type => 'bar', :embedded => 1)
23
+ chart1 = workbook.add_chart(:type => 'column', :embedded => 1)
24
+
25
+ # For testing, copy the randomly generated axis ids in the target xls file.
26
+ chart1.instance_variable_set(:@axis_ids, [54976896, 54978432])
27
+ chart2.instance_variable_set(:@axis_ids, [54310784, 54312320])
28
+ chart3.instance_variable_set(:@axis_ids, [69816704, 69818240])
29
+ chart4.instance_variable_set(:@axis_ids, [69816704, 69818240])
30
+
31
+ data = [
32
+ [ 1, 2, 3, 4, 5 ],
33
+ [ 2, 4, 6, 8, 10 ],
34
+ [ 3, 6, 9, 12, 15 ]
35
+ ]
36
+
37
+ worksheet1.write('A1', data)
38
+ worksheet2.write('A1', data)
39
+ worksheet3.write('A1', data)
40
+
41
+ chart1.add_series(:values => '=Sheet1!$A$1:$A$5')
42
+ chart2.add_series(:values => '=Sheet2!$A$1:$A$5')
43
+ chart3.add_series(:values => '=Sheet3!$A$1:$A$5')
44
+ chart4.add_series(:values => '=Sheet1!$B$1:$B$5')
45
+
46
+ worksheet1.insert_chart('E9', chart1)
47
+ worksheet2.insert_chart('E9', chart2)
48
+ worksheet3.insert_chart('E9', chart3)
49
+ worksheet1.insert_chart('E24', chart4)
50
+
51
+ workbook.close
52
+ compare_xlsx_for_regression(
53
+ File.join(@regression_output, @xlsx),
54
+ @xlsx
55
+ )
56
+ end
57
+ end
@@ -0,0 +1,62 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestChartOrder03 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_order03
14
+ @xlsx = 'chart_order03.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet1 = workbook.add_worksheet
17
+ worksheet2 = workbook.add_worksheet
18
+ chart2 = workbook.add_chart(:type => 'bar')
19
+ worksheet3 = workbook.add_worksheet
20
+
21
+ chart4 = workbook.add_chart(:type => 'pie', :embedded => 1)
22
+ chart3 = workbook.add_chart(:type => 'line', :embedded => 1)
23
+ chart1 = workbook.add_chart(:type => 'column', :embedded => 1)
24
+
25
+ # For testing, copy the randomly generated axis ids in the target xls file.
26
+ chart1.instance_variable_set(:@axis_ids, [67913600, 68169088])
27
+ chart2.instance_variable_get(:@chart).
28
+ instance_variable_set(:@axis_ids, [58117120, 67654400])
29
+ chart3.instance_variable_set(:@axis_ids, [58109952, 68215936])
30
+
31
+ data = [
32
+ [ 1, 2, 3, 4, 5 ],
33
+ [ 2, 4, 6, 8, 10 ],
34
+ [ 3, 6, 9, 12, 15 ]
35
+ ]
36
+
37
+ worksheet1.write('A1', data)
38
+ worksheet2.write('A1', data)
39
+ worksheet3.write('A1', data)
40
+
41
+ chart1.add_series(:values => '=Sheet1!$A$1:$A$5')
42
+ chart2.add_series(:values => '=Sheet2!$A$1:$A$5')
43
+ chart3.add_series(:values => '=Sheet3!$A$1:$A$5')
44
+ chart4.add_series(:values => '=Sheet1!$B$1:$B$5')
45
+
46
+ worksheet1.insert_chart('E9', chart1)
47
+ worksheet3.insert_chart('E9', chart3)
48
+ worksheet1.insert_chart('E24', chart4)
49
+
50
+ workbook.close
51
+ compare_xlsx_for_regression(
52
+ File.join(@regression_output, @xlsx),
53
+ @xlsx,
54
+ [],
55
+ {
56
+ 'xl/charts/chart1.xml' => [ '<c:formatCode', '<c:pageMargins' ],
57
+ 'xl/charts/chart2.xml' => [ '<c:formatCode', '<c:pageMargins' ],
58
+ 'xl/charts/chart4.xml' => [ '<c:formatCode', '<c:pageMargins' ]
59
+ }
60
+ )
61
+ end
62
+ end
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionEscapes06 < Test::Unit::TestCase
5
+ def setup
6
+ setup_dir_var
7
+ end
8
+
9
+ def teardown
10
+ File.delete(@xlsx) if File.exist?(@xlsx)
11
+ end
12
+
13
+ def test_chart_escapes06
14
+ @xlsx = 'escapes06.xlsx'
15
+ workbook = WriteXLSX.new(@xlsx)
16
+ worksheet = workbook.add_worksheet
17
+ num_format = workbook.add_format(:num_format => '[Red]0.0%\\ "a"')
18
+
19
+ worksheet.set_column('A:A', 14)
20
+
21
+ worksheet.write('A1', 123, num_format)
22
+
23
+ workbook.close
24
+ compare_xlsx_for_regression(
25
+ File.join(@regression_output, @xlsx),
26
+ @xlsx
27
+ )
28
+ end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: write_xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.0
4
+ version: 0.56.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -421,11 +421,18 @@ files:
421
421
  - test/regression/test_chart_format16.rb
422
422
  - test/regression/test_chart_format17.rb
423
423
  - test/regression/test_chart_format18.rb
424
+ - test/regression/test_chart_gridlines01.rb
425
+ - test/regression/test_chart_gridlines02.rb
426
+ - test/regression/test_chart_gridlines03.rb
427
+ - test/regression/test_chart_gridlines04.rb
424
428
  - test/regression/test_chart_line01.rb
425
429
  - test/regression/test_chart_line02.rb
426
430
  - test/regression/test_chart_name01.rb
427
431
  - test/regression/test_chart_name02.rb
428
432
  - test/regression/test_chart_name03.rb
433
+ - test/regression/test_chart_order01.rb
434
+ - test/regression/test_chart_order02.rb
435
+ - test/regression/test_chart_order03.rb
429
436
  - test/regression/test_chart_pie01.rb
430
437
  - test/regression/test_chart_radar01.rb
431
438
  - test/regression/test_chart_radar02.rb
@@ -480,6 +487,7 @@ files:
480
487
  - test/regression/test_escapes03.rb
481
488
  - test/regression/test_escapes04.rb
482
489
  - test/regression/test_escapes05.rb
490
+ - test/regression/test_escapes06.rb
483
491
  - test/regression/test_fit_to_pages01.rb
484
492
  - test/regression/test_fit_to_pages02.rb
485
493
  - test/regression/test_fit_to_pages03.rb
@@ -703,11 +711,17 @@ files:
703
711
  - test/regression/xlsx_files/chart_format16.xlsx
704
712
  - test/regression/xlsx_files/chart_format17.xlsx
705
713
  - test/regression/xlsx_files/chart_format18.xlsx
714
+ - test/regression/xlsx_files/chart_gridlines01.xlsx
715
+ - test/regression/xlsx_files/chart_gridlines02.xlsx
716
+ - test/regression/xlsx_files/chart_gridlines03.xlsx
717
+ - test/regression/xlsx_files/chart_gridlines04.xlsx
706
718
  - test/regression/xlsx_files/chart_line01.xlsx
707
719
  - test/regression/xlsx_files/chart_line02.xlsx
708
720
  - test/regression/xlsx_files/chart_name01.xlsx
709
721
  - test/regression/xlsx_files/chart_name02.xlsx
710
722
  - test/regression/xlsx_files/chart_name03.xlsx
723
+ - test/regression/xlsx_files/chart_order01.xlsx
724
+ - test/regression/xlsx_files/chart_order03.xlsx
711
725
  - test/regression/xlsx_files/chart_pie01.xlsx
712
726
  - test/regression/xlsx_files/chart_radar01.xlsx
713
727
  - test/regression/xlsx_files/chart_radar02.xlsx
@@ -763,6 +777,7 @@ files:
763
777
  - test/regression/xlsx_files/escapes03.xlsx
764
778
  - test/regression/xlsx_files/escapes04.xlsx
765
779
  - test/regression/xlsx_files/escapes05.xlsx
780
+ - test/regression/xlsx_files/escapes06.xlsx
766
781
  - test/regression/xlsx_files/filehandle01.xlsx
767
782
  - test/regression/xlsx_files/fit_to_pages01.xlsx
768
783
  - test/regression/xlsx_files/fit_to_pages02.xlsx
@@ -1295,11 +1310,18 @@ test_files:
1295
1310
  - test/regression/test_chart_format16.rb
1296
1311
  - test/regression/test_chart_format17.rb
1297
1312
  - test/regression/test_chart_format18.rb
1313
+ - test/regression/test_chart_gridlines01.rb
1314
+ - test/regression/test_chart_gridlines02.rb
1315
+ - test/regression/test_chart_gridlines03.rb
1316
+ - test/regression/test_chart_gridlines04.rb
1298
1317
  - test/regression/test_chart_line01.rb
1299
1318
  - test/regression/test_chart_line02.rb
1300
1319
  - test/regression/test_chart_name01.rb
1301
1320
  - test/regression/test_chart_name02.rb
1302
1321
  - test/regression/test_chart_name03.rb
1322
+ - test/regression/test_chart_order01.rb
1323
+ - test/regression/test_chart_order02.rb
1324
+ - test/regression/test_chart_order03.rb
1303
1325
  - test/regression/test_chart_pie01.rb
1304
1326
  - test/regression/test_chart_radar01.rb
1305
1327
  - test/regression/test_chart_radar02.rb
@@ -1354,6 +1376,7 @@ test_files:
1354
1376
  - test/regression/test_escapes03.rb
1355
1377
  - test/regression/test_escapes04.rb
1356
1378
  - test/regression/test_escapes05.rb
1379
+ - test/regression/test_escapes06.rb
1357
1380
  - test/regression/test_fit_to_pages01.rb
1358
1381
  - test/regression/test_fit_to_pages02.rb
1359
1382
  - test/regression/test_fit_to_pages03.rb
@@ -1577,11 +1600,17 @@ test_files:
1577
1600
  - test/regression/xlsx_files/chart_format16.xlsx
1578
1601
  - test/regression/xlsx_files/chart_format17.xlsx
1579
1602
  - test/regression/xlsx_files/chart_format18.xlsx
1603
+ - test/regression/xlsx_files/chart_gridlines01.xlsx
1604
+ - test/regression/xlsx_files/chart_gridlines02.xlsx
1605
+ - test/regression/xlsx_files/chart_gridlines03.xlsx
1606
+ - test/regression/xlsx_files/chart_gridlines04.xlsx
1580
1607
  - test/regression/xlsx_files/chart_line01.xlsx
1581
1608
  - test/regression/xlsx_files/chart_line02.xlsx
1582
1609
  - test/regression/xlsx_files/chart_name01.xlsx
1583
1610
  - test/regression/xlsx_files/chart_name02.xlsx
1584
1611
  - test/regression/xlsx_files/chart_name03.xlsx
1612
+ - test/regression/xlsx_files/chart_order01.xlsx
1613
+ - test/regression/xlsx_files/chart_order03.xlsx
1585
1614
  - test/regression/xlsx_files/chart_pie01.xlsx
1586
1615
  - test/regression/xlsx_files/chart_radar01.xlsx
1587
1616
  - test/regression/xlsx_files/chart_radar02.xlsx
@@ -1637,6 +1666,7 @@ test_files:
1637
1666
  - test/regression/xlsx_files/escapes03.xlsx
1638
1667
  - test/regression/xlsx_files/escapes04.xlsx
1639
1668
  - test/regression/xlsx_files/escapes05.xlsx
1669
+ - test/regression/xlsx_files/escapes06.xlsx
1640
1670
  - test/regression/xlsx_files/filehandle01.xlsx
1641
1671
  - test/regression/xlsx_files/fit_to_pages01.xlsx
1642
1672
  - test/regression/xlsx_files/fit_to_pages02.xlsx