axlsx 1.1.0 → 1.1.1
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.
- data/CHANGELOG.md +18 -0
- data/README.md +323 -236
- data/Rakefile +6 -2
- data/examples/axlsx.xlsx +0 -0
- data/examples/example.csv +1000 -1000
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/real_example.rb +63 -0
- data/examples/sample.png +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/lib/axlsx/drawing/scatter_chart.rb +18 -18
- data/lib/axlsx/stylesheet/color.rb +0 -1
- data/lib/axlsx/stylesheet/styles.rb +6 -4
- data/lib/axlsx/util/doc/_index.html +84 -0
- data/lib/axlsx/util/doc/class_list.html +47 -0
- data/lib/axlsx/util/doc/css/common.css +1 -0
- data/lib/axlsx/util/doc/css/full_list.css +55 -0
- data/lib/axlsx/util/doc/css/style.css +322 -0
- data/lib/axlsx/util/doc/file_list.html +46 -0
- data/lib/axlsx/util/doc/frames.html +13 -0
- data/lib/axlsx/util/doc/index.html +84 -0
- data/lib/axlsx/util/doc/js/app.js +205 -0
- data/lib/axlsx/util/doc/js/full_list.js +173 -0
- data/lib/axlsx/util/doc/js/jquery.js +16 -0
- data/lib/axlsx/util/doc/method_list.html +46 -0
- data/lib/axlsx/util/doc/top-level-namespace.html +95 -0
- data/{test/benchmark.rb~ → lib/axlsx/util/font_tables.rb~} +0 -0
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +12 -13
- data/lib/axlsx/workbook/worksheet/cell.rb +10 -29
- data/lib/axlsx/workbook/worksheet/worksheet.rb +23 -21
- data/test/benchmark.rb +30 -38
- data/test/profile.rb +2 -1
- data/test/stylesheet/tc_styles.rb +16 -1
- data/test/workbook/worksheet/tc_cell.rb +22 -12
- data/test/workbook/worksheet/tc_date_time_converter.rb +11 -5
- data/test/workbook/worksheet/tc_worksheet.rb +9 -2
- metadata +63 -125
- data/examples/example.rb~ +0 -112
- data/lib/axlsx/stylesheet/#num_fmt.rb# +0 -69
- data/test/#benchmark.txt# +0 -7
- data/test/#tc_helper.rb# +0 -3
- data/test/benchmark.txt +0 -6
- data/test/benchmark.txt~ +0 -6
- data/test/example.csv +0 -1000
- data/test/example.xlsx +0 -0
- data/test/example_streamed.xlsx +0 -0
- data/test/tc_axlsx.rb~ +0 -0
- data/test/tc_helper.rb~ +0 -3
data/test/profile.rb
CHANGED
@@ -15,11 +15,12 @@ require 'perftools'
|
|
15
15
|
row = []
|
16
16
|
input = (32..126).to_a.pack('U*').chars.to_a
|
17
17
|
20.times { row << input.shuffle.join}
|
18
|
-
times =
|
18
|
+
times = 3000
|
19
19
|
|
20
20
|
PerfTools::CpuProfiler.start("/tmp/axlsx_noautowidth") do
|
21
21
|
p = Axlsx::Package.new
|
22
22
|
p.use_autowidth = false
|
23
|
+
p.use_shared_strings = true
|
23
24
|
wb = p.workbook
|
24
25
|
|
25
26
|
#A Simple Workbook
|
@@ -19,11 +19,26 @@ class TestStyles < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
def test_add_style_border_hash
|
21
21
|
border_count = @styles.borders.size
|
22
|
-
s = @styles.add_style :border => {:style
|
22
|
+
s = @styles.add_style :border => {:style => :thin, :color => "FFFF0000"}
|
23
23
|
assert_equal(@styles.borders.size, border_count + 1)
|
24
24
|
assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000")
|
25
25
|
assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} }
|
26
|
+
assert_equal @styles.borders.last.prs.size, 4
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_add_style_border_edges
|
30
|
+
s = @styles.add_style :border => { :style => :thin, :color => "0000FFFF", :edges => [:top, :bottom] }
|
31
|
+
parts = @styles.borders.last.prs
|
32
|
+
parts.each { |pr| assert_equal(pr.color.rgb, "0000FFFF", "Style is applied to #{pr.name} properly") }
|
33
|
+
assert((parts.map { |pr| pr.name.to_s }.sort && ['bottom', 'top']).size == 2, "specify two edges, and you get two border prs")
|
34
|
+
end
|
26
35
|
|
36
|
+
def test_do_not_alter_options_in_add_style
|
37
|
+
#This should test all options, but for now - just the bits that we know caused some pain
|
38
|
+
options = { :border => { :style => :thin, :color =>"FF000000" } }
|
39
|
+
@styles.add_style options
|
40
|
+
assert_equal options[:border][:style], :thin, 'thin style is stil in option'
|
41
|
+
assert_equal options[:border][:color], "FF000000", 'color is stil in option'
|
27
42
|
end
|
28
43
|
|
29
44
|
def test_add_style
|
@@ -212,24 +212,34 @@ class TestCell < Test::Unit::TestCase
|
|
212
212
|
assert_equal(@c.row.worksheet.merged_cells.last, "A1:C1")
|
213
213
|
end
|
214
214
|
|
215
|
-
def test_equality
|
216
|
-
c2 = @row.add_cell 1, :type=>:float, :style=>1
|
217
|
-
|
218
|
-
assert_equal(c2.shareable_hash,@c.shareable_hash)
|
219
|
-
c3 = @row.add_cell 2, :type=>:float, :style=>1
|
220
|
-
c4 = @row.add_cell 1, :type=>:float, :style=>1, :color => "#FFFFFFFF"
|
221
|
-
assert_equal(c4.shareable_hash == c2.shareable_hash,false)
|
222
|
-
c5 = @row.add_cell 1, :type=>:float, :style=>1, :color => "#FFFFFFFF"
|
223
|
-
assert_equal(c5.shareable_hash, c4.shareable_hash)
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
215
|
def test_ssti
|
228
216
|
assert_raise(ArgumentError, "ssti must be an unsigned integer!") { @c.send(:ssti=, -1) }
|
229
217
|
@c.send :ssti=, 1
|
230
218
|
assert_equal(@c.ssti, 1)
|
231
219
|
end
|
232
220
|
|
221
|
+
def test_plain_string
|
222
|
+
@c.type = :integer
|
223
|
+
assert_equal(@c.plain_string?, false)
|
224
|
+
|
225
|
+
@c.type = :string
|
226
|
+
@c.value = 'plain string'
|
227
|
+
assert_equal(@c.plain_string?, true)
|
228
|
+
|
229
|
+
@c.value = nil
|
230
|
+
assert_equal(@c.plain_string?, false)
|
231
|
+
|
232
|
+
@c.value = ''
|
233
|
+
assert_equal(@c.plain_string?, false)
|
234
|
+
|
235
|
+
@c.value = '=sum'
|
236
|
+
assert_equal(@c.plain_string?, false)
|
237
|
+
|
238
|
+
@c.value = 'plain string'
|
239
|
+
@c.font_name = 'Arial'
|
240
|
+
assert_equal(@c.plain_string?, false)
|
241
|
+
end
|
242
|
+
|
233
243
|
def test_to_xml_string
|
234
244
|
c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
|
235
245
|
assert_equal(c_xml.xpath("/c[@s=1]").size, 1)
|
@@ -111,12 +111,18 @@ class TestDateTimeConverter < Test::Unit::TestCase
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_timezone
|
114
|
+
|
114
115
|
utc = Time.utc 2012 # January 1st, 2012 at 0:00 UTC
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
|
117
|
+
# JRuby makes no assumption on time zone. randym
|
118
|
+
#local = begin
|
119
|
+
# Time.new 2012, 1, 1, 1, 0, 0, 3600 # January 1st, 2012 at 1:00 GMT+1
|
120
|
+
#rescue ArgumentError
|
121
|
+
# Time.parse "2012-01-01 01:00:00 +0100"
|
122
|
+
#end
|
123
|
+
|
124
|
+
local = Time.parse "2012-01-01 01:00:00 +0100"
|
125
|
+
|
120
126
|
assert_equal local, utc
|
121
127
|
assert_equal Axlsx::DateTimeConverter::time_to_serial(local), Axlsx::DateTimeConverter::time_to_serial(utc)
|
122
128
|
Axlsx::Workbook.date1904 = true
|
@@ -207,8 +207,10 @@ class TestWorksheet < Test::Unit::TestCase
|
|
207
207
|
def test_to_xml_string_merge_cells
|
208
208
|
@ws.add_row [1, "two"]
|
209
209
|
@ws.merge_cells "A1:D1"
|
210
|
+
@ws.merge_cells "E1:F1"
|
210
211
|
doc = Nokogiri::XML(@ws.to_xml_string)
|
211
212
|
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:mergeCells/xmlns:mergeCell[@ref="A1:D1"]').size, 1)
|
213
|
+
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:mergeCells/xmlns:mergeCell[@ref="E1:F1"]').size, 1)
|
212
214
|
end
|
213
215
|
|
214
216
|
def test_to_xml_string_page_margins
|
@@ -252,8 +254,14 @@ class TestWorksheet < Test::Unit::TestCase
|
|
252
254
|
assert(errors.empty?, "error free validation")
|
253
255
|
end
|
254
256
|
|
255
|
-
|
257
|
+
# Make sure the XML for all optional elements (like pageMargins, autoFilter, ...)
|
258
|
+
# is generated in correct order.
|
259
|
+
def test_valid_with_optional_elements
|
256
260
|
@ws.page_margins.set :left => 9
|
261
|
+
@ws.auto_filter = "A1:C3"
|
262
|
+
@ws.merge_cells "A4:A5"
|
263
|
+
@ws.add_chart Axlsx::Pie3DChart
|
264
|
+
@ws.add_table "E1:F3"
|
257
265
|
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
|
258
266
|
doc = Nokogiri::XML(@ws.to_xml_string)
|
259
267
|
errors = []
|
@@ -299,7 +307,6 @@ class TestWorksheet < Test::Unit::TestCase
|
|
299
307
|
@ws.add_row ["chasing windmills", "penut"]
|
300
308
|
@ws.column_widths nil, 0.5
|
301
309
|
assert_equal(@ws.column_info[1].width, 0.5, 'eat my width')
|
302
|
-
assert_raise(ArgumentError, 'reject invalid columns') { @ws.column_widths 2, 7, nil }
|
303
310
|
assert_raise(ArgumentError, 'only accept unsigned ints') { @ws.column_widths 2, 7, -1 }
|
304
311
|
assert_raise(ArgumentError, 'only accept Integer, Float or Fixnum') { @ws.column_widths 2, 7, "-1" }
|
305
312
|
end
|
metadata
CHANGED
@@ -1,108 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: axlsx
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Randy Morgan
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: nokogiri
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2160215160 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 5
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 4
|
32
|
-
- 1
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 1.4.1
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rmagick
|
38
23
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 59
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 12
|
48
|
-
- 2
|
49
|
-
version: 2.12.2
|
50
|
-
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *2160215160
|
25
|
+
- !ruby/object:Gem::Dependency
|
53
26
|
name: rubyzip
|
54
|
-
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &2160213980 !ruby/object:Gem::Requirement
|
56
28
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 9
|
64
|
-
version: "0.9"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.5
|
65
33
|
type: :runtime
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: rake
|
69
34
|
prerelease: false
|
70
|
-
|
35
|
+
version_requirements: *2160213980
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &2160213220 !ruby/object:Gem::Requirement
|
71
39
|
none: false
|
72
|
-
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 49
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
- 8
|
79
|
-
- 7
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
80
43
|
version: 0.8.7
|
81
44
|
type: :runtime
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: yard
|
85
45
|
prerelease: false
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
type: :development
|
96
|
-
version_requirements: *id005
|
97
|
-
description: " xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.\n"
|
46
|
+
version_requirements: *2160213220
|
47
|
+
description: ! ' xlsx generation with charts, images, automated column width, customizable
|
48
|
+
styles and full schema validation. Axlsx excels at helping you generate beautiful
|
49
|
+
Office Open XML Spreadsheet documents without having to understand the entire ECMA
|
50
|
+
specification. Check out the README for some examples of how easy it is. Best of
|
51
|
+
all, you can validate your xlsx file before serialization so you know for sure that
|
52
|
+
anything generated is going to load on your client''s machine.
|
53
|
+
|
54
|
+
'
|
98
55
|
email: digital.ipseity@gmail.com
|
99
56
|
executables: []
|
100
|
-
|
101
57
|
extensions: []
|
102
|
-
|
103
58
|
extra_rdoc_files: []
|
104
|
-
|
105
|
-
files:
|
59
|
+
files:
|
106
60
|
- lib/axlsx/content_type/content_type.rb
|
107
61
|
- lib/axlsx/content_type/default.rb
|
108
62
|
- lib/axlsx/content_type/override.rb
|
@@ -143,7 +97,6 @@ files:
|
|
143
97
|
- lib/axlsx/package.rb
|
144
98
|
- lib/axlsx/rels/relationship.rb
|
145
99
|
- lib/axlsx/rels/relationships.rb
|
146
|
-
- lib/axlsx/stylesheet/#num_fmt.rb#
|
147
100
|
- lib/axlsx/stylesheet/border.rb
|
148
101
|
- lib/axlsx/stylesheet/border_pr.rb
|
149
102
|
- lib/axlsx/stylesheet/cell_alignment.rb
|
@@ -164,6 +117,20 @@ files:
|
|
164
117
|
- lib/axlsx/util/cbf.rb
|
165
118
|
- lib/axlsx/util/cfb.rb~
|
166
119
|
- lib/axlsx/util/constants.rb
|
120
|
+
- lib/axlsx/util/doc/_index.html
|
121
|
+
- lib/axlsx/util/doc/class_list.html
|
122
|
+
- lib/axlsx/util/doc/css/common.css
|
123
|
+
- lib/axlsx/util/doc/css/full_list.css
|
124
|
+
- lib/axlsx/util/doc/css/style.css
|
125
|
+
- lib/axlsx/util/doc/file_list.html
|
126
|
+
- lib/axlsx/util/doc/frames.html
|
127
|
+
- lib/axlsx/util/doc/index.html
|
128
|
+
- lib/axlsx/util/doc/js/app.js
|
129
|
+
- lib/axlsx/util/doc/js/full_list.js
|
130
|
+
- lib/axlsx/util/doc/js/jquery.js
|
131
|
+
- lib/axlsx/util/doc/method_list.html
|
132
|
+
- lib/axlsx/util/doc/top-level-namespace.html
|
133
|
+
- lib/axlsx/util/font_tables.rb~
|
167
134
|
- lib/axlsx/util/ms_off_crypto.rb
|
168
135
|
- lib/axlsx/util/ms_off_crypto.rb~
|
169
136
|
- lib/axlsx/util/ms_offcrypto.rb~
|
@@ -226,9 +193,9 @@ files:
|
|
226
193
|
- lib/schema/vml-wordprocessingDrawing.xsd
|
227
194
|
- lib/schema/wml.xsd
|
228
195
|
- lib/schema/xml.xsd
|
196
|
+
- examples/axlsx.xlsx
|
229
197
|
- examples/example.csv
|
230
198
|
- examples/example.rb
|
231
|
-
- examples/example.rb~
|
232
199
|
- examples/example.xlsx
|
233
200
|
- examples/example_streamed.xlsx
|
234
201
|
- examples/image1.gif
|
@@ -236,18 +203,15 @@ files:
|
|
236
203
|
- examples/image1.jpg
|
237
204
|
- examples/image1.png
|
238
205
|
- examples/no-use_autowidth.xlsx
|
206
|
+
- examples/real_example.rb
|
207
|
+
- examples/sample.png
|
239
208
|
- examples/shared_strings_example.xlsx
|
240
209
|
- LICENSE
|
241
210
|
- README.md
|
242
211
|
- Rakefile
|
243
212
|
- CHANGELOG.md
|
244
213
|
- .yardopts
|
245
|
-
- test/#benchmark.txt#
|
246
|
-
- test/#tc_helper.rb#
|
247
214
|
- test/benchmark.rb
|
248
|
-
- test/benchmark.rb~
|
249
|
-
- test/benchmark.txt
|
250
|
-
- test/benchmark.txt~
|
251
215
|
- test/content_type/tc_content_type.rb
|
252
216
|
- test/content_type/tc_default.rb
|
253
217
|
- test/content_type/tc_override.rb
|
@@ -281,9 +245,6 @@ files:
|
|
281
245
|
- test/drawing/tc_val_axis.rb
|
282
246
|
- test/drawing/tc_val_axis_data.rb
|
283
247
|
- test/drawing/tc_view_3D.rb
|
284
|
-
- test/example.csv
|
285
|
-
- test/example.xlsx
|
286
|
-
- test/example_streamed.xlsx
|
287
248
|
- test/profile.rb
|
288
249
|
- test/rels/tc_relationship.rb
|
289
250
|
- test/rels/tc_relationships.rb
|
@@ -305,9 +266,7 @@ files:
|
|
305
266
|
- test/stylesheet/tc_table_styles.rb
|
306
267
|
- test/stylesheet/tc_xf.rb
|
307
268
|
- test/tc_axlsx.rb
|
308
|
-
- test/tc_axlsx.rb~
|
309
269
|
- test/tc_helper.rb
|
310
|
-
- test/tc_helper.rb~
|
311
270
|
- test/tc_package.rb
|
312
271
|
- test/util/tc_simple_typed_list.rb
|
313
272
|
- test/util/tc_validators.rb
|
@@ -324,46 +283,30 @@ files:
|
|
324
283
|
- test/workbook/worksheet/tc_worksheet.rb
|
325
284
|
homepage: https://github.com/randym/axlsx
|
326
285
|
licenses: []
|
327
|
-
|
328
286
|
post_install_message:
|
329
287
|
rdoc_options: []
|
330
|
-
|
331
|
-
require_paths:
|
288
|
+
require_paths:
|
332
289
|
- lib
|
333
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
290
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
334
291
|
none: false
|
335
|
-
requirements:
|
336
|
-
- -
|
337
|
-
- !ruby/object:Gem::Version
|
338
|
-
hash: 57
|
339
|
-
segments:
|
340
|
-
- 1
|
341
|
-
- 8
|
342
|
-
- 7
|
292
|
+
requirements:
|
293
|
+
- - ! '>='
|
294
|
+
- !ruby/object:Gem::Version
|
343
295
|
version: 1.8.7
|
344
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
345
297
|
none: false
|
346
|
-
requirements:
|
347
|
-
- -
|
348
|
-
- !ruby/object:Gem::Version
|
349
|
-
|
350
|
-
segments:
|
351
|
-
- 0
|
352
|
-
version: "0"
|
298
|
+
requirements:
|
299
|
+
- - ! '>='
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
353
302
|
requirements: []
|
354
|
-
|
355
303
|
rubyforge_project:
|
356
304
|
rubygems_version: 1.8.15
|
357
305
|
signing_key:
|
358
306
|
specification_version: 3
|
359
307
|
summary: excel OOXML (xlsx) with charts, styles, images and autowidth columns.
|
360
|
-
test_files:
|
361
|
-
- test/#benchmark.txt#
|
362
|
-
- test/#tc_helper.rb#
|
308
|
+
test_files:
|
363
309
|
- test/benchmark.rb
|
364
|
-
- test/benchmark.rb~
|
365
|
-
- test/benchmark.txt
|
366
|
-
- test/benchmark.txt~
|
367
310
|
- test/content_type/tc_content_type.rb
|
368
311
|
- test/content_type/tc_default.rb
|
369
312
|
- test/content_type/tc_override.rb
|
@@ -397,9 +340,6 @@ test_files:
|
|
397
340
|
- test/drawing/tc_val_axis.rb
|
398
341
|
- test/drawing/tc_val_axis_data.rb
|
399
342
|
- test/drawing/tc_view_3D.rb
|
400
|
-
- test/example.csv
|
401
|
-
- test/example.xlsx
|
402
|
-
- test/example_streamed.xlsx
|
403
343
|
- test/profile.rb
|
404
344
|
- test/rels/tc_relationship.rb
|
405
345
|
- test/rels/tc_relationships.rb
|
@@ -421,9 +361,7 @@ test_files:
|
|
421
361
|
- test/stylesheet/tc_table_styles.rb
|
422
362
|
- test/stylesheet/tc_xf.rb
|
423
363
|
- test/tc_axlsx.rb
|
424
|
-
- test/tc_axlsx.rb~
|
425
364
|
- test/tc_helper.rb
|
426
|
-
- test/tc_helper.rb~
|
427
365
|
- test/tc_package.rb
|
428
366
|
- test/util/tc_simple_typed_list.rb
|
429
367
|
- test/util/tc_validators.rb
|
data/examples/example.rb~
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'rubygems'
|
3
|
-
require 'axlsx.rb'
|
4
|
-
|
5
|
-
|
6
|
-
#A Simple Workbook
|
7
|
-
p = Axlsx::Package.new
|
8
|
-
p.workbook.add_worksheet do |sheet|
|
9
|
-
sheet.add_row ["First", "Second", "Third"]
|
10
|
-
sheet.add_row [1, 2, 3]
|
11
|
-
end
|
12
|
-
p.serialize("example1.xlsx")
|
13
|
-
|
14
|
-
#Generating A Bar Chart
|
15
|
-
p = Axlsx::Package.new
|
16
|
-
p.workbook.add_worksheet do |sheet|
|
17
|
-
sheet.add_row ["First", "Second", "Third"]
|
18
|
-
sheet.add_row [1, 2, 3]
|
19
|
-
sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
|
20
|
-
chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
|
21
|
-
end
|
22
|
-
end
|
23
|
-
p.serialize("example2.xlsx")
|
24
|
-
|
25
|
-
#Generating A Pie Chart
|
26
|
-
p = Axlsx::Package.new
|
27
|
-
p.workbook.add_worksheet do |sheet|
|
28
|
-
sheet.add_row ["First", "Second", "Third"]
|
29
|
-
sheet.add_row [1, 2, 3]
|
30
|
-
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
|
31
|
-
chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
|
32
|
-
end
|
33
|
-
end
|
34
|
-
p.serialize("example3.xlsx")
|
35
|
-
|
36
|
-
|
37
|
-
#Using Custom Styles
|
38
|
-
|
39
|
-
p = Axlsx::Package.new
|
40
|
-
wb = p.workbook
|
41
|
-
black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
|
42
|
-
blue_cell = wb.styles.add_style :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
|
43
|
-
wb.add_worksheet do |sheet|
|
44
|
-
sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
|
45
|
-
sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
|
46
|
-
end
|
47
|
-
p.serialize("example4.xlsx")
|
48
|
-
|
49
|
-
#Using Custom Formatting and date1904
|
50
|
-
|
51
|
-
p = Axlsx::Package.new
|
52
|
-
wb = p.workbook
|
53
|
-
date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
|
54
|
-
padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
|
55
|
-
percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
|
56
|
-
wb.date1904 = true # required for generation on mac
|
57
|
-
wb.add_worksheet do |sheet|
|
58
|
-
sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
|
59
|
-
sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
|
60
|
-
end
|
61
|
-
p.serialize("example5.xlsx")
|
62
|
-
|
63
|
-
#Validation
|
64
|
-
|
65
|
-
p = Axlsx::Package.new
|
66
|
-
p.workbook.add_worksheet do |sheet|
|
67
|
-
sheet.add_row ["First", "Second", "Third"]
|
68
|
-
sheet.add_row [1, 2, 3]
|
69
|
-
end
|
70
|
-
|
71
|
-
p.validate.each do |error|
|
72
|
-
puts error.inspect
|
73
|
-
end
|
74
|
-
|
75
|
-
#Generating A Line Chart
|
76
|
-
|
77
|
-
p = Axlsx::Package.new
|
78
|
-
p.workbook.add_worksheet do |sheet|
|
79
|
-
sheet.add_row ["First", 1, 5, 7, 9]
|
80
|
-
sheet.add_row ["Second", 5, 2, 14, 9]
|
81
|
-
sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
|
82
|
-
chart.start_at 0, 2
|
83
|
-
chart.end_at 10, 15
|
84
|
-
chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
|
85
|
-
chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
p.serialize("example6.xlsx")
|
90
|
-
|
91
|
-
#Add an Image
|
92
|
-
|
93
|
-
p = Axlsx::Package.new
|
94
|
-
p.workbook.add_worksheet do |sheet|
|
95
|
-
img = File.expand_path('examples/image1.jpeg')
|
96
|
-
puts img
|
97
|
-
sheet.add_image(:image_src => img) do |image|
|
98
|
-
image.width=720
|
99
|
-
image.height=666
|
100
|
-
image.start_at 2, 2
|
101
|
-
end
|
102
|
-
end
|
103
|
-
p.serialize("example7.xlsx")
|
104
|
-
|
105
|
-
|
106
|
-
#Japanese Support
|
107
|
-
|
108
|
-
p = Axlsx::Package.new
|
109
|
-
p.workbook.add_worksheet do |sheet|
|
110
|
-
sheet.add_row ["���{�� "]
|
111
|
-
end
|
112
|
-
p.serialize("example8.xlsx")
|