axlsx 1.2.1 → 1.2.2
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/README.md +5 -2
- data/examples/example.rb +18 -15
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/hyperlinks.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/lib/axlsx/drawing/view_3D.rb +1 -1
- data/lib/axlsx/stylesheet/styles.rb +6 -1
- data/lib/axlsx/util/constants.rb +16 -0
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/worksheet/auto_filter.rb +1 -0
- metadata +4 -3
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
17
17
|
|
18
18
|
**License**: MIT License
|
19
19
|
|
20
|
-
**Latest Version**: 1.2.
|
20
|
+
**Latest Version**: 1.2.2
|
21
21
|
|
22
22
|
**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
|
23
23
|
|
@@ -25,7 +25,7 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
25
25
|
|
26
26
|
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
|
27
27
|
|
28
|
-
**Release Date**: August
|
28
|
+
**Release Date**: August 27th 2012
|
29
29
|
|
30
30
|
If you are working in rails, or with active record see:
|
31
31
|
* http://github.com/randym/acts_as_xlsx
|
@@ -145,6 +145,9 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
|
|
145
145
|
|
146
146
|
#Change log
|
147
147
|
---------
|
148
|
+
- **August.27.12**: 1.2.2
|
149
|
+
- minor patch for auto-filters
|
150
|
+
- minor documentation improvements.
|
148
151
|
- **August.12.12**: 1.2.1
|
149
152
|
- Add support for hyperlinks in worksheets
|
150
153
|
- Fix example that was using old style cell merging with concact.
|
data/examples/example.rb
CHANGED
@@ -55,22 +55,22 @@ wb.add_worksheet(:name => "Cell Level Style Overrides") do |sheet|
|
|
55
55
|
sheet["A1:D1"].each { |c| c.color = "FF0000" }
|
56
56
|
sheet['A1:D2'].each { |c| c.style = Axlsx::STYLE_THIN_BORDER }
|
57
57
|
end
|
58
|
-
|
58
|
+
##```
|
59
59
|
|
60
60
|
##Using Custom Border Styles
|
61
61
|
|
62
62
|
#```ruby
|
63
63
|
#Axlsx defines a thin border style, but you can easily create and use your own.
|
64
64
|
wb.styles do |s|
|
65
|
-
red_border = s.add_style :border => { :style => :thick, :color =>"FFFF0000" }
|
66
|
-
blue_border = s.add_style :border => { :style => :thick, :color =>"FF0000FF"
|
65
|
+
red_border = s.add_style :border => { :style => :thick, :color =>"FFFF0000", :edges => [:left, :right] }
|
66
|
+
blue_border = s.add_style :border => { :style => :thick, :color =>"FF0000FF"}
|
67
67
|
|
68
68
|
wb.add_worksheet(:name => "Custom Borders") do |sheet|
|
69
69
|
sheet.add_row ["wrap", "me", "Up in Red"], :style => red_border
|
70
70
|
sheet.add_row [1, 2, 3], :style => blue_border
|
71
71
|
end
|
72
72
|
end
|
73
|
-
|
73
|
+
##```
|
74
74
|
|
75
75
|
|
76
76
|
##Styling Rows and Columns
|
@@ -101,7 +101,7 @@ wb.styles do |s|
|
|
101
101
|
sheet.rows[1].outlineLevel = 2
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
104
|
+
##```
|
105
105
|
|
106
106
|
|
107
107
|
##Specifying Column Widths
|
@@ -112,7 +112,7 @@ wb.add_worksheet(:name => "custom column widths") do |sheet|
|
|
112
112
|
sheet.add_row ['abcdefg', 'This is a very long text and should flow into the right cell', nil, 'xxx' ]
|
113
113
|
sheet.column_widths nil, 3, 5, nil
|
114
114
|
end
|
115
|
-
|
115
|
+
##```
|
116
116
|
|
117
117
|
##Merging Cells.
|
118
118
|
|
@@ -127,7 +127,7 @@ wb.add_worksheet(:name => 'Merging Cells') do |sheet|
|
|
127
127
|
sheet["A1:D1"].each { |c| c.color = "FF0000"}
|
128
128
|
sheet["A1:D4"].each { |c| c.style = Axlsx::STYLE_THIN_BORDER }
|
129
129
|
end
|
130
|
-
|
130
|
+
##```
|
131
131
|
|
132
132
|
##Add an Image with a hyperlink
|
133
133
|
|
@@ -169,7 +169,7 @@ wb.add_worksheet(:name => "日本語でのシート名") do |sheet|
|
|
169
169
|
sheet.add_row ["华语/華語"]
|
170
170
|
sheet.add_row ["한국어/조선말"]
|
171
171
|
end
|
172
|
-
|
172
|
+
##```
|
173
173
|
|
174
174
|
##Using formula
|
175
175
|
|
@@ -178,7 +178,7 @@ wb.add_worksheet(:name => "Using Formulas") do |sheet|
|
|
178
178
|
sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4']
|
179
179
|
sheet.add_row [1, 2, 3, "=SUM(A2:C2)"]
|
180
180
|
end
|
181
|
-
|
181
|
+
##```
|
182
182
|
|
183
183
|
##Auto Filter
|
184
184
|
|
@@ -195,6 +195,7 @@ end
|
|
195
195
|
|
196
196
|
##Automatic cell types
|
197
197
|
|
198
|
+
|
198
199
|
#```ruby
|
199
200
|
wb.add_worksheet(:name => "Automatic cell types") do |sheet|
|
200
201
|
date_format = wb.styles.add_style :format_code => 'YYYY-MM-DD'
|
@@ -209,23 +210,23 @@ wb.add_worksheet(:name => 'hyperlinks') do |sheet|
|
|
209
210
|
# external references
|
210
211
|
sheet.add_row ['axlsx']
|
211
212
|
sheet.add_hyperlink :location => 'https://github.com/randym/axlsx', :ref => sheet.rows.first.cells.first
|
212
|
-
|
213
213
|
# internal references
|
214
|
+
sheet.add_hyperlink :location => "'Next Sheet'!A1", :ref => 'A2', :target => :sheet
|
214
215
|
sheet.add_row ['next sheet']
|
215
216
|
end
|
216
217
|
|
217
218
|
wb.add_worksheet(:name => 'Next Sheet') do |sheet|
|
218
219
|
sheet.add_row ['hello!']
|
219
220
|
end
|
220
|
-
|
221
|
+
###```
|
221
222
|
|
222
223
|
##Number formatting and currency
|
223
224
|
wb.add_worksheet(:name => "Formats and Currency") do |sheet|
|
224
225
|
currency = wb.styles.add_style :num_fmt => 5
|
225
226
|
red_negative = wb.styles.add_style :num_fmt => 8
|
226
227
|
comma = wb.styles.add_style :num_fmt => 3
|
227
|
-
super_funk = wb.styles.add_style :format_code => '[Green]
|
228
|
-
sheet.add_row %w(Currency RedNegative
|
228
|
+
super_funk = wb.styles.add_style :format_code => '[Green]#'
|
229
|
+
sheet.add_row %w(Currency RedNegative Comma Custom)
|
229
230
|
sheet.add_row [1500, -122.34, 123456789, 594829], :style=> [currency, red_negative, comma, super_funk]
|
230
231
|
end
|
231
232
|
|
@@ -239,7 +240,7 @@ wb.add_worksheet(:name => "Bar Chart") do |sheet|
|
|
239
240
|
chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :title => sheet["A1"]
|
240
241
|
end
|
241
242
|
end
|
242
|
-
|
243
|
+
##```
|
243
244
|
|
244
245
|
##Hide Gridlines in chart
|
245
246
|
|
@@ -471,7 +472,9 @@ p.use_shared_strings = true
|
|
471
472
|
p.serialize("shared_strings_example.xlsx")
|
472
473
|
#```
|
473
474
|
|
474
|
-
|
475
|
+
#p.validate do |er|
|
476
|
+
#puts er.inspect
|
477
|
+
#end
|
475
478
|
##Disabling Autowidth
|
476
479
|
|
477
480
|
#```ruby
|
data/examples/example.xlsx
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -135,6 +135,7 @@ module Axlsx
|
|
135
135
|
# @option options [Integer] num_fmt The number format to apply
|
136
136
|
# @option options [String] format_code The formatting to apply.
|
137
137
|
# @option options [Integer|Hash] border The border style to use.
|
138
|
+
# borders support style, color and edges options @see parse_border_options
|
138
139
|
# @option options [String] bg_color The background color to apply to the cell
|
139
140
|
# @option options [Boolean] hidden Indicates if the cell should be hidden
|
140
141
|
# @option options [Boolean] locked Indicates if the cell should be locked
|
@@ -298,7 +299,11 @@ module Axlsx
|
|
298
299
|
|
299
300
|
# parses Style#add_style options for borders.
|
300
301
|
# @note noop if :border is not specified in options
|
301
|
-
# @option options [Hash|Integer] A border style definition hash or the index of an existing border.
|
302
|
+
# @option options [Hash|Integer] A border style definition hash or the index of an existing border.
|
303
|
+
# Border style definition hashes must include :style and :color key-value entries and
|
304
|
+
# may include an :edges entry that references an array of symbols identifying which border edges
|
305
|
+
# you wish to apply the style or any other valid Border initializer options.
|
306
|
+
# If the :edges entity is not provided the style is applied to all edges of cells that reference this style.
|
302
307
|
# @example
|
303
308
|
# #apply a thick red border to the top and bottom
|
304
309
|
# { :border => { :style => :thick, :color => "FFFF0000", :edges => [:top, :bottom] }
|
data/lib/axlsx/util/constants.rb
CHANGED
@@ -31,6 +31,9 @@ module Axlsx
|
|
31
31
|
# xml schema namespace
|
32
32
|
CORE_NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
|
33
33
|
|
34
|
+
# Digital signature namespace
|
35
|
+
DIGITAL_SIGNATURE_NS = "http://schemas.openxmlformats.org/package/2006/digital-signature"
|
36
|
+
|
34
37
|
# spreadsheet drawing namespace
|
35
38
|
XML_NS_XDR = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
|
36
39
|
|
@@ -61,6 +64,9 @@ module Axlsx
|
|
61
64
|
# core rels namespace
|
62
65
|
CORE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
|
63
66
|
|
67
|
+
# digital signature rels namespace
|
68
|
+
DIGITAL_SIGNATURE_R = "http://schemas.openxmlformats.org/package/2006/relationships/digital- signature/signature"
|
69
|
+
|
64
70
|
# styles rels namespace
|
65
71
|
STYLES_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
|
66
72
|
|
@@ -118,6 +124,15 @@ module Axlsx
|
|
118
124
|
# core content type
|
119
125
|
CORE_CT = "application/vnd.openxmlformats-package.core-properties+xml"
|
120
126
|
|
127
|
+
# digital signature xml content type
|
128
|
+
DIGITAL_SIGNATURE_XML_CT = "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml"
|
129
|
+
|
130
|
+
# digital signature origin content type
|
131
|
+
DIGITAL_SIGNATURE_ORIGIN_CT = "application/vnd.openxmlformats-package.digital-signature-origin"
|
132
|
+
|
133
|
+
# digital signature certificate content type
|
134
|
+
DIGITAL_SIGNATURE_CERTIFICATE_CT = "application/vnd.openxmlformats-package.digital-signature-certificate"
|
135
|
+
|
121
136
|
# chart content type
|
122
137
|
CHART_CT = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
|
123
138
|
|
@@ -136,6 +151,7 @@ module Axlsx
|
|
136
151
|
#drawing content type
|
137
152
|
DRAWING_CT = "application/vnd.openxmlformats-officedocument.drawing+xml"
|
138
153
|
|
154
|
+
|
139
155
|
# xml content type extensions
|
140
156
|
XML_EX = "xml"
|
141
157
|
|
data/lib/axlsx/version.rb
CHANGED
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.2.
|
4
|
+
version: 1.2.2
|
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-08-
|
12
|
+
date: 2012-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- examples/extractive.pdf
|
279
279
|
- examples/extractive.rb
|
280
280
|
- examples/hyperlinks.rb
|
281
|
+
- examples/hyperlinks.xlsx
|
281
282
|
- examples/image1.gif
|
282
283
|
- examples/image1.jpeg
|
283
284
|
- examples/image1.jpg
|
@@ -410,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
410
411
|
version: '0'
|
411
412
|
segments:
|
412
413
|
- 0
|
413
|
-
hash:
|
414
|
+
hash: 3191615889138307722
|
414
415
|
requirements: []
|
415
416
|
rubyforge_project:
|
416
417
|
rubygems_version: 1.8.24
|