axlsx 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -0
- data/README.md +15 -15
- data/Rakefile +1 -1
- data/examples/example.rb +106 -35
- data/examples/wrap_text.rb +21 -0
- data/lib/axlsx/drawing/chart.rb +1 -1
- data/lib/axlsx/rels/relationship.rb +1 -1
- data/lib/axlsx/util/serialized_attributes.rb +32 -1
- data/lib/axlsx/util/validators.rb +1 -0
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +1 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +5 -2
- data/lib/axlsx/workbook/worksheet/cfvos.rb +0 -3
- data/lib/axlsx/workbook/worksheet/color_scale.rb +56 -16
- data/lib/axlsx/workbook/worksheet/data_bar.rb +42 -18
- data/lib/axlsx/workbook/worksheet/header_footer.rb +54 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +29 -11
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +1 -1
- data/test/benchmark.rb +1 -2
- data/test/example.xlsx +0 -0
- data/test/profile.rb +4 -13
- data/test/rels/tc_relationship.rb +5 -0
- data/test/tc_helper.rb +5 -1
- data/test/workbook/worksheet/tc_color_scale.rb +31 -2
- data/test/workbook/worksheet/tc_data_bar.rb +7 -0
- data/test/workbook/worksheet/tc_header_footer.rb +151 -0
- data/test/workbook/worksheet/tc_worksheet.rb +31 -6
- data/test/workbook/worksheet/tc_worksheet_hyperlink.rb +1 -1
- metadata +11 -49
- data/examples/doc/_index.html +0 -88
- data/examples/doc/class_list.html +0 -53
- data/examples/doc/css/common.css +0 -1
- data/examples/doc/css/full_list.css +0 -57
- data/examples/doc/css/style.css +0 -328
- data/examples/doc/file_list.html +0 -52
- data/examples/doc/frames.html +0 -28
- data/examples/doc/index.html +0 -88
- data/examples/doc/js/app.js +0 -214
- data/examples/doc/js/full_list.js +0 -173
- data/examples/doc/js/jquery.js +0 -4
- data/examples/doc/method_list.html +0 -52
- data/examples/doc/top-level-namespace.html +0 -102
- data/examples/extractive.pdf +0 -0
- data/examples/finance.rb +0 -82
- data/examples/hyperlinks.rb +0 -23
- data/examples/image1.gif +0 -0
- data/examples/image1.jpg +0 -0
- data/examples/image1.png +0 -0
- data/examples/sample.png +0 -0
- data/examples/scraping_html.rb +0 -91
- data/examples/sheet_view.rb +0 -34
- data/examples/skydrive/axlsx.csv +0 -1
- data/examples/skydrive/axlsx.xlsx +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 10.42.06 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 11.07.48 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 8.31.50 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.23.27 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.32.06 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.33.35 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.46.44 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-12 at 5.07.23 PM.png +0 -0
- data/examples/sprk2012/basics.rb +0 -11
- data/examples/sprk2012/basics.xlsx +0 -0
- data/examples/sprk2012/gravatar.jpeg +0 -0
- data/examples/sprk2012/hair_club.jpg +0 -0
- data/examples/sprk2012/images.rb +0 -9
- data/examples/sprk2012/images.xlsx +0 -0
- data/examples/sprk2012/line_chart.rb +0 -56
- data/examples/sprk2012/line_chart.xlsx +0 -0
- data/examples/sprk2012/sprk2012.key +0 -0
- data/examples/sprk2012/styles.rb +0 -20
- data/examples/sprk2012/styles.xlsx +0 -0
- data/examples/two_cell_anchor_image.rb +0 -11
@@ -73,7 +73,7 @@ module Axlsx
|
|
73
73
|
# r:id should only be specified for external targets.
|
74
74
|
# @return [Hash]
|
75
75
|
def location_or_id
|
76
|
-
@target == :external ? { :"r:id" => id } : { :location => location }
|
76
|
+
@target == :external ? { :"r:id" => id } : { :location => Axlsx::coder.encode(location) }
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/test/benchmark.rb
CHANGED
@@ -4,11 +4,10 @@ $:.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
4
4
|
require 'axlsx'
|
5
5
|
require 'csv'
|
6
6
|
require 'benchmark'
|
7
|
-
|
8
7
|
row = []
|
9
8
|
input = (32..126).to_a.pack('U*').chars.to_a
|
10
9
|
20.times { row << input.shuffle.join}
|
11
|
-
times =
|
10
|
+
times = 3000
|
12
11
|
Benchmark.bmbm(30) do |x|
|
13
12
|
|
14
13
|
x.report('axlsx_noautowidth') {
|
data/test/example.xlsx
ADDED
Binary file
|
data/test/profile.rb
CHANGED
@@ -1,31 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby -s
|
2
|
-
# -*- coding: utf-8 -*-
|
3
2
|
|
4
3
|
# Usage:
|
5
4
|
# > ruby test/profile.rb
|
6
|
-
# > pprof.rb --gif /tmp/
|
5
|
+
# > pprof.rb --gif /tmp/axlsx > /tmp/axlsx.gif
|
7
6
|
# > open /tmp/axlsx_noautowidth.gif
|
8
7
|
|
9
8
|
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
10
9
|
require 'axlsx'
|
11
|
-
require 'csv'
|
12
|
-
|
13
|
-
# require 'benchmark'
|
14
10
|
require 'perftools'
|
15
11
|
row = []
|
12
|
+
# Taking worst case scenario of all string data
|
16
13
|
input = (32..126).to_a.pack('U*').chars.to_a
|
17
14
|
20.times { row << input.shuffle.join}
|
18
15
|
times = 3000
|
19
16
|
|
20
|
-
PerfTools::CpuProfiler.start("/tmp/
|
17
|
+
PerfTools::CpuProfiler.start("/tmp/axlsx") do
|
21
18
|
p = Axlsx::Package.new
|
22
|
-
p.
|
23
|
-
p.use_shared_strings = true
|
24
|
-
wb = p.workbook
|
25
|
-
|
26
|
-
#A Simple Workbook
|
27
|
-
|
28
|
-
wb.add_worksheet do |sheet|
|
19
|
+
p.workbook.add_worksheet do |sheet|
|
29
20
|
times.times do
|
30
21
|
sheet << row
|
31
22
|
end
|
@@ -18,4 +18,9 @@ class TestRelationships < Test::Unit::TestCase
|
|
18
18
|
assert_nothing_raised { Axlsx::Relationship.new( Axlsx::WORKSHEET_R, 'target', :target_mode => :External) }
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_ampersand_escaping_in_target
|
22
|
+
r = Axlsx::Relationship.new(Axlsx::HYPERLINK_R, "http://example.com?foo=1&bar=2", :target_mod => :External)
|
23
|
+
doc = Nokogiri::XML(r.to_xml_string(1))
|
24
|
+
assert_equal(doc.xpath("//Relationship[@Target='http://example.com?foo=1&bar=2']").size, 1)
|
25
|
+
end
|
21
26
|
end
|
data/test/tc_helper.rb
CHANGED
@@ -5,6 +5,37 @@ class TestColorScale < Test::Unit::TestCase
|
|
5
5
|
@color_scale = Axlsx::ColorScale.new
|
6
6
|
end
|
7
7
|
|
8
|
+
def test_three_tone
|
9
|
+
color_scale = Axlsx::ColorScale.three_tone
|
10
|
+
assert_equal 3, color_scale.value_objects.size
|
11
|
+
assert_equal 3, color_scale.colors.size
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_two_tone
|
15
|
+
color_scale = Axlsx::ColorScale.two_tone
|
16
|
+
assert_equal 2, color_scale.value_objects.size
|
17
|
+
assert_equal 2, color_scale.colors.size
|
18
|
+
end
|
19
|
+
def test_default_cfvo
|
20
|
+
first = Axlsx::ColorScale.default_cfvos.first
|
21
|
+
second = Axlsx::ColorScale.default_cfvos.last
|
22
|
+
assert_equal 'FFFF7128', first[:color]
|
23
|
+
assert_equal :min,first[:type]
|
24
|
+
assert_equal 0, first[:val]
|
25
|
+
|
26
|
+
assert_equal 'FFFFEF9C', second[:color]
|
27
|
+
assert_equal :max, second[:type]
|
28
|
+
assert_equal 0, second[:val]
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_partial_default_cfvo_override
|
32
|
+
first_def = {:type => :percent, :val => "10.0", :color => 'FF00FF00'}
|
33
|
+
color_scale = Axlsx::ColorScale.new(first_def)
|
34
|
+
assert_equal color_scale.value_objects.first.val, first_def[:val]
|
35
|
+
assert_equal color_scale.value_objects.first.type, first_def[:type]
|
36
|
+
assert_equal color_scale.colors.first.rgb, first_def[:color]
|
37
|
+
end
|
38
|
+
|
8
39
|
def test_add
|
9
40
|
@color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE"
|
10
41
|
assert_equal(@color_scale.value_objects.size,3)
|
@@ -12,8 +43,6 @@ class TestColorScale < Test::Unit::TestCase
|
|
12
43
|
end
|
13
44
|
|
14
45
|
def test_delete_at
|
15
|
-
assert_raise(ArgumentError, "minimum two are protected") { @color_scale.delete_at 0 }
|
16
|
-
assert_raise(ArgumentError, "minimum two are protected") { @color_scale.delete_at 1 }
|
17
46
|
@color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE"
|
18
47
|
assert_nothing_raised {@color_scale.delete_at 2}
|
19
48
|
assert_equal(@color_scale.value_objects.size,2)
|
@@ -11,6 +11,13 @@ class TestDataBar < Test::Unit::TestCase
|
|
11
11
|
assert_equal @data_bar.showValue, true
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_override_default_cfvos
|
15
|
+
data_bar = Axlsx::DataBar.new({:color => 'FF00FF00'}, {:type => :min, :val => "20"})
|
16
|
+
assert_equal("20", data_bar.value_objects.first.val)
|
17
|
+
assert_equal("0", data_bar.value_objects.last.val)
|
18
|
+
end
|
19
|
+
|
20
|
+
|
14
21
|
def test_minLength
|
15
22
|
assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type }
|
16
23
|
assert_nothing_raised { @data_bar.minLength = 0}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
require 'tc_helper'
|
2
|
+
|
3
|
+
class TestHeaderFooter < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@p = Axlsx::Package.new
|
7
|
+
ws = @p.workbook.add_worksheet :name => 'test'
|
8
|
+
@hf = ws.header_footer
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
assert_equal(nil, @hf.odd_header)
|
13
|
+
assert_equal(nil, @hf.odd_footer)
|
14
|
+
|
15
|
+
assert_equal(nil, @hf.even_header)
|
16
|
+
assert_equal(nil, @hf.even_footer)
|
17
|
+
|
18
|
+
assert_equal(nil, @hf.first_header)
|
19
|
+
assert_equal(nil, @hf.first_footer)
|
20
|
+
|
21
|
+
assert_equal(nil, @hf.different_first)
|
22
|
+
assert_equal(nil, @hf.different_odd_even)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_initialize_with_options
|
26
|
+
header_footer = {
|
27
|
+
:odd_header => 'oh',
|
28
|
+
:odd_footer => 'of',
|
29
|
+
|
30
|
+
:even_header => 'eh',
|
31
|
+
:even_footer => 'ef',
|
32
|
+
|
33
|
+
:first_header => 'fh',
|
34
|
+
:first_footer => 'ff',
|
35
|
+
|
36
|
+
:different_first => true,
|
37
|
+
:different_odd_even => true
|
38
|
+
}
|
39
|
+
optioned = @p.workbook.add_worksheet(:name => 'optioned', :header_footer => header_footer).header_footer
|
40
|
+
|
41
|
+
assert_equal('oh', optioned.odd_header)
|
42
|
+
assert_equal('of', optioned.odd_footer)
|
43
|
+
|
44
|
+
assert_equal('eh', optioned.even_header)
|
45
|
+
assert_equal('ef', optioned.even_footer)
|
46
|
+
|
47
|
+
assert_equal('fh', optioned.first_header)
|
48
|
+
assert_equal('ff', optioned.first_footer)
|
49
|
+
|
50
|
+
assert_equal(true, optioned.different_first)
|
51
|
+
assert_equal(true, optioned.different_odd_even)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_string_attributes
|
55
|
+
%w(odd_header odd_footer even_header even_footer first_header first_footer).each do |attr|
|
56
|
+
assert_raise(ArgumentError, 'only strings allowed in string attributes') { @hf.send("#{attr}=", 1) }
|
57
|
+
assert_nothing_raised { @hf.send("#{attr}=", 'test_string') }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_boolean_attributes
|
62
|
+
%w(different_first different_odd_even).each do |attr|
|
63
|
+
assert_raise(ArgumentError, 'only booleanish allowed in string attributes') { @hf.send("#{attr}=", 'foo') }
|
64
|
+
assert_nothing_raised { @hf.send("#{attr}=", 1) }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_set_all_values
|
69
|
+
@hf.set(
|
70
|
+
:odd_header => 'oh',
|
71
|
+
:odd_footer => 'of',
|
72
|
+
|
73
|
+
:even_header => 'eh',
|
74
|
+
:even_footer => 'ef',
|
75
|
+
|
76
|
+
:first_header => 'fh',
|
77
|
+
:first_footer => 'ff',
|
78
|
+
|
79
|
+
:different_first => true,
|
80
|
+
:different_odd_even => true
|
81
|
+
)
|
82
|
+
|
83
|
+
assert_equal('oh', @hf.odd_header)
|
84
|
+
assert_equal('of', @hf.odd_footer)
|
85
|
+
|
86
|
+
assert_equal('eh', @hf.even_header)
|
87
|
+
assert_equal('ef', @hf.even_footer)
|
88
|
+
|
89
|
+
assert_equal('fh', @hf.first_header)
|
90
|
+
assert_equal('ff', @hf.first_footer)
|
91
|
+
|
92
|
+
assert_equal(true, @hf.different_first)
|
93
|
+
assert_equal(true, @hf.different_odd_even)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_to_xml_all_values
|
97
|
+
@hf.set(
|
98
|
+
:odd_header => 'oh',
|
99
|
+
:odd_footer => 'of',
|
100
|
+
|
101
|
+
:even_header => 'eh',
|
102
|
+
:even_footer => 'ef',
|
103
|
+
|
104
|
+
:first_header => 'fh',
|
105
|
+
:first_footer => 'ff',
|
106
|
+
|
107
|
+
:different_first => true,
|
108
|
+
:different_odd_even => true
|
109
|
+
)
|
110
|
+
|
111
|
+
doc = Nokogiri::XML.parse(@hf.to_xml_string)
|
112
|
+
assert_equal(1, doc.xpath(".//headerFooter[@differentFirst='true'][@differentOddEven='true']").size)
|
113
|
+
|
114
|
+
assert_equal(1, doc.xpath(".//headerFooter/oddHeader").size)
|
115
|
+
assert_equal('oh', doc.xpath(".//headerFooter/oddHeader").text)
|
116
|
+
assert_equal(1, doc.xpath(".//headerFooter/oddFooter").size)
|
117
|
+
assert_equal('of', doc.xpath(".//headerFooter/oddFooter").text)
|
118
|
+
|
119
|
+
assert_equal(1, doc.xpath(".//headerFooter/evenHeader").size)
|
120
|
+
assert_equal('eh', doc.xpath(".//headerFooter/evenHeader").text)
|
121
|
+
assert_equal(1, doc.xpath(".//headerFooter/evenFooter").size)
|
122
|
+
assert_equal('ef', doc.xpath(".//headerFooter/evenFooter").text)
|
123
|
+
|
124
|
+
assert_equal(1, doc.xpath(".//headerFooter/firstHeader").size)
|
125
|
+
assert_equal('fh', doc.xpath(".//headerFooter/firstHeader").text)
|
126
|
+
assert_equal(1, doc.xpath(".//headerFooter/firstFooter").size)
|
127
|
+
assert_equal('ff', doc.xpath(".//headerFooter/firstFooter").text)
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_to_xml_some_values
|
131
|
+
@hf.set(
|
132
|
+
:odd_header => 'oh',
|
133
|
+
:different_odd_even => false
|
134
|
+
)
|
135
|
+
|
136
|
+
doc = Nokogiri::XML.parse(@hf.to_xml_string)
|
137
|
+
assert_equal(1, doc.xpath(".//headerFooter[@differentOddEven='false']").size)
|
138
|
+
assert_equal(0, doc.xpath(".//headerFooter[@differentFirst]").size)
|
139
|
+
|
140
|
+
assert_equal(1, doc.xpath(".//headerFooter/oddHeader").size)
|
141
|
+
assert_equal('oh', doc.xpath(".//headerFooter/oddHeader").text)
|
142
|
+
assert_equal(0, doc.xpath(".//headerFooter/oddFooter").size)
|
143
|
+
|
144
|
+
assert_equal(0, doc.xpath(".//headerFooter/evenHeader").size)
|
145
|
+
assert_equal(0, doc.xpath(".//headerFooter/evenFooter").size)
|
146
|
+
|
147
|
+
assert_equal(0, doc.xpath(".//headerFooter/firstHeader").size)
|
148
|
+
assert_equal(0, doc.xpath(".//headerFooter/firstFooter").size)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
@@ -55,6 +55,17 @@ class TestWorksheet < Test::Unit::TestCase
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
def test_header_footer
|
59
|
+
assert(@ws.header_footer.is_a? Axlsx::HeaderFooter)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_header_footer_yield
|
63
|
+
@ws.header_footer do |hf|
|
64
|
+
assert(hf.is_a? Axlsx::HeaderFooter)
|
65
|
+
assert(@ws.header_footer == hf)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
58
69
|
def test_no_autowidth
|
59
70
|
@ws.workbook.use_autowidth = false
|
60
71
|
@ws.add_row [1,2,3,4]
|
@@ -65,7 +76,8 @@ class TestWorksheet < Test::Unit::TestCase
|
|
65
76
|
page_margins = {:left => 2, :right => 2, :bottom => 2, :top => 2, :header => 2, :footer => 2}
|
66
77
|
page_setup = {:fit_to_height => 1, :fit_to_width => 1, :orientation => :landscape, :paper_width => "210mm", :paper_height => "297mm", :scale => 80}
|
67
78
|
print_options = {:grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true}
|
68
|
-
|
79
|
+
header_footer = {:different_first => false, :different_odd_even => false, :odd_header => 'Header'}
|
80
|
+
optioned = @ws.workbook.add_worksheet(:name => 'bob', :page_margins => page_margins, :page_setup => page_setup, :print_options => print_options, :header_footer => header_footer, :selected => true, :show_gridlines => false)
|
69
81
|
page_margins.keys.each do |key|
|
70
82
|
assert_equal(page_margins[key], optioned.page_margins.send(key))
|
71
83
|
end
|
@@ -75,6 +87,9 @@ class TestWorksheet < Test::Unit::TestCase
|
|
75
87
|
print_options.keys.each do |key|
|
76
88
|
assert_equal(print_options[key], optioned.print_options.send(key))
|
77
89
|
end
|
90
|
+
header_footer.keys.each do |key|
|
91
|
+
assert_equal(header_footer[key], optioned.header_footer.send(key))
|
92
|
+
end
|
78
93
|
assert_equal(optioned.name, 'bob')
|
79
94
|
assert_equal(optioned.selected, true)
|
80
95
|
assert_equal(optioned.show_gridlines, false)
|
@@ -293,6 +308,16 @@ class TestWorksheet < Test::Unit::TestCase
|
|
293
308
|
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:printOptions[@gridLines="true"][@horizontalCentered="true"]').size, 1)
|
294
309
|
end
|
295
310
|
|
311
|
+
def test_to_xml_string_header_footer
|
312
|
+
@ws.header_footer do |hf|
|
313
|
+
hf.different_first = false
|
314
|
+
hf.different_odd_even = false
|
315
|
+
hf.odd_header = 'Test Header'
|
316
|
+
end
|
317
|
+
doc = Nokogiri::XML(@ws.to_xml_string)
|
318
|
+
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:headerFooter[@differentFirst="false"][@differentOddEven="false"]').size, 1)
|
319
|
+
end
|
320
|
+
|
296
321
|
def test_to_xml_string_drawing
|
297
322
|
@ws.add_chart Axlsx::Pie3DChart
|
298
323
|
doc = Nokogiri::XML(@ws.to_xml_string)
|
@@ -317,7 +342,7 @@ class TestWorksheet < Test::Unit::TestCase
|
|
317
342
|
def test_styles
|
318
343
|
assert(@ws.styles.is_a?(Axlsx::Styles), 'worksheet provides access to styles')
|
319
344
|
end
|
320
|
-
|
345
|
+
|
321
346
|
def test_to_xml_string_with_illegal_chars
|
322
347
|
nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f"
|
323
348
|
@ws.add_row [nasties]
|
@@ -400,7 +425,7 @@ class TestWorksheet < Test::Unit::TestCase
|
|
400
425
|
@ws.add_row [1, 2, 3]
|
401
426
|
assert_nothing_raised {@ws.protect_range(@ws.rows.first.cells) }
|
402
427
|
assert_equal('A1:C1', @ws.send(:protected_ranges).last.sqref)
|
403
|
-
|
428
|
+
|
404
429
|
end
|
405
430
|
def test_merge_cells
|
406
431
|
@ws.add_row [1,2,3]
|
@@ -412,7 +437,7 @@ class TestWorksheet < Test::Unit::TestCase
|
|
412
437
|
assert_equal(@ws.send(:merged_cells).size, 3)
|
413
438
|
assert_equal(@ws.send(:merged_cells).last, "A3:B3")
|
414
439
|
end
|
415
|
-
|
440
|
+
|
416
441
|
def test_merge_cells_sorts_correctly_by_row_when_given_array
|
417
442
|
10.times do |i|
|
418
443
|
@ws.add_row [i]
|
@@ -420,7 +445,7 @@ class TestWorksheet < Test::Unit::TestCase
|
|
420
445
|
@ws.merge_cells [@ws.rows[8].cells.first, @ws.rows[9].cells.first]
|
421
446
|
assert_equal "A9:A10", @ws.send(:merged_cells).first
|
422
447
|
end
|
423
|
-
|
448
|
+
|
424
449
|
def test_auto_filter
|
425
450
|
assert(@ws.auto_filter.range.nil?)
|
426
451
|
assert_raise(ArgumentError) { @ws.auto_filter = 123 }
|
@@ -432,6 +457,6 @@ class TestWorksheet < Test::Unit::TestCase
|
|
432
457
|
@ws.auto_filter.range = 'A1:D9'
|
433
458
|
@ws.auto_filter.add_column 0, :filters, :filter_items => [1]
|
434
459
|
doc = Nokogiri::XML(@ws.to_xml_string)
|
435
|
-
assert(doc.xpath('//sheetPr[@filterMode="true"]'))
|
460
|
+
assert(doc.xpath('//sheetPr[@filterMode="true"]'))
|
436
461
|
end
|
437
462
|
end
|
@@ -5,7 +5,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase
|
|
5
5
|
p = Axlsx::Package.new
|
6
6
|
wb = p.workbook
|
7
7
|
@ws = wb.add_worksheet
|
8
|
-
@options = { :location => 'https://github.com/randym/axlsx', :tooltip => 'axlsx', :ref => 'A1', :display => 'AXSLX', :target => :internal }
|
8
|
+
@options = { :location => 'https://github.com/randym/axlsx?foo=1&bar=2', :tooltip => 'axlsx', :ref => 'A1', :display => 'AXSLX', :target => :internal }
|
9
9
|
@a = @ws.add_hyperlink @options
|
10
10
|
end
|
11
11
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: simplecov
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- lib/axlsx/workbook/worksheet/data_validations.rb
|
215
215
|
- lib/axlsx/workbook/worksheet/date_time_converter.rb
|
216
216
|
- lib/axlsx/workbook/worksheet/dimension.rb
|
217
|
+
- lib/axlsx/workbook/worksheet/header_footer.rb
|
217
218
|
- lib/axlsx/workbook/worksheet/icon_set.rb
|
218
219
|
- lib/axlsx/workbook/worksheet/merged_cells.rb
|
219
220
|
- lib/axlsx/workbook/worksheet/page_margins.rb
|
@@ -284,57 +285,14 @@ files:
|
|
284
285
|
- examples/conditional_formatting/scaled_colors.rb
|
285
286
|
- examples/conditional_formatting/stop_and_go.rb
|
286
287
|
- examples/data_validation.rb
|
287
|
-
- examples/doc/_index.html
|
288
|
-
- examples/doc/class_list.html
|
289
|
-
- examples/doc/css/common.css
|
290
|
-
- examples/doc/css/full_list.css
|
291
|
-
- examples/doc/css/style.css
|
292
|
-
- examples/doc/file_list.html
|
293
|
-
- examples/doc/frames.html
|
294
|
-
- examples/doc/index.html
|
295
|
-
- examples/doc/js/app.js
|
296
|
-
- examples/doc/js/full_list.js
|
297
|
-
- examples/doc/js/jquery.js
|
298
|
-
- examples/doc/method_list.html
|
299
|
-
- examples/doc/top-level-namespace.html
|
300
288
|
- examples/example.rb
|
301
|
-
- examples/extractive.pdf
|
302
289
|
- examples/extractive.rb
|
303
|
-
- examples/finance.rb
|
304
|
-
- examples/hyperlinks.rb
|
305
|
-
- examples/image1.gif
|
306
|
-
- examples/image1.jpeg
|
307
|
-
- examples/image1.jpg
|
308
|
-
- examples/image1.png
|
309
290
|
- examples/page_setup.rb
|
310
|
-
- examples/sample.png
|
311
|
-
- examples/scraping_html.rb
|
312
291
|
- examples/sheet_protection.rb
|
313
|
-
- examples/sheet_view.rb
|
314
|
-
- examples/skydrive/axlsx.csv
|
315
|
-
- examples/skydrive/axlsx.xlsx
|
316
292
|
- examples/skydrive/real_example.rb
|
317
|
-
- examples/sprk2012/basics.rb
|
318
|
-
- examples/sprk2012/basics.xlsx
|
319
|
-
- examples/sprk2012/gravatar.jpeg
|
320
|
-
- examples/sprk2012/hair_club.jpg
|
321
|
-
- examples/sprk2012/images.rb
|
322
|
-
- examples/sprk2012/images.xlsx
|
323
|
-
- examples/sprk2012/line_chart.rb
|
324
|
-
- examples/sprk2012/line_chart.xlsx
|
325
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 10.42.06 PM.png
|
326
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 11.07.48 PM.png
|
327
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 8.31.50 PM.png
|
328
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 9.23.27 PM.png
|
329
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 9.32.06 PM.png
|
330
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 9.33.35 PM.png
|
331
|
-
- examples/sprk2012/Screen Shot 2012-09-11 at 9.46.44 PM.png
|
332
|
-
- examples/sprk2012/Screen Shot 2012-09-12 at 5.07.23 PM.png
|
333
|
-
- examples/sprk2012/sprk2012.key
|
334
|
-
- examples/sprk2012/styles.rb
|
335
|
-
- examples/sprk2012/styles.xlsx
|
336
293
|
- examples/styles.rb
|
337
|
-
- examples/
|
294
|
+
- examples/wrap_text.rb
|
295
|
+
- examples/image1.jpeg
|
338
296
|
- LICENSE
|
339
297
|
- README.md
|
340
298
|
- Rakefile
|
@@ -382,6 +340,7 @@ files:
|
|
382
340
|
- test/drawing/tc_view_3D.rb
|
383
341
|
- test/drawing/tc_vml_drawing.rb
|
384
342
|
- test/drawing/tc_vml_shape.rb
|
343
|
+
- test/example.xlsx
|
385
344
|
- test/profile.rb
|
386
345
|
- test/rels/tc_relationship.rb
|
387
346
|
- test/rels/tc_relationships.rb
|
@@ -424,6 +383,7 @@ files:
|
|
424
383
|
- test/workbook/worksheet/tc_data_bar.rb
|
425
384
|
- test/workbook/worksheet/tc_data_validation.rb
|
426
385
|
- test/workbook/worksheet/tc_date_time_converter.rb
|
386
|
+
- test/workbook/worksheet/tc_header_footer.rb
|
427
387
|
- test/workbook/worksheet/tc_icon_set.rb
|
428
388
|
- test/workbook/worksheet/tc_page_margins.rb
|
429
389
|
- test/workbook/worksheet/tc_page_set_up_pr.rb
|
@@ -461,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
461
421
|
version: '0'
|
462
422
|
segments:
|
463
423
|
- 0
|
464
|
-
hash:
|
424
|
+
hash: 3556182461904299335
|
465
425
|
requirements: []
|
466
426
|
rubyforge_project:
|
467
427
|
rubygems_version: 1.8.24
|
@@ -511,6 +471,7 @@ test_files:
|
|
511
471
|
- test/drawing/tc_view_3D.rb
|
512
472
|
- test/drawing/tc_vml_drawing.rb
|
513
473
|
- test/drawing/tc_vml_shape.rb
|
474
|
+
- test/example.xlsx
|
514
475
|
- test/profile.rb
|
515
476
|
- test/rels/tc_relationship.rb
|
516
477
|
- test/rels/tc_relationships.rb
|
@@ -553,6 +514,7 @@ test_files:
|
|
553
514
|
- test/workbook/worksheet/tc_data_bar.rb
|
554
515
|
- test/workbook/worksheet/tc_data_validation.rb
|
555
516
|
- test/workbook/worksheet/tc_date_time_converter.rb
|
517
|
+
- test/workbook/worksheet/tc_header_footer.rb
|
556
518
|
- test/workbook/worksheet/tc_icon_set.rb
|
557
519
|
- test/workbook/worksheet/tc_page_margins.rb
|
558
520
|
- test/workbook/worksheet/tc_page_set_up_pr.rb
|