axlsx 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +38 -12
- data/examples/example.rb +18 -1
- data/lib/axlsx.rb +14 -8
- data/lib/axlsx/content_type/content_type.rb +1 -0
- data/lib/axlsx/content_type/default.rb +1 -0
- data/lib/axlsx/content_type/override.rb +1 -0
- data/lib/axlsx/doc_props/app.rb +1 -1
- data/lib/axlsx/doc_props/core.rb +1 -0
- data/lib/axlsx/drawing/axis.rb +1 -0
- data/lib/axlsx/drawing/bar_3D_chart.rb +1 -0
- data/lib/axlsx/drawing/bar_series.rb +1 -0
- data/lib/axlsx/drawing/cat_axis.rb +1 -0
- data/lib/axlsx/drawing/cat_axis_data.rb +1 -0
- data/lib/axlsx/drawing/chart.rb +1 -1
- data/lib/axlsx/drawing/drawing.rb +1 -0
- data/lib/axlsx/drawing/graphic_frame.rb +1 -0
- data/lib/axlsx/drawing/hyperlink.rb +1 -1
- data/lib/axlsx/drawing/line_3D_chart.rb +1 -0
- data/lib/axlsx/drawing/line_series.rb +1 -0
- data/lib/axlsx/drawing/marker.rb +1 -0
- data/lib/axlsx/drawing/one_cell_anchor.rb +1 -0
- data/lib/axlsx/drawing/pic.rb +1 -1
- data/lib/axlsx/drawing/picture_locking.rb +1 -0
- data/lib/axlsx/drawing/pie_3D_chart.rb +1 -0
- data/lib/axlsx/drawing/pie_series.rb +1 -0
- data/lib/axlsx/drawing/scaling.rb +1 -0
- data/lib/axlsx/drawing/ser_axis.rb +1 -0
- data/lib/axlsx/drawing/series.rb +1 -0
- data/lib/axlsx/drawing/series_title.rb +1 -0
- data/lib/axlsx/drawing/title.rb +1 -0
- data/lib/axlsx/drawing/two_cell_anchor.rb +1 -0
- data/lib/axlsx/drawing/val_axis.rb +1 -0
- data/lib/axlsx/drawing/val_axis_data.rb +1 -0
- data/lib/axlsx/drawing/view_3D.rb +1 -0
- data/lib/axlsx/package.rb +63 -15
- data/lib/axlsx/rels/relationship.rb +1 -0
- data/lib/axlsx/rels/relationships.rb +1 -0
- data/lib/axlsx/stylesheet/border.rb +1 -0
- data/lib/axlsx/stylesheet/border_pr.rb +1 -0
- data/lib/axlsx/stylesheet/cell_alignment.rb +1 -0
- data/lib/axlsx/stylesheet/cell_protection.rb +1 -0
- data/lib/axlsx/stylesheet/cell_style.rb +1 -0
- data/lib/axlsx/stylesheet/color.rb +1 -0
- data/lib/axlsx/stylesheet/fill.rb +1 -0
- data/lib/axlsx/stylesheet/font.rb +1 -0
- data/lib/axlsx/stylesheet/gradient_fill.rb +1 -1
- data/lib/axlsx/stylesheet/gradient_stop.rb +1 -1
- data/lib/axlsx/stylesheet/num_fmt.rb +1 -0
- data/lib/axlsx/stylesheet/pattern_fill.rb +1 -0
- data/lib/axlsx/stylesheet/styles.rb +6 -6
- data/lib/axlsx/stylesheet/table_style.rb +1 -0
- data/lib/axlsx/stylesheet/table_style_element.rb +1 -0
- data/lib/axlsx/stylesheet/table_styles.rb +1 -0
- data/lib/axlsx/stylesheet/xf.rb +1 -0
- data/lib/axlsx/util/cbf.rb +1 -0
- data/lib/axlsx/util/constants.rb +7 -0
- data/lib/axlsx/util/ms_off_crypto.rb +1 -1
- data/lib/axlsx/util/parser.rb +1 -0
- data/lib/axlsx/util/simple_typed_list.rb +2 -1
- data/lib/axlsx/util/storage.rb +1 -0
- data/lib/axlsx/util/validators.rb +11 -2
- data/lib/axlsx/version.rb +2 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +71 -0
- data/lib/axlsx/workbook/shared_strings_table.rb~ +69 -0
- data/lib/axlsx/workbook/workbook.rb +25 -3
- data/lib/axlsx/workbook/worksheet/cell.rb +75 -37
- data/lib/axlsx/workbook/worksheet/row.rb +15 -0
- data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +35 -3
- data/test/content_type/tc_content_type.rb +2 -0
- data/test/content_type/tc_default.rb +2 -0
- data/test/content_type/tc_override.rb +1 -0
- data/test/tc_package.rb +31 -0
- data/test/workbook/tc_shared_strings_table.rb +39 -0
- data/test/workbook/tc_shared_strings_table.rb~ +8 -0
- data/test/workbook/tc_workbook.rb +8 -0
- data/test/workbook/worksheet/tc_cell.rb +13 -0
- data/test/workbook/worksheet/tc_worksheet.rb +20 -3
- metadata +126 -101
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
|
+
- **January.6.12**: 1.0.15 release
|
4
|
+
https://github.com/randym/axlsx/compare/1.0.14...1.0.15
|
5
|
+
- Bug fix add_style specified number formats must be explicity applied for libraOffice
|
6
|
+
- performance improvements from ochko when creating cells with options.
|
7
|
+
- Bug fix setting types=>[:n] when adding a row incorrectly determines the cell type to be string as the value is null during creation.
|
8
|
+
- Release in preparation for password protection merge
|
9
|
+
|
3
10
|
- **December.14.11**: 1.0.14 release
|
4
11
|
- Added support for merging cells
|
5
12
|
- Added support for auto filters
|
data/README.md
CHANGED
@@ -7,16 +7,16 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
7
7
|
**Author**: Randy Morgan
|
8
8
|
**Copyright**: 2011
|
9
9
|
**License**: MIT License
|
10
|
-
**Latest Version**: 1.0.
|
10
|
+
**Latest Version**: 1.0.17
|
11
11
|
**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
|
12
12
|
|
13
|
-
**Release Date**: February
|
13
|
+
**Release Date**: February 14th 2012
|
14
14
|
|
15
15
|
Synopsis
|
16
16
|
--------
|
17
17
|
|
18
18
|
Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language.
|
19
|
-
With Axlsx you can create excel worksheets with charts, images, automated column
|
19
|
+
With Axlsx you can create excel worksheets with charts, images (with links), automated and fixed column widths, customizable styles, functions, merged cells, auto filters, file adn stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
|
20
20
|
|
21
21
|
If you are working in rails, or with active record see:
|
22
22
|
http://github.com/randym/acts_as_xlsx
|
@@ -40,15 +40,15 @@ Feature List
|
|
40
40
|
|
41
41
|
**4. Automatic type support: Axlsx will automatically determine the type of data you are generating. In this release Float, Integer, String and Time types are automatically identified and serialized to your spreadsheet.
|
42
42
|
|
43
|
-
**5. Automatic column widths: Axlsx will automatically determine the appropriate width for your columns based on the content in the worksheet.
|
43
|
+
**5. Automatic and fixed column widths: Axlsx will automatically determine the appropriate width for your columns based on the content in the worksheet, or use any value you specify for the really funky stuff.
|
44
44
|
|
45
45
|
**6. Support for automatically formatted 1904 and 1900 epocs configurable in the workbook.
|
46
46
|
|
47
47
|
**7. Add jpg, gif and png images to worksheets with hyperlinks
|
48
48
|
|
49
|
-
**8.
|
49
|
+
**8. Reference cells in your worksheet with "A1" and "A1:D4" style references or from the workbook using "Sheett1!A3:B4" style references
|
50
50
|
|
51
|
-
**9. Cell level style overrides for default and customized style
|
51
|
+
**9. Cell level style overrides for default and customized style objects
|
52
52
|
|
53
53
|
**10. Support for formulas
|
54
54
|
|
@@ -56,6 +56,10 @@ Feature List
|
|
56
56
|
|
57
57
|
**12. Auto filtering tables with worksheet.auto_filter
|
58
58
|
|
59
|
+
**13. Export using shared strings or inline strings so we can inter-op with iWork Numbers (sans charts for now).
|
60
|
+
|
61
|
+
**14. Output to file or StringIO
|
62
|
+
|
59
63
|
Installing
|
60
64
|
----------
|
61
65
|
|
@@ -90,6 +94,7 @@ To install Axlsx, use the following command:
|
|
90
94
|
end
|
91
95
|
|
92
96
|
##Using Custom Formatting and date1904
|
97
|
+
|
93
98
|
require 'date'
|
94
99
|
wb.styles do |s|
|
95
100
|
date = s.add_style(:format_code => "yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER)
|
@@ -253,11 +258,28 @@ To install Axlsx, use the following command:
|
|
253
258
|
sheet.auto_filter = "A2:D5"
|
254
259
|
end
|
255
260
|
|
261
|
+
##Specifying Column Widths
|
262
|
+
|
263
|
+
wb.add_worksheet(:name => "custom column widths") do |sheet|
|
264
|
+
sheet.add_row ["I use auto_fit and am very wide", "I use a custom width and am narrow"]
|
265
|
+
sheet.column_widths nil, 3
|
266
|
+
end
|
267
|
+
|
256
268
|
##Validate and Serialize
|
257
269
|
|
258
270
|
p.validate.each { |e| puts e.message }
|
259
271
|
p.serialize("example.xlsx")
|
260
272
|
|
273
|
+
# alternatively, serilaize to StringIO
|
274
|
+
s = p.to_stream()
|
275
|
+
File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) }
|
276
|
+
|
277
|
+
##Using Shared Strings
|
278
|
+
|
279
|
+
p.use_shared_strings = true
|
280
|
+
p.serialize("shared_strings_example.xlsx")
|
281
|
+
|
282
|
+
|
261
283
|
|
262
284
|
#Documentation
|
263
285
|
--------------
|
@@ -272,19 +294,21 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
|
|
272
294
|
|
273
295
|
#Changelog
|
274
296
|
---------
|
297
|
+
- ** February.14.12**: 1.0.17 release
|
298
|
+
https://github.com/randym/axlsx/compare/1.0.16...1.0.17
|
299
|
+
- Added in support for serializing to StringIO
|
300
|
+
- Added in support for using shared strings table. This makes most of the features in axlsx interoperable with iWorks Numbers
|
301
|
+
- Added in support for fixed column_widths
|
302
|
+
- Removed unneded depenencies on activesupport and i18n
|
303
|
+
|
275
304
|
- ** February.2.12**: 1.0.16 release
|
305
|
+
https://github.com/randym/axlsx/compare/1.0.15...1.0.16
|
276
306
|
- Bug fix for schema file locations when validating in rails
|
277
307
|
- Added hyperlink to images
|
278
308
|
- date1904 now automatically set in bsd and mac environments
|
279
309
|
- removed whitespace/indentation from xml outputs
|
280
310
|
- col_style now skips rows that do not contain cells at the column index
|
281
311
|
|
282
|
-
- **January.6.12**: 1.0.15 release
|
283
|
-
- Bug fix add_style specified number formats must be explicity applied for libraOffice
|
284
|
-
- performance improvements from ochko when creating cells with options.
|
285
|
-
- Bug fix setting types=>[:n] when adding a row incorrectly determines the cell type to be string as the value is null during creation.
|
286
|
-
- Release in preparation for password protection merge
|
287
|
-
|
288
312
|
|
289
313
|
Please see the {file:CHANGELOG.md} document for past release information.
|
290
314
|
|
@@ -294,6 +318,8 @@ Please see the {file:CHANGELOG.md} document for past release information.
|
|
294
318
|
|
295
319
|
[kleine2](https://github.com/kleine2) - for generously donating in return for the image hyperlink feature.
|
296
320
|
|
321
|
+
[ffmike](https://github.com/ffmike) - for knocking down an over restrictive i18n dependency, massive patience and great communication skills.
|
322
|
+
|
297
323
|
#Copyright and License
|
298
324
|
----------
|
299
325
|
|
data/examples/example.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
require 'axlsx'
|
3
|
+
require 'axlsx.rb'
|
4
4
|
|
5
5
|
p = Axlsx::Package.new
|
6
6
|
wb = p.workbook
|
@@ -187,10 +187,27 @@
|
|
187
187
|
sheet.auto_filter = "A2:D5"
|
188
188
|
end
|
189
189
|
|
190
|
+
##Specifying Column Widths
|
191
|
+
|
192
|
+
wb.add_worksheet(:name => "custom column widths") do |sheet|
|
193
|
+
sheet.add_row ["I use autowidth and am very wide", "I use a custom width and am narrow"]
|
194
|
+
sheet.column_widths nil, 3
|
195
|
+
end
|
196
|
+
|
190
197
|
##Validate and Serialize
|
191
198
|
|
192
199
|
p.validate.each { |e| puts e.message }
|
193
200
|
p.serialize("example.xlsx")
|
194
201
|
|
202
|
+
s = p.to_stream()
|
203
|
+
File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) }
|
204
|
+
|
205
|
+
|
206
|
+
##Using Shared Strings
|
207
|
+
|
208
|
+
p.use_shared_strings = true
|
209
|
+
p.serialize("shared_strings_example.xlsx")
|
210
|
+
|
211
|
+
|
195
212
|
|
196
213
|
|
data/lib/axlsx.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
|
2
|
-
Encoding::default_external = 'UTF-8' unless RUBY_VERSION < '1.9'
|
3
|
-
|
1
|
+
# encoding: UTF-8
|
4
2
|
require 'axlsx/version.rb'
|
5
3
|
|
6
4
|
require 'axlsx/util/simple_typed_list.rb'
|
7
5
|
require 'axlsx/util/constants.rb'
|
8
6
|
require 'axlsx/util/validators.rb'
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
require 'axlsx/util/storage.rb'
|
8
|
+
require 'axlsx/util/cbf.rb'
|
9
|
+
require 'axlsx/util/ms_off_crypto.rb'
|
12
10
|
|
13
11
|
|
14
12
|
# to be included with parsable intitites.
|
@@ -27,8 +25,6 @@ require 'axlsx/package.rb'
|
|
27
25
|
|
28
26
|
#required gems
|
29
27
|
require 'nokogiri'
|
30
|
-
require 'active_support/core_ext/object/instance_variables'
|
31
|
-
require 'active_support/inflector'
|
32
28
|
require 'RMagick'
|
33
29
|
require 'zip/zip'
|
34
30
|
|
@@ -36,6 +32,16 @@ require 'zip/zip'
|
|
36
32
|
require 'bigdecimal'
|
37
33
|
require 'time'
|
38
34
|
|
35
|
+
#if object does not have this already, I am borrowing it from active_support.
|
36
|
+
# I am a very big fan of activesupports instance_values method, but do not want to require nor include the entire
|
37
|
+
# library just for this one method.
|
38
|
+
if !Object.respond_to?(:instance_values)
|
39
|
+
Object.send :public # patch for 1.8.7 as it uses private scope
|
40
|
+
Object.send :define_method, :instance_values do
|
41
|
+
Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
39
45
|
|
40
46
|
# 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.
|
41
47
|
module Axlsx
|
data/lib/axlsx/doc_props/app.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
module Axlsx
|
3
3
|
# App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object.
|
4
4
|
# @see shared-documentPropertiesExtended.xsd
|
data/lib/axlsx/doc_props/core.rb
CHANGED
data/lib/axlsx/drawing/axis.rb
CHANGED
data/lib/axlsx/drawing/chart.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
module Axlsx
|
3
3
|
# a hyperlink object adds an action to an image when clicked so that when the image is clicked the link is fecthed.
|
4
4
|
# @note using the hyperlink option when calling add_image on a drawing object is the recommended way to manage hyperlinks
|
data/lib/axlsx/drawing/marker.rb
CHANGED
data/lib/axlsx/drawing/pic.rb
CHANGED
data/lib/axlsx/drawing/series.rb
CHANGED
data/lib/axlsx/drawing/title.rb
CHANGED
data/lib/axlsx/package.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
module Axlsx
|
3
3
|
# Package is responsible for managing all the bits and peices that Open Office XML requires to make a valid
|
4
4
|
# xlsx document including valdation and serialization.
|
5
5
|
class Package
|
6
6
|
|
7
|
-
|
7
|
+
|
8
8
|
# provides access to the app doc properties for this package
|
9
9
|
# see App
|
10
10
|
attr_reader :app
|
@@ -17,14 +17,31 @@ module Axlsx
|
|
17
17
|
#
|
18
18
|
# @param [Hash] options A hash that you can use to specify the author and workbook for this package.
|
19
19
|
# @option options [String] :author The author of the document
|
20
|
+
# @option options [Boolean] :use_shared_strings This is passed to the workbook to specify that shared strings should be used when serializing the package.
|
20
21
|
# @example Package.new :author => 'you!', :workbook => Workbook.new
|
21
22
|
def initialize(options={})
|
22
23
|
@workbook = nil
|
23
24
|
@core, @app = Core.new, App.new
|
24
25
|
@core.creator = options[:author] || @core.creator
|
26
|
+
options.each do |o|
|
27
|
+
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
28
|
+
end
|
25
29
|
yield self if block_given?
|
26
30
|
end
|
27
31
|
|
32
|
+
# Shortcut to specify that the workbook should use shared strings
|
33
|
+
# @see Workbook#use_shared_strings
|
34
|
+
def use_shared_strings=(v)
|
35
|
+
Axlsx::validate_boolean(v);
|
36
|
+
workbook.use_shared_strings = v
|
37
|
+
end
|
38
|
+
|
39
|
+
# Shortcut to determine if the workbook is configured to use shared strings
|
40
|
+
# @see Workbook#use_shared_strings
|
41
|
+
def use_shared_strings
|
42
|
+
workbook.use_shared_strings
|
43
|
+
end
|
44
|
+
|
28
45
|
# The workbook this package will serialize or validate.
|
29
46
|
# @return [Workbook] If no workbook instance has been assigned with this package a new Workbook instance is returned.
|
30
47
|
# @raise ArgumentError if workbook parameter is not a Workbook instance.
|
@@ -57,6 +74,7 @@ module Axlsx
|
|
57
74
|
#
|
58
75
|
# @param [File] output The file you want to serialize your package to
|
59
76
|
# @param [Boolean] confirm_valid Validate the package prior to serialization.
|
77
|
+
# @option options stream indicates if we should be writing to a stream or a file. True for stream, nil for file
|
60
78
|
# @return [Boolean] False if confirm_valid and validation errors exist. True if the package was serialized
|
61
79
|
# @note A tremendous amount of effort has gone into ensuring that you cannot create invalid xlsx documents.
|
62
80
|
# confirm_valid should be used in the rare case that you cannot open the serialized file.
|
@@ -70,26 +88,28 @@ module Axlsx
|
|
70
88
|
# # You will find a file called test.xlsx
|
71
89
|
def serialize(output, confirm_valid=false)
|
72
90
|
return false unless !confirm_valid || self.validate.empty?
|
73
|
-
p = parts
|
74
91
|
Zip::ZipOutputStream.open(output) do |zip|
|
75
|
-
|
76
|
-
unless part[:doc].nil?
|
77
|
-
zip.put_next_entry(part[:entry]);
|
78
|
-
entry = ['1.9.2', '1.9.3'].include?(RUBY_VERSION) ? part[:doc].force_encoding('BINARY') : part[:doc]
|
79
|
-
zip.puts(entry)
|
80
|
-
end
|
81
|
-
unless part[:path].nil?
|
82
|
-
zip.put_next_entry(part[:entry]);
|
83
|
-
# binread for 1.9.3
|
84
|
-
zip.write IO.respond_to?(:binread) ? IO.binread(part[:path]) : IO.read(part[:path])
|
85
|
-
end
|
86
|
-
end
|
92
|
+
write_parts(zip)
|
87
93
|
end
|
88
94
|
true
|
89
95
|
end
|
96
|
+
|
97
|
+
|
98
|
+
# Serialize your workbook to a StringIO instance
|
99
|
+
# @param [Boolean] confirm_valid Validate the package prior to serialization.
|
100
|
+
# @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not.
|
101
|
+
def to_stream(confirm_valid=false)
|
102
|
+
return false unless !confirm_valid || self.validate.empty?
|
103
|
+
zip = write_parts(Zip::ZipOutputStream.new("streamed", true))
|
104
|
+
stream = zip.close_buffer
|
105
|
+
stream.rewind
|
106
|
+
stream
|
107
|
+
end
|
90
108
|
|
91
109
|
# Encrypt the package into a CFB using the password provided
|
110
|
+
# This is not ready yet
|
92
111
|
def encrypt(file_name, password)
|
112
|
+
return false
|
93
113
|
moc = MsOffCrypto.new(file_name, password)
|
94
114
|
moc.save
|
95
115
|
end
|
@@ -117,6 +137,26 @@ module Axlsx
|
|
117
137
|
|
118
138
|
private
|
119
139
|
|
140
|
+
# Writes the package parts to a zip archive.
|
141
|
+
# @param [Zip::ZipOutputStream] zip
|
142
|
+
# @return [Zip::ZipOutputStream]
|
143
|
+
def write_parts(zip)
|
144
|
+
p = parts
|
145
|
+
p.each do |part|
|
146
|
+
unless part[:doc].nil?
|
147
|
+
zip.put_next_entry(part[:entry]);
|
148
|
+
entry = ['1.9.2', '1.9.3'].include?(RUBY_VERSION) ? part[:doc].force_encoding('BINARY') : part[:doc]
|
149
|
+
zip.puts(entry)
|
150
|
+
end
|
151
|
+
unless part[:path].nil?
|
152
|
+
zip.put_next_entry(part[:entry]);
|
153
|
+
# binread for 1.9.3
|
154
|
+
zip.write IO.respond_to?(:binread) ? IO.binread(part[:path]) : IO.read(part[:path])
|
155
|
+
end
|
156
|
+
end
|
157
|
+
zip
|
158
|
+
end
|
159
|
+
|
120
160
|
# The parts of a package
|
121
161
|
# @return [Array] An array of hashes that define the entry, document and schema for each part of the package.
|
122
162
|
# @private
|
@@ -143,6 +183,10 @@ module Axlsx
|
|
143
183
|
@parts << {:entry => "xl/#{image.pn}", :path => image.image_src}
|
144
184
|
end
|
145
185
|
|
186
|
+
if use_shared_strings
|
187
|
+
@parts << {:entry => "xl/#{SHARED_STRINGS_PN}", :doc => workbook.shared_strings.to_xml, :schema => SML_XSD}
|
188
|
+
end
|
189
|
+
|
146
190
|
workbook.worksheets.each do |sheet|
|
147
191
|
@parts << {:entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships.to_xml, :schema => RELS_XSD}
|
148
192
|
@parts << {:entry => "xl/#{sheet.pn}", :doc => sheet.to_xml, :schema => SML_XSD}
|
@@ -195,6 +239,10 @@ module Axlsx
|
|
195
239
|
end
|
196
240
|
c_types << Axlsx::Default.new(:ContentType => ct, :Extension => ext )
|
197
241
|
end
|
242
|
+
if use_shared_strings
|
243
|
+
c_types << Axlsx::Override.new(:PartName => "/xl/#{SHARED_STRINGS_PN}",
|
244
|
+
:ContentType => SHARED_STRINGS_CT)
|
245
|
+
end
|
198
246
|
c_types
|
199
247
|
end
|
200
248
|
|