axlsx 1.1.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.yardopts +5 -2
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +48 -46
  4. data/Rakefile +3 -3
  5. data/examples/basic_charts.rb +8 -0
  6. data/examples/example.rb +7 -1
  7. data/examples/example.xlsx +0 -0
  8. data/examples/example_streamed.xlsx +0 -0
  9. data/examples/no-use_autowidth.xlsx +0 -0
  10. data/examples/scraping_html.rb +91 -0
  11. data/examples/shared_strings_example.xlsx +0 -0
  12. data/lib/axlsx.rb +14 -8
  13. data/lib/axlsx/drawing/bar_3D_chart.rb +2 -8
  14. data/lib/axlsx/drawing/chart.rb +29 -25
  15. data/lib/axlsx/drawing/d_lbls.rb +100 -0
  16. data/lib/axlsx/drawing/drawing.rb +2 -0
  17. data/lib/axlsx/drawing/line_3D_chart.rb +2 -9
  18. data/lib/axlsx/drawing/pie_3D_chart.rb +3 -0
  19. data/lib/axlsx/drawing/scatter_chart.rb +2 -8
  20. data/lib/axlsx/drawing/two_cell_anchor.rb +38 -1
  21. data/lib/axlsx/util/simple_typed_list.rb +13 -6
  22. data/lib/axlsx/version.rb +2 -7
  23. data/lib/axlsx/workbook/defined_name.rb +174 -0
  24. data/lib/axlsx/workbook/defined_names.rb +21 -0
  25. data/lib/axlsx/workbook/workbook.rb +39 -13
  26. data/lib/axlsx/workbook/worksheet/auto_filter.rb +34 -0
  27. data/lib/axlsx/workbook/worksheet/cell.rb +24 -1
  28. data/lib/axlsx/workbook/worksheet/col.rb +15 -0
  29. data/lib/axlsx/workbook/worksheet/cols.rb +20 -0
  30. data/lib/axlsx/workbook/worksheet/comments.rb +8 -0
  31. data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +25 -0
  32. data/lib/axlsx/workbook/worksheet/data_validations.rb +28 -0
  33. data/lib/axlsx/workbook/worksheet/dimension.rb +65 -0
  34. data/lib/axlsx/workbook/worksheet/merged_cells.rb +35 -0
  35. data/lib/axlsx/workbook/worksheet/protected_ranges.rb +34 -0
  36. data/lib/axlsx/workbook/worksheet/row.rb +1 -1
  37. data/lib/axlsx/workbook/worksheet/sheet_data.rb +25 -0
  38. data/lib/axlsx/workbook/worksheet/sheet_pr.rb +24 -0
  39. data/lib/axlsx/workbook/worksheet/tables.rb +31 -0
  40. data/lib/axlsx/workbook/worksheet/worksheet.rb +263 -380
  41. data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +57 -0
  42. data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +64 -0
  43. data/test/drawing/tc_bar_series.rb +1 -1
  44. data/test/drawing/tc_chart.rb +7 -1
  45. data/test/drawing/tc_d_lbls.rb +47 -0
  46. data/test/drawing/tc_drawing.rb +5 -4
  47. data/test/drawing/tc_line_series.rb +1 -1
  48. data/test/drawing/tc_pie_3D_chart.rb +1 -1
  49. data/test/drawing/tc_pie_series.rb +1 -1
  50. data/test/drawing/tc_scatter_series.rb +1 -1
  51. data/test/drawing/tc_series.rb +1 -1
  52. data/test/tc_package.rb +16 -1
  53. data/test/workbook/tc_defined_name.rb +41 -0
  54. data/test/workbook/tc_workbook.rb +5 -3
  55. data/test/workbook/worksheet/table/tc_table.rb +0 -8
  56. data/test/workbook/worksheet/tc_cell.rb +2 -4
  57. data/test/workbook/worksheet/tc_protected_range.rb +0 -1
  58. data/test/workbook/worksheet/tc_row.rb +2 -2
  59. data/test/workbook/worksheet/tc_worksheet.rb +19 -21
  60. metadata +48 -7
@@ -0,0 +1,57 @@
1
+ module Axlsx
2
+
3
+ # A wraper class for comments that defines its on worksheet
4
+ # serailization
5
+ class WorksheetComments
6
+
7
+ # Creates a new WorksheetComments object
8
+ # param [Worksheet] worksheet The worksheet comments in thes object belong to
9
+ def initialize(worksheet)
10
+ raise ArugumentError, 'You must provide a worksheet' unless worksheet.is_a?(Worksheet)
11
+ @worksheet = worksheet
12
+ end
13
+
14
+ attr_reader :worksheet
15
+
16
+ # The comments for this worksheet.
17
+ # @return [Comments]
18
+ def comments
19
+ @comments ||= Comments.new(worksheet)
20
+ end
21
+
22
+ # Adds a comment
23
+ # @param [Hash] options
24
+ # @see Comments#add_comment
25
+ def add_comment(options={})
26
+ comments.add_comment(options)
27
+ end
28
+
29
+ # The relationships defined by this objects comments collection
30
+ # @return [Relationships]
31
+ def relationships
32
+ return [] unless has_comments?
33
+ comments.relationships
34
+ end
35
+
36
+
37
+ # Helper method to tell us if there are comments in the comments collection
38
+ # @return [Boolean]
39
+ def has_comments?
40
+ !comments.empty?
41
+ end
42
+
43
+ # The index in the worksheet's relationships for the VML drawing that will render the comments
44
+ # @return [Integer]
45
+ def index
46
+ worksheet.relationships.index { |r| r.Type == VML_DRAWING_R } + 1
47
+ end
48
+
49
+ # Seraalize the object
50
+ # @param [String] str
51
+ # @return [String]
52
+ def to_xml_string(str = '')
53
+ return unless has_comments?
54
+ str << "<legacyDrawing r:id='rId#{index}' />"
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,64 @@
1
+ module Axlsx
2
+
3
+ # This is a utility class for serialing the drawing node in a
4
+ # worksheet. Drawing objects have their own serialization that exports
5
+ # a drawing document. This is only for the single node in the
6
+ # worksheet
7
+ class WorksheetDrawing
8
+
9
+ # Creates a new WorksheetDrawing
10
+ # @param [Worksheet] worksheet
11
+ def initialize(worksheet)
12
+ raise ArgumentError, 'you must provide a worksheet' unless worksheet.is_a?(Worksheet)
13
+ @worksheet = worksheet
14
+ @drawing = nil
15
+ end
16
+
17
+ attr_reader :worksheet
18
+
19
+ attr_reader :drawing
20
+
21
+ # adds a chart to the drawing object
22
+ # @param [Class] chart_type The type of chart to add
23
+ # @param [Hash] options Options to pass on to the drawing and chart
24
+ # @see Worksheet#add_chart
25
+ def add_chart(chart_type, options)
26
+ @drawing ||= Drawing.new worksheet
27
+ drawing.add_chart(chart_type, options)
28
+ end
29
+
30
+ # adds an image to the drawing object
31
+ # @param [Hash] options Options to pass on to the drawing and image
32
+ # @see Worksheet#add_image
33
+ def add_image(options)
34
+ @drawing ||= Drawing.new worksheet
35
+ drawing.add_image(options)
36
+ end
37
+
38
+ # helper method to tell us if the drawing has something in it or not
39
+ # @return [Boolean]
40
+ def has_drawing?
41
+ @drawing.is_a? Drawing
42
+ end
43
+
44
+ # The relationship required by this object
45
+ # @return [Relationship]
46
+ def relationship
47
+ return unless has_drawing?
48
+ Relationship.new(DRAWING_R, "../#{drawing.pn}")
49
+ end
50
+
51
+ # returns the index of the worksheet releationship that defines this drawing.
52
+ # @return [Integer]
53
+ def index
54
+ worksheet.relationships.index{ |r| r.Type == DRAWING_R } +1
55
+ end
56
+
57
+ # Serialize the drawing for the worksheet
58
+ # @param [String] str
59
+ def to_xml_string(str = '')
60
+ return unless has_drawing?
61
+ str << "<drawing r:id='rId#{index}'/>"
62
+ end
63
+ end
64
+ end
@@ -5,7 +5,7 @@ class TestBarSeries < Test::Unit::TestCase
5
5
  def setup
6
6
  p = Axlsx::Package.new
7
7
  @ws = p.workbook.add_worksheet :name=>"hmmm"
8
- @chart = @ws.drawing.add_chart Axlsx::Bar3DChart, :title => "fishery"
8
+ @chart = @ws.add_chart Axlsx::Bar3DChart, :title => "fishery"
9
9
  @series = @chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :colors => ['FF0000', '00FF00', '0000FF'], :shape => :cone
10
10
  end
11
11
 
@@ -73,7 +73,13 @@ class TestChart < Test::Unit::TestCase
73
73
  def test_pn
74
74
  assert_equal(@chart.pn, "charts/chart1.xml")
75
75
  end
76
-
76
+
77
+ def test_d_lbls
78
+ assert_equal(nil, @chart.instance_values[:d_lbls])
79
+ @chart.d_lbls.d_lbl_pos = :t
80
+ assert(@chart.d_lbls.is_a?(Axlsx::DLbls), 'DLbls instantiated on access')
81
+ end
82
+
77
83
  def test_to_xml_string
78
84
  schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD))
79
85
  doc = Nokogiri::XML(@chart.to_xml_string)
@@ -0,0 +1,47 @@
1
+ require 'tc_helper'
2
+
3
+ class TestDLbls < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart)
7
+ end
8
+
9
+ def test_initialization
10
+ assert_equal(:bestFit, @d_lbls.d_lbl_pos)
11
+ Axlsx::DLbls::BOOLEAN_ATTRIBUTES.each do |attr|
12
+ assert_equal(false, @d_lbls.send(attr))
13
+ end
14
+ end
15
+
16
+ def test_initialization_with_optoins
17
+ options_hash = Hash[*[Axlsx::DLbls::BOOLEAN_ATTRIBUTES.map { |name| [name, true] }] ]
18
+ d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t }))
19
+ Axlsx::DLbls::BOOLEAN_ATTRIBUTES.each do |attr|
20
+ assert_equal(true, d_lbls.send(attr), "boolean attributes set by options")
21
+ end
22
+ assert_equal(:t, d_lbls.d_lbl_pos, "d_lbl_pos set by options")
23
+ end
24
+ def test_d_lbl_pos
25
+ assert_raise(ArgumentError, 'invlaid label positions are rejected') { @d_lbls.d_lbl_pos = :upside_down }
26
+ assert_nothing_raised('accepts valid label position') { @d_lbls.d_lbl_pos = :ctr }
27
+ end
28
+
29
+ def test_boolean_attributes
30
+ Axlsx::DLbls::BOOLEAN_ATTRIBUTES.each do |attr|
31
+ assert_raise(ArgumentError, "rejects non boolean value for #{attr}") { @d_lbls.send("#{attr}=", :foo) }
32
+ assert_nothing_raised("accepts boolean value for #{attr}") { @d_lbls.send("#{attr}=", true) }
33
+ assert_nothing_raised("accepts boolean value for #{attr}") { @d_lbls.send("#{attr}=", false) }
34
+ end
35
+ end
36
+
37
+ def test_to_xml_string
38
+ str = '<?xml version="1.0" encoding="UTF-8"?>'
39
+ str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '" xmlns:a="' << Axlsx::XML_NS_A << '" xmlns:r="' << Axlsx::XML_NS_R << '">'
40
+ @d_lbls.to_xml_string(str)
41
+ str << '</c:chartSpace>'
42
+ doc = Nokogiri::XML(str)
43
+ @d_lbls.instance_values.each do |name, value|
44
+ assert(doc.xpath("//c:#{Axlsx::camel(name, false)}[@val='#{value}']"), "#{name} is properly serialized")
45
+ end
46
+ end
47
+ end
@@ -9,8 +9,6 @@ class TestDrawing < Test::Unit::TestCase
9
9
 
10
10
  def test_initialization
11
11
  assert(@ws.workbook.drawings.empty?)
12
- assert_equal(@ws.drawing, @ws.workbook.drawings.last, "drawing is added to workbook")
13
- assert(@ws.drawing.anchors.is_a?(Axlsx::SimpleTypedList) && @ws.drawing.anchors.empty?, "anchor list is created and empty")
14
12
  end
15
13
 
16
14
  def test_add_chart
@@ -39,7 +37,6 @@ class TestDrawing < Test::Unit::TestCase
39
37
  assert(image.is_a?(Axlsx::Pic))
40
38
  end
41
39
  def test_charts
42
- assert(@ws.drawing.charts.empty?)
43
40
  chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
44
41
  assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
45
42
  chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
@@ -47,23 +44,26 @@ class TestDrawing < Test::Unit::TestCase
47
44
  end
48
45
 
49
46
  def test_pn
47
+ @ws.add_chart(Axlsx::Pie3DChart)
50
48
  assert_equal(@ws.drawing.pn, "drawings/drawing1.xml")
51
49
  end
52
50
 
53
51
  def test_rels_pn
52
+ @ws.add_chart(Axlsx::Pie3DChart)
54
53
  assert_equal(@ws.drawing.rels_pn, "drawings/_rels/drawing1.xml.rels")
55
54
  end
56
55
 
57
56
  def test_rId
57
+ @ws.add_chart(Axlsx::Pie3DChart)
58
58
  assert_equal(@ws.drawing.rId, "rId1")
59
59
  end
60
60
 
61
61
  def test_index
62
+ @ws.add_chart(Axlsx::Pie3DChart)
62
63
  assert_equal(@ws.drawing.index, @ws.workbook.drawings.index(@ws.drawing))
63
64
  end
64
65
 
65
66
  def test_relationships
66
- assert(@ws.drawing.relationships.empty?)
67
67
  chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
68
68
  assert_equal(@ws.drawing.relationships.size, 1, "adding a chart adds a relationship")
69
69
  chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
@@ -72,6 +72,7 @@ class TestDrawing < Test::Unit::TestCase
72
72
 
73
73
  def test_to_xml
74
74
  schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD))
75
+ @ws.add_chart(Axlsx::Pie3DChart)
75
76
  doc = Nokogiri::XML(@ws.drawing.to_xml_string)
76
77
  errors = []
77
78
  schema.validate(doc).each do |error|
@@ -5,7 +5,7 @@ class TestLineSeries < Test::Unit::TestCase
5
5
  def setup
6
6
  p = Axlsx::Package.new
7
7
  @ws = p.workbook.add_worksheet :name=>"hmmm"
8
- chart = @ws.drawing.add_chart Axlsx::Line3DChart, :title => "fishery"
8
+ chart = @ws.add_chart Axlsx::Line3DChart, :title => "fishery"
9
9
  @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :color => "#FF0000"
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ class TestPie3DChart < Test::Unit::TestCase
6
6
  p = Axlsx::Package.new
7
7
  ws = p.workbook.add_worksheet
8
8
  @row = ws.add_row ["one", 1, Time.now]
9
- @chart = ws.drawing.add_chart Axlsx::Pie3DChart, :title => "fishery"
9
+ @chart = ws.add_chart Axlsx::Pie3DChart, :title => "fishery"
10
10
  end
11
11
 
12
12
  def teardown
@@ -5,7 +5,7 @@ class TestPieSeries < Test::Unit::TestCase
5
5
  def setup
6
6
  p = Axlsx::Package.new
7
7
  @ws = p.workbook.add_worksheet :name=>"hmmm"
8
- chart = @ws.drawing.add_chart Axlsx::Pie3DChart, :title => "fishery"
8
+ chart = @ws.add_chart Axlsx::Pie3DChart, :title => "fishery"
9
9
  @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :colors => ["FF0000", "00FF00", "0000FF"]
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ class TestScatterSeries < Test::Unit::TestCase
5
5
  def setup
6
6
  p = Axlsx::Package.new
7
7
  @ws = p.workbook.add_worksheet :name=>"hmmm"
8
- @chart = @ws.drawing.add_chart Axlsx::ScatterChart, :title => "Scatter Chart"
8
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Scatter Chart"
9
9
  @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"exponents", :color => 'FF0000'
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ class TestSeries < Test::Unit::TestCase
5
5
  def setup
6
6
  p = Axlsx::Package.new
7
7
  @ws = p.workbook.add_worksheet :name=>"hmmm"
8
- chart = @ws.drawing.add_chart Axlsx::Chart, :title => "fishery"
8
+ chart = @ws.add_chart Axlsx::Chart, :title => "fishery"
9
9
  @series = chart.add_series :title=>"bob"
10
10
  end
11
11
 
@@ -7,6 +7,7 @@ class TestPackage < Test::Unit::TestCase
7
7
  ws = @package.workbook.add_worksheet
8
8
  ws.add_row ['Can', 'we', 'build it?']
9
9
  ws.add_row ['Yes!', 'We', 'can!']
10
+ ws.workbook.add_defined_name("#{ws.name}!A1:C2", :name => '_xlnm.Print_Titles', :hidden => true)
10
11
  ws.protect_range('A1:C1')
11
12
  ws.protect_range(ws.rows.last.cells)
12
13
  ws.add_comment :author => 'alice', :text => 'Hi Bob', :ref => 'A12'
@@ -28,11 +29,25 @@ class TestPackage < Test::Unit::TestCase
28
29
 
29
30
  ws.add_chart(Axlsx::Pie3DChart, :title => "これは?", :start_at => [0,3]) do |chart|
30
31
  chart.add_series :data=>[1,2,3], :labels=>["a", "b", "c"]
32
+ chart.d_lbls.show_val = true
33
+ chart.d_lbls.d_lbl_pos = :outEnd
34
+ chart.d_lbls.show_percent = true
31
35
  end
32
36
 
33
37
  ws.add_chart(Axlsx::Line3DChart, :title => "axis labels") do |chart|
34
38
  chart.valAxis.title = 'bob'
39
+ chart.d_lbls.show_val = true
35
40
  end
41
+
42
+ ws.add_chart(Axlsx::Bar3DChart, :title => 'bar chart') do |chart|
43
+ chart.add_series :data => [1,4,5], :labels => %w(A B C)
44
+ chart.d_lbls.show_percent = true
45
+ end
46
+
47
+ ws.add_chart(Axlsx::ScatterChart, :title => 'scat man') do |chart|
48
+ chart.add_series :xData => [1,2,3,4], :yData => [4,3,2,1]
49
+ chart.d_lbls.show_val = true
50
+ end
36
51
 
37
52
  @fname = 'axlsx_test_serialization.xlsx'
38
53
  img = File.expand_path('../../examples/image1.jpeg', __FILE__)
@@ -122,7 +137,7 @@ class TestPackage < Test::Unit::TestCase
122
137
 
123
138
 
124
139
  #no mystery parts
125
- assert_equal(p.size, 19)
140
+ assert_equal(p.size, 21)
126
141
 
127
142
  end
128
143
 
@@ -0,0 +1,41 @@
1
+ require 'tc_helper'
2
+
3
+ class TestDefinedNames < Test::Unit::TestCase
4
+ def setup
5
+ @dn = Axlsx::DefinedName.new('Sheet1!A1:A1')
6
+ end
7
+
8
+ def test_initialize
9
+ assert_equal('Sheet1!A1:A1', @dn.formula)
10
+ end
11
+
12
+ def test_string_attributes
13
+ Axlsx::DefinedName::STRING_ATTRIBUTES.each do |attr|
14
+ assert_raise(ArgumentError, 'only strings allowed in string attributes') { @dn.send("#{attr}=", 1) }
15
+ assert_nothing_raised { @dn.send("#{attr}=", '_xlnm.Sheet_Title') }
16
+ end
17
+ end
18
+
19
+ def test_boolean_attributes
20
+ Axlsx::DefinedName::BOOLEAN_ATTRIBUTES.each do |attr|
21
+ assert_raise(ArgumentError, 'only booleanish allowed in string attributes') { @dn.send("#{attr}=", 'foo') }
22
+ assert_nothing_raised { @dn.send("#{attr}=", 1) }
23
+ end
24
+
25
+ end
26
+
27
+ def test_local_sheet_id
28
+ assert_raise(ArgumentError, 'local_sheet_id must be an unsigned int') { @dn.local_sheet_id = -1 }
29
+ assert_nothing_raised { @dn.local_sheet_id = 1 }
30
+ end
31
+
32
+ def test_to_xml_string
33
+ assert_raise(ArgumentError, 'name is required for serialization') { @dn.to_xml_string }
34
+ @dn.name = '_xlnm.Print_Titles'
35
+ @dn.hidden = true
36
+ doc = Nokogiri::XML(@dn.to_xml_string)
37
+ assert(doc.xpath("//definedName[@name='_xlnm.Print_Titles']"))
38
+ assert(doc.xpath("//definedName[@hidden='true']"))
39
+ assert_equal('Sheet1!A1:A1', doc.xpath('//definedName').text)
40
+ end
41
+ end
@@ -24,7 +24,10 @@ class TestWorkbook < Test::Unit::TestCase
24
24
  assert_equal(Axlsx::Workbook.date1904, @wb.date1904)
25
25
  end
26
26
 
27
-
27
+ def test_add_defined_name
28
+ @wb.add_defined_name 'Sheet1!1:1', :name => '_xlnm.Print_Titles', :hidden => true
29
+ assert_equal(1, @wb.defined_names.size)
30
+ end
28
31
 
29
32
  def test_shared_strings
30
33
  assert_equal(@wb.use_shared_strings, nil)
@@ -72,14 +75,13 @@ class TestWorkbook < Test::Unit::TestCase
72
75
  assert(@wb.worksheets.size == 1)
73
76
  end
74
77
 
75
-
76
78
  def test_to_xml_string_defined_names
77
79
  @wb.add_worksheet do |sheet|
78
80
  sheet.add_row [1, "two"]
79
81
  sheet.auto_filter = "A1:B1"
80
82
  end
81
83
  doc = Nokogiri::XML(@wb.to_xml_string)
82
- assert_equal(doc.xpath('//xmlns:workbook/xmlns:definedNames/xmlns:definedName').inner_text, @wb.worksheets[0].abs_auto_filter)
84
+ assert_equal(doc.xpath('//xmlns:workbook/xmlns:definedNames/xmlns:definedName').inner_text, @wb.worksheets[0].auto_filter.defined_name)
83
85
  end
84
86
 
85
87
 
@@ -25,14 +25,6 @@ class TestTable < Test::Unit::TestCase
25
25
 
26
26
  end
27
27
 
28
- def test_charts
29
- assert(@ws.drawing.charts.empty?)
30
- chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
31
- assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
32
- chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
33
- assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
34
- end
35
-
36
28
  def test_pn
37
29
  @ws.add_table("A1:D5")
38
30
  assert_equal(@ws.tables.first.pn, "tables/table1.xml")
@@ -197,19 +197,17 @@ class TestCell < Test::Unit::TestCase
197
197
  end
198
198
 
199
199
  def test_merge_with_string
200
- assert_equal(@c.row.worksheet.merged_cells.size, 0)
201
200
  @c.row.add_cell 2
202
201
  @c.row.add_cell 3
203
202
  @c.merge "A2"
204
- assert_equal(@c.row.worksheet.merged_cells.last, "A1:A2")
203
+ assert_equal(@c.row.worksheet.send(:merged_cells).last, "A1:A2")
205
204
  end
206
205
 
207
206
  def test_merge_with_cell
208
- assert_equal(@c.row.worksheet.merged_cells.size, 0)
209
207
  @c.row.add_cell 2
210
208
  @c.row.add_cell 3
211
209
  @c.merge @row.cells.last
212
- assert_equal(@c.row.worksheet.merged_cells.last, "A1:C1")
210
+ assert_equal(@c.row.worksheet.send(:merged_cells).last, "A1:C1")
213
211
  end
214
212
 
215
213
  def test_ssti