axlsx 1.0.18 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -3
- data/README.md +93 -18
- data/examples/example.csv +1000 -0
- data/examples/example.rb +97 -5
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/lib/axlsx.rb +30 -9
- data/lib/axlsx/content_type/content_type.rb +9 -9
- data/lib/axlsx/content_type/default.rb +9 -6
- data/lib/axlsx/content_type/override.rb +12 -8
- data/lib/axlsx/doc_props/app.rb +37 -40
- data/lib/axlsx/doc_props/core.rb +12 -17
- data/lib/axlsx/drawing/axis.rb +38 -19
- data/lib/axlsx/drawing/bar_3D_chart.rb +33 -32
- data/lib/axlsx/drawing/bar_series.rb +13 -14
- data/lib/axlsx/drawing/cat_axis.rb +15 -14
- data/lib/axlsx/drawing/cat_axis_data.rb +16 -18
- data/lib/axlsx/drawing/chart.rb +37 -38
- data/lib/axlsx/drawing/drawing.rb +15 -12
- data/lib/axlsx/drawing/graphic_frame.rb +21 -21
- data/lib/axlsx/drawing/hyperlink.rb +12 -11
- data/lib/axlsx/drawing/line_3D_chart.rb +30 -28
- data/lib/axlsx/drawing/line_series.rb +11 -11
- data/lib/axlsx/drawing/marker.rb +10 -8
- data/lib/axlsx/drawing/named_axis_data.rb +36 -0
- data/lib/axlsx/drawing/one_cell_anchor.rb +17 -16
- data/lib/axlsx/drawing/pic.rb +24 -37
- data/lib/axlsx/drawing/picture_locking.rb +21 -18
- data/lib/axlsx/drawing/pie_3D_chart.rb +10 -8
- data/lib/axlsx/drawing/pie_series.rb +15 -12
- data/lib/axlsx/drawing/scaling.rb +10 -10
- data/lib/axlsx/drawing/scatter_chart.rb +69 -0
- data/lib/axlsx/drawing/scatter_series.rb +39 -0
- data/lib/axlsx/drawing/ser_axis.rb +10 -10
- data/lib/axlsx/drawing/series.rb +15 -15
- data/lib/axlsx/drawing/series_title.rb +14 -14
- data/lib/axlsx/drawing/title.rb +26 -26
- data/lib/axlsx/drawing/two_cell_anchor.rb +18 -20
- data/lib/axlsx/drawing/val_axis.rb +8 -7
- data/lib/axlsx/drawing/val_axis_data.rb +17 -17
- data/lib/axlsx/drawing/view_3D.rb +22 -20
- data/lib/axlsx/package.rb +32 -15
- data/lib/axlsx/rels/relationship.rb +9 -6
- data/lib/axlsx/rels/relationships.rb +7 -1
- data/lib/axlsx/stylesheet/#num_fmt.rb# +69 -0
- data/lib/axlsx/stylesheet/border.rb +27 -23
- data/lib/axlsx/stylesheet/border_pr.rb +16 -15
- data/lib/axlsx/stylesheet/cell_alignment.rb +23 -21
- data/lib/axlsx/stylesheet/cell_protection.rb +10 -7
- data/lib/axlsx/stylesheet/cell_style.rb +8 -5
- data/lib/axlsx/stylesheet/color.rb +20 -14
- data/lib/axlsx/stylesheet/fill.rb +7 -5
- data/lib/axlsx/stylesheet/font.rb +14 -14
- data/lib/axlsx/stylesheet/gradient_fill.rb +19 -16
- data/lib/axlsx/stylesheet/gradient_stop.rb +9 -5
- data/lib/axlsx/stylesheet/num_fmt.rb +12 -6
- data/lib/axlsx/stylesheet/pattern_fill.rb +25 -10
- data/lib/axlsx/stylesheet/styles.rb +41 -32
- data/lib/axlsx/stylesheet/table_style.rb +9 -4
- data/lib/axlsx/stylesheet/table_style_element.rb +10 -7
- data/lib/axlsx/stylesheet/table_styles.rb +11 -8
- data/lib/axlsx/stylesheet/xf.rb +29 -25
- data/lib/axlsx/util/constants.rb +4 -0
- data/lib/axlsx/util/simple_typed_list.rb +18 -9
- data/lib/axlsx/util/validators.rb +13 -6
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +19 -21
- data/lib/axlsx/workbook/workbook.rb +43 -19
- data/lib/axlsx/workbook/worksheet/cell.rb +93 -91
- data/lib/axlsx/workbook/worksheet/col.rb +114 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/page_margins.rb +16 -13
- data/lib/axlsx/workbook/worksheet/row.rb +13 -13
- data/lib/axlsx/workbook/worksheet/table.rb +96 -0
- data/lib/axlsx/workbook/worksheet/table.rb~ +97 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +152 -118
- data/lib/schema/dc.xsd +5 -5
- data/lib/schema/dcmitype.xsd +5 -3
- data/lib/schema/dcterms.xsd +15 -15
- data/lib/schema/opc-coreProperties.xsd +6 -2
- data/lib/schema/xml.xsd +7 -8
- data/test/#benchmark.txt# +7 -0
- data/test/#tc_helper.rb# +3 -0
- data/test/benchmark.rb +81 -0
- data/test/benchmark.rb~ +0 -0
- data/test/benchmark.txt +6 -0
- data/test/benchmark.txt~ +6 -0
- data/test/content_type/tc_content_type.rb +30 -32
- data/test/content_type/tc_default.rb +8 -23
- data/test/content_type/tc_override.rb +7 -21
- data/test/doc_props/tc_app.rb +2 -8
- data/test/doc_props/tc_core.rb +6 -7
- data/test/drawing/tc_axis.rb +7 -3
- data/test/drawing/tc_bar_3D_chart.rb +6 -7
- data/test/drawing/tc_bar_series.rb +4 -5
- data/test/drawing/tc_cat_axis.rb +2 -3
- data/test/drawing/tc_cat_axis_data.rb +2 -3
- data/test/drawing/tc_chart.rb +11 -12
- data/test/drawing/tc_drawing.rb +7 -8
- data/test/drawing/tc_graphic_frame.rb +3 -4
- data/test/drawing/tc_hyperlink.rb +2 -3
- data/test/drawing/tc_line_3d_chart.rb +5 -6
- data/test/drawing/tc_line_series.rb +3 -4
- data/test/drawing/tc_marker.rb +3 -4
- data/test/drawing/tc_one_cell_anchor.rb +6 -7
- data/test/drawing/tc_pic.rb +8 -9
- data/test/drawing/tc_picture_locking.rb +2 -3
- data/test/drawing/tc_pie_3D_chart.rb +5 -6
- data/test/drawing/tc_pie_series.rb +4 -5
- data/test/drawing/tc_scaling.rb +3 -4
- data/test/drawing/tc_scatter_chart.rb +43 -0
- data/test/drawing/tc_scatter_series.rb +20 -0
- data/test/drawing/tc_ser_axis.rb +2 -3
- data/test/drawing/tc_series.rb +4 -5
- data/test/drawing/tc_series_title.rb +4 -5
- data/test/drawing/tc_title.rb +4 -5
- data/test/drawing/tc_two_cell_anchor.rb +4 -5
- data/test/drawing/tc_val_axis.rb +2 -3
- data/test/drawing/tc_val_axis_data.rb +2 -3
- data/test/drawing/tc_view_3D.rb +6 -7
- data/test/example.csv +1000 -0
- data/test/example.xlsx +0 -0
- data/test/example_streamed.xlsx +0 -0
- data/test/profile.rb +33 -0
- data/test/rels/tc_relationship.rb +5 -6
- data/test/rels/tc_relationships.rb +4 -5
- data/test/stylesheet/tc_border.rb +3 -4
- data/test/stylesheet/tc_border_pr.rb +3 -4
- data/test/stylesheet/tc_cell_alignment.rb +4 -5
- data/test/stylesheet/tc_cell_protection.rb +2 -3
- data/test/stylesheet/tc_cell_style.rb +2 -3
- data/test/stylesheet/tc_color.rb +2 -3
- data/test/stylesheet/tc_fill.rb +1 -2
- data/test/stylesheet/tc_font.rb +5 -6
- data/test/stylesheet/tc_gradient_fill.rb +1 -2
- data/test/stylesheet/tc_gradient_stop.rb +1 -2
- data/test/stylesheet/tc_num_fmt.rb +1 -2
- data/test/stylesheet/tc_pattern_fill.rb +3 -4
- data/test/stylesheet/tc_styles.rb +15 -9
- data/test/stylesheet/tc_table_style.rb +2 -3
- data/test/stylesheet/tc_table_style_element.rb +2 -3
- data/test/stylesheet/tc_table_styles.rb +3 -4
- data/test/stylesheet/tc_xf.rb +16 -17
- data/test/tc_axlsx.rb +39 -0
- data/test/tc_axlsx.rb~ +0 -0
- data/test/tc_helper.rb +3 -0
- data/test/tc_helper.rb~ +3 -0
- data/test/tc_package.rb +13 -10
- data/test/util/tc_simple_typed_list.rb +8 -9
- data/test/util/tc_validators.rb +7 -8
- data/test/workbook/tc_shared_strings_table.rb +5 -6
- data/test/workbook/tc_workbook.rb +24 -6
- data/test/workbook/worksheet/table/tc_table.rb +71 -0
- data/test/workbook/worksheet/table/tc_table.rb~ +72 -0
- data/test/workbook/worksheet/tc_cell.rb +24 -10
- data/test/workbook/worksheet/tc_col.rb +59 -0
- data/test/workbook/worksheet/tc_col.rb~ +10 -0
- data/test/workbook/worksheet/tc_date_time_converter.rb +1 -2
- data/test/workbook/worksheet/tc_page_margins.rb +6 -9
- data/test/workbook/worksheet/tc_row.rb +26 -12
- data/test/workbook/worksheet/tc_worksheet.rb +134 -68
- metadata +150 -90
- data/test/drawing/tc_hyperlink.rb~ +0 -71
- data/test/workbook/tc_shared_strings_table.rb~ +0 -8
- data/test/workbook/worksheet/tc_date_time_converter.rb~ +0 -69
data/examples/example.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby -w -s
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
+
require 'axlsx'
|
4
5
|
|
5
6
|
p = Axlsx::Package.new
|
6
7
|
wb = p.workbook
|
@@ -23,6 +24,19 @@ wb.styles do |s|
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
27
|
+
#Using Custom Border Styles
|
28
|
+
|
29
|
+
wb.styles do |s|
|
30
|
+
red_border = s.add_style :border => {:style=>:thin, :color =>"FFFF0000"}
|
31
|
+
blue_border = s.add_style :border => {:style=>:thin, :color =>"FF0000FF"}
|
32
|
+
|
33
|
+
wb.add_worksheet(:name => "Custom Borders") do |sheet|
|
34
|
+
sheet.add_row ["wrap", "me", "Up in Red"], :style => red_border
|
35
|
+
sheet.add_row [1, 2, 3], :style => blue_border
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
26
40
|
##Using Custom Formatting and date1904
|
27
41
|
require 'date'
|
28
42
|
wb.styles do |s|
|
@@ -36,10 +50,11 @@ wb.styles do |s|
|
|
36
50
|
end
|
37
51
|
end
|
38
52
|
|
53
|
+
|
39
54
|
##Add an Image
|
40
55
|
|
41
56
|
wb.add_worksheet(:name => "Images") do |sheet|
|
42
|
-
img = File.expand_path('
|
57
|
+
img = File.expand_path('../image1.jpeg', __FILE__)
|
43
58
|
sheet.add_image(:image_src => img, :noSelect => true, :noMove => true) do |image|
|
44
59
|
image.width=720
|
45
60
|
image.height=666
|
@@ -50,7 +65,7 @@ end
|
|
50
65
|
##Add an Image with a hyperlink
|
51
66
|
|
52
67
|
wb.add_worksheet(:name => "Image with Hyperlink") do |sheet|
|
53
|
-
img = File.expand_path('
|
68
|
+
img = File.expand_path('../image1.jpeg', __FILE__)
|
54
69
|
sheet.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image|
|
55
70
|
image.width=720
|
56
71
|
image.height=666
|
@@ -80,6 +95,20 @@ wb.styles do |s|
|
|
80
95
|
end
|
81
96
|
end
|
82
97
|
|
98
|
+
##Hiding Columns
|
99
|
+
|
100
|
+
wb.styles do |s|
|
101
|
+
percent = s.add_style :num_fmt => 9
|
102
|
+
wb.add_worksheet(:name => "Hidden Column") do |sheet|
|
103
|
+
sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4']
|
104
|
+
sheet.add_row [1, 2, 0.3, 4]
|
105
|
+
sheet.add_row [1, 2, 0.2, 4]
|
106
|
+
sheet.add_row [1, 2, 0.1, 4]
|
107
|
+
sheet.col_style 2, percent, :row_offset => 1
|
108
|
+
sheet.column_info[1].hidden = true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
83
112
|
##Styling Rows
|
84
113
|
|
85
114
|
wb.styles do |s|
|
@@ -144,6 +173,18 @@ wb.add_worksheet(:name => "Bar Chart") do |sheet|
|
|
144
173
|
end
|
145
174
|
end
|
146
175
|
|
176
|
+
##Hide Gridlines in chart
|
177
|
+
wb.add_worksheet(:name => "Chart With No Gridlines") do |sheet|
|
178
|
+
sheet.add_row ["A Simple Bar Chart"]
|
179
|
+
sheet.add_row ["First", "Second", "Third"]
|
180
|
+
sheet.add_row [1, 2, 3]
|
181
|
+
sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A4", :end_at => "F17") do |chart|
|
182
|
+
chart.add_series :data => sheet["A3:C3"], :labels => sheet["A2:C2"], :title => sheet["A1"]
|
183
|
+
chart.valAxis.gridlines = false
|
184
|
+
chart.catAxis.gridlines = false
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
147
188
|
##Generating A Pie Chart
|
148
189
|
|
149
190
|
wb.add_worksheet(:name => "Pie Chart") do |sheet|
|
@@ -183,6 +224,21 @@ wb.add_worksheet(:name => "Line Chart") do |sheet|
|
|
183
224
|
end
|
184
225
|
end
|
185
226
|
|
227
|
+
##Generating A Scatter Chart
|
228
|
+
|
229
|
+
wb.add_worksheet(:name => "Scatter Chart") do |sheet|
|
230
|
+
sheet.add_row ["First", 1, 5, 7, 9]
|
231
|
+
sheet.add_row ["", 1, 25, 49, 81]
|
232
|
+
sheet.add_row ["Second", 5, 2, 14, 9]
|
233
|
+
sheet.add_row ["", 5, 10, 15, 20]
|
234
|
+
sheet.add_chart(Axlsx::ScatterChart, :title => "example 7: Scatter Chart") do |chart|
|
235
|
+
chart.start_at 0, 4
|
236
|
+
chart.end_at 10, 19
|
237
|
+
chart.add_series :xData => sheet["B1:E1"], :yData => sheet["B2:E2"], :title => sheet["A1"]
|
238
|
+
chart.add_series :xData => sheet["B3:E3"], :yData => sheet["B4:E4"], :title => sheet["A3"]
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
186
242
|
##Auto Filter
|
187
243
|
|
188
244
|
wb.add_worksheet(:name => "Auto Filter") do |sheet|
|
@@ -194,11 +250,38 @@ wb.add_worksheet(:name => "Auto Filter") do |sheet|
|
|
194
250
|
sheet.auto_filter = "A2:D5"
|
195
251
|
end
|
196
252
|
|
253
|
+
##Tables
|
254
|
+
|
255
|
+
wb.add_worksheet(:name => "Table") do |sheet|
|
256
|
+
sheet.add_row ["Build Matrix"]
|
257
|
+
sheet.add_row ["Build", "Duration", "Finished", "Rvm"]
|
258
|
+
sheet.add_row ["19.1", "1 min 32 sec", "about 10 hours ago", "1.8.7"]
|
259
|
+
sheet.add_row ["19.2", "1 min 28 sec", "about 10 hours ago", "1.9.2"]
|
260
|
+
sheet.add_row ["19.3", "1 min 35 sec", "about 10 hours ago", "1.9.3"]
|
261
|
+
sheet.add_table "A2:D5", :name => 'Build Matrix'
|
262
|
+
end
|
263
|
+
|
264
|
+
|
197
265
|
##Specifying Column Widths
|
198
266
|
|
199
267
|
wb.add_worksheet(:name => "custom column widths") do |sheet|
|
200
268
|
sheet.add_row ["I use autowidth and am very wide", "I use a custom width and am narrow"]
|
201
|
-
sheet.
|
269
|
+
sheet.add_row ['abcdefg', 'This is a very long text and should flow into the right cell', nil, 'xxx' ]
|
270
|
+
sheet.column_widths nil, 3, 5, nil
|
271
|
+
end
|
272
|
+
|
273
|
+
##Fit to page printing
|
274
|
+
|
275
|
+
wb.add_worksheet(:name => "fit to page") do |sheet|
|
276
|
+
sheet.add_row ['this all goes on one page']
|
277
|
+
sheet.fit_to_page = true
|
278
|
+
end
|
279
|
+
|
280
|
+
|
281
|
+
##Hide Gridlines in worksheet
|
282
|
+
wb.add_worksheet(:name => "No Gridlines") do |sheet|
|
283
|
+
sheet.add_row ["This", "Sheet", "Hides", "Gridlines"]
|
284
|
+
sheet.show_gridlines = false
|
202
285
|
end
|
203
286
|
|
204
287
|
##Specify Page Margins for printing
|
@@ -209,7 +292,7 @@ end
|
|
209
292
|
|
210
293
|
##Validate and Serialize
|
211
294
|
|
212
|
-
p.validate.each { |e| puts e.message }
|
295
|
+
#p.validate.each { |e| puts e.message }
|
213
296
|
p.serialize("example.xlsx")
|
214
297
|
|
215
298
|
s = p.to_stream()
|
@@ -221,6 +304,15 @@ p.use_shared_strings = true
|
|
221
304
|
p.serialize("shared_strings_example.xlsx")
|
222
305
|
|
223
306
|
|
307
|
+
##Disabling Autowidth
|
308
|
+
p = Axlsx::Package.new
|
309
|
+
p.use_autowidth = false
|
310
|
+
wb = p.workbook
|
311
|
+
wb.add_worksheet(:name => "No Magick") do | sheet |
|
312
|
+
sheet.add_row ['oh look! no autowidth - and no magick loaded in your process']
|
313
|
+
end
|
314
|
+
p.validate.each { |e| puts e.message }
|
315
|
+
p.serialize("no-use_autowidth.xlsx")
|
224
316
|
|
225
317
|
|
226
318
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/axlsx.rb
CHANGED
@@ -5,6 +5,9 @@ require 'axlsx/util/simple_typed_list.rb'
|
|
5
5
|
require 'axlsx/util/constants.rb'
|
6
6
|
require 'axlsx/util/validators.rb'
|
7
7
|
require 'axlsx/util/storage.rb'
|
8
|
+
|
9
|
+
#not even close to being ready but it does not break anything so it stays for now.
|
10
|
+
# needs a full re-write to use agile-encryption properly
|
8
11
|
require 'axlsx/util/cbf.rb'
|
9
12
|
require 'axlsx/util/ms_off_crypto.rb'
|
10
13
|
|
@@ -22,10 +25,8 @@ require 'axlsx/rels/relationships.rb'
|
|
22
25
|
require 'axlsx/drawing/drawing.rb'
|
23
26
|
require 'axlsx/workbook/workbook.rb'
|
24
27
|
require 'axlsx/package.rb'
|
25
|
-
|
26
28
|
#required gems
|
27
29
|
require 'nokogiri'
|
28
|
-
require 'RMagick'
|
29
30
|
require 'zip/zip'
|
30
31
|
|
31
32
|
#core dependencies
|
@@ -33,8 +34,8 @@ require 'bigdecimal'
|
|
33
34
|
require 'time'
|
34
35
|
|
35
36
|
#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.
|
37
|
+
# I am a very big fan of activesupports instance_values method, but do not want to require nor include the entire
|
38
|
+
# library just for this one method.
|
38
39
|
if !Object.respond_to?(:instance_values)
|
39
40
|
Object.send :public # patch for 1.8.7 as it uses private scope
|
40
41
|
Object.send :define_method, :instance_values do
|
@@ -42,12 +43,11 @@ if !Object.respond_to?(:instance_values)
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
|
46
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.
|
47
47
|
module Axlsx
|
48
48
|
# determines the cell range for the items provided
|
49
49
|
def self.cell_range(items)
|
50
|
-
return "" unless items.first.is_a? Cell
|
50
|
+
return "" unless items.first.is_a? Cell
|
51
51
|
ref = "'#{items.first.row.worksheet.name}'!" +
|
52
52
|
"#{items.first.r_abs}"
|
53
53
|
ref += ":#{items.last.r_abs}" if items.size > 1
|
@@ -56,11 +56,32 @@ module Axlsx
|
|
56
56
|
|
57
57
|
def self.name_to_indices(name)
|
58
58
|
raise ArgumentError, 'invalid cell name' unless name.size > 1
|
59
|
-
v = name[/[A-Z]+/].reverse.chars.reduce({:base=>1, :i=>0}) do |val, c|
|
60
|
-
val[:i] += ((c.bytes.first -
|
59
|
+
v = name[/[A-Z]+/].reverse.chars.reduce({:base=>1, :i=>0}) do |val, c|
|
60
|
+
val[:i] += ((c.bytes.first - 64) * val[:base]); val[:base] *= 26; val
|
61
61
|
end
|
62
62
|
|
63
|
-
[v[:i]-1, ((name[/[1-9]
|
63
|
+
[v[:i]-1, ((name[/[1-9][0-9]*/]).to_i)-1]
|
64
64
|
|
65
65
|
end
|
66
|
+
|
67
|
+
# converts the column index into alphabetical values.
|
68
|
+
# @note This follows the standard spreadsheet convention of naming columns A to Z, followed by AA to AZ etc.
|
69
|
+
# @return [String]
|
70
|
+
def self.col_ref(index)
|
71
|
+
chars = []
|
72
|
+
while index >= 26 do
|
73
|
+
chars << ((index % 26) + 65).chr
|
74
|
+
index = index / 26 - 1
|
75
|
+
end
|
76
|
+
chars << (index + 65).chr
|
77
|
+
chars.reverse.join
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [String] The alpha(column)numeric(row) reference for this sell.
|
81
|
+
# @example Relative Cell Reference
|
82
|
+
# ws.rows.first.cells.first.r #=> "A1"
|
83
|
+
def self.cell_r(c_index, r_index)
|
84
|
+
Axlsx::col_ref(c_index).to_s << (r_index+1).to_s
|
85
|
+
end
|
86
|
+
|
66
87
|
end
|
@@ -10,15 +10,15 @@ module Axlsx
|
|
10
10
|
super [Override, Default]
|
11
11
|
end
|
12
12
|
|
13
|
-
#
|
14
|
-
# @
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
builder.to_xml(:save_with => 0)
|
13
|
+
# Serializes the object
|
14
|
+
# @param [String] str
|
15
|
+
# @return [String]
|
16
|
+
def to_xml_string(str = '')
|
17
|
+
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
18
|
+
str << '<Types xmlns="' << XML_NS_T << '">'
|
19
|
+
each { |type| type.to_xml_string(str) }
|
20
|
+
str << '</Types>'
|
22
21
|
end
|
22
|
+
|
23
23
|
end
|
24
24
|
end
|
@@ -8,7 +8,7 @@ module Axlsx
|
|
8
8
|
attr_reader :Extension
|
9
9
|
|
10
10
|
# The type of content.
|
11
|
-
# @return [String]
|
11
|
+
# @return [String]
|
12
12
|
attr_reader :ContentType
|
13
13
|
|
14
14
|
#Creates a new Default object
|
@@ -19,7 +19,7 @@ module Axlsx
|
|
19
19
|
raise ArgumentError, "Extension and ContentType are required" unless options[:Extension] && options[:ContentType]
|
20
20
|
options.each do |o|
|
21
21
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
22
|
-
end
|
22
|
+
end
|
23
23
|
end
|
24
24
|
# Sets the file extension for this content type.
|
25
25
|
def Extension=(v) Axlsx::validate_string v; @Extension = v end
|
@@ -28,11 +28,14 @@ module Axlsx
|
|
28
28
|
# @see Axlsx#validate_content_type
|
29
29
|
def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
|
30
30
|
|
31
|
-
# Serializes the object
|
32
|
-
# @param [
|
31
|
+
# Serializes the object
|
32
|
+
# @param [String] str
|
33
33
|
# @return [String]
|
34
|
-
def
|
35
|
-
|
34
|
+
def to_xml_string(str = '')
|
35
|
+
str << '<Default '
|
36
|
+
str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
37
|
+
str << '/>'
|
36
38
|
end
|
39
|
+
|
37
40
|
end
|
38
41
|
end
|
@@ -4,11 +4,11 @@ module Axlsx
|
|
4
4
|
class Override
|
5
5
|
|
6
6
|
# The type of content.
|
7
|
-
# @return [String]
|
7
|
+
# @return [String]
|
8
8
|
attr_reader :ContentType
|
9
9
|
|
10
10
|
# The name and location of the part.
|
11
|
-
# @return [String]
|
11
|
+
# @return [String]
|
12
12
|
attr_reader :PartName
|
13
13
|
|
14
14
|
#Creates a new Override object
|
@@ -19,20 +19,24 @@ module Axlsx
|
|
19
19
|
raise ArgumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
|
20
20
|
options.each do |o|
|
21
21
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
22
|
-
end
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
# The name and location of the part.
|
26
26
|
def PartName=(v) Axlsx::validate_string v; @PartName = v end
|
27
27
|
|
28
|
-
# The content type.
|
28
|
+
# The content type.
|
29
29
|
# @see Axlsx#validate_content_type
|
30
30
|
def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
|
31
31
|
|
32
|
-
# Serializes the
|
33
|
-
# @param [
|
34
|
-
|
35
|
-
|
32
|
+
# Serializes the object
|
33
|
+
# @param [String] str
|
34
|
+
# @return [String]
|
35
|
+
def to_xml_string(str = '')
|
36
|
+
str << '<Override '
|
37
|
+
str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
38
|
+
str << '/>'
|
36
39
|
end
|
40
|
+
|
37
41
|
end
|
38
42
|
end
|
data/lib/axlsx/doc_props/app.rb
CHANGED
@@ -17,7 +17,7 @@ module Axlsx
|
|
17
17
|
attr_reader :Manager
|
18
18
|
|
19
19
|
# @return [String] The name of the company generating the document.
|
20
|
-
attr_reader :Company
|
20
|
+
attr_reader :Company
|
21
21
|
|
22
22
|
# @return [Integer] The number of pages in the document.
|
23
23
|
attr_reader :Pages
|
@@ -43,7 +43,7 @@ module Axlsx
|
|
43
43
|
# @return [Integer] The number of slides that have notes.
|
44
44
|
attr_reader :Notes
|
45
45
|
|
46
|
-
# @return [Integer] The total amount of time spent editing.
|
46
|
+
# @return [Integer] The total amount of time spent editing.
|
47
47
|
attr_reader :TotalTime
|
48
48
|
|
49
49
|
# @return [Integer] The number of hidden slides.
|
@@ -60,11 +60,11 @@ module Axlsx
|
|
60
60
|
|
61
61
|
# @return [Integer] The number of characters in the document including spaces.
|
62
62
|
attr_reader :CharactersWithSpaces
|
63
|
-
|
63
|
+
|
64
64
|
# @return [Boolean] Indicates if the document is shared.
|
65
65
|
attr_reader :ShareDoc
|
66
66
|
|
67
|
-
# @return [String] The base for hyper links in the document.
|
67
|
+
# @return [String] The base for hyper links in the document.
|
68
68
|
attr_reader :HyperLinkBase
|
69
69
|
|
70
70
|
# @return [Boolean] Indicates that the hyper links in the document have been changed.
|
@@ -96,7 +96,7 @@ module Axlsx
|
|
96
96
|
# @option options [Boolean] ScaleCrop
|
97
97
|
# @option options [Boolean] LinksUpToDate
|
98
98
|
# @option options [Integer] CharactersWithSpaces
|
99
|
-
# @option options [Boolean] ShareDoc
|
99
|
+
# @option options [Boolean] ShareDoc
|
100
100
|
# @option options [String] HyperLinkBase
|
101
101
|
# @option options [String] HyperlinksChanged
|
102
102
|
# @option options [String] Application
|
@@ -109,70 +109,67 @@ module Axlsx
|
|
109
109
|
end
|
110
110
|
|
111
111
|
# Sets the Template property of your app.xml file
|
112
|
-
def Template=(v) Axlsx::validate_string v; @Template = v; end
|
112
|
+
def Template=(v) Axlsx::validate_string v; @Template = v; end
|
113
113
|
|
114
114
|
# Sets the Manager property of your app.xml file
|
115
|
-
def Manager=(v) Axlsx::validate_string v; @Manager = v; end
|
115
|
+
def Manager=(v) Axlsx::validate_string v; @Manager = v; end
|
116
116
|
|
117
117
|
# Sets the Company property of your app.xml file
|
118
|
-
def Company=(v) Axlsx::validate_string v; @Company = v; end
|
118
|
+
def Company=(v) Axlsx::validate_string v; @Company = v; end
|
119
119
|
|
120
120
|
# Sets the Pages property of your app.xml file
|
121
|
-
def Pages=(v) Axlsx::validate_int v; @Pages = v; end
|
121
|
+
def Pages=(v) Axlsx::validate_int v; @Pages = v; end
|
122
122
|
|
123
123
|
# Sets the Words property of your app.xml file
|
124
|
-
def Words=(v) Axlsx::validate_int v; @Words = v; end
|
124
|
+
def Words=(v) Axlsx::validate_int v; @Words = v; end
|
125
125
|
|
126
126
|
# Sets the Characters property of your app.xml file
|
127
|
-
def Characters=(v) Axlsx::validate_int v; @Characters = v; end
|
127
|
+
def Characters=(v) Axlsx::validate_int v; @Characters = v; end
|
128
128
|
|
129
129
|
|
130
130
|
# Sets the PresentationFormat property of your app.xml file
|
131
|
-
def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end
|
131
|
+
def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end
|
132
132
|
# Sets the Lines property of your app.xml file
|
133
|
-
def Lines=(v) Axlsx::validate_int v; @Lines = v; end
|
133
|
+
def Lines=(v) Axlsx::validate_int v; @Lines = v; end
|
134
134
|
# Sets the Paragraphs property of your app.xml file
|
135
|
-
def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end
|
135
|
+
def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end
|
136
136
|
# Sets the Slides property of your app.xml file
|
137
|
-
def Slides=(v) Axlsx::validate_int v; @Slides = v; end
|
137
|
+
def Slides=(v) Axlsx::validate_int v; @Slides = v; end
|
138
138
|
# Sets the Notes property of your app.xml file
|
139
|
-
def Notes=(v) Axlsx::validate_int v; @Notes = v; end
|
139
|
+
def Notes=(v) Axlsx::validate_int v; @Notes = v; end
|
140
140
|
# Sets the TotalTime property of your app.xml file
|
141
|
-
def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end
|
141
|
+
def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end
|
142
142
|
# Sets the HiddenSlides property of your app.xml file
|
143
|
-
def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end
|
143
|
+
def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end
|
144
144
|
# Sets the MMClips property of your app.xml file
|
145
|
-
def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end
|
145
|
+
def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end
|
146
146
|
# Sets the ScaleCrop property of your app.xml file
|
147
|
-
def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end
|
147
|
+
def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end
|
148
148
|
# Sets the LinksUpToDate property of your app.xml file
|
149
|
-
def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end
|
149
|
+
def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end
|
150
150
|
# Sets the CharactersWithSpaces property of your app.xml file
|
151
|
-
def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end
|
151
|
+
def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end
|
152
152
|
# Sets the ShareDoc property of your app.xml file
|
153
|
-
def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end
|
153
|
+
def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end
|
154
154
|
# Sets the HyperLinkBase property of your app.xml file
|
155
|
-
def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end
|
155
|
+
def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end
|
156
156
|
# Sets the HyperLinksChanged property of your app.xml file
|
157
|
-
def HyperlinksChanged=(v) Axlsx::validate_boolean v; @HyperlinksChanged = v; end
|
157
|
+
def HyperlinksChanged=(v) Axlsx::validate_boolean v; @HyperlinksChanged = v; end
|
158
158
|
# Sets the Application property of your app.xml file
|
159
|
-
def Application=(v) Axlsx::validate_string v; @Application = v; end
|
159
|
+
def Application=(v) Axlsx::validate_string v; @Application = v; end
|
160
160
|
# Sets the AppVersion property of your app.xml file
|
161
|
-
def AppVersion=(v) Axlsx::validate_string v; @AppVersion = v; end
|
161
|
+
def AppVersion=(v) Axlsx::validate_string v; @AppVersion = v; end
|
162
162
|
# Sets the DocSecurity property of your app.xml file
|
163
|
-
def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end
|
164
|
-
|
165
|
-
#
|
166
|
-
# @return [String]
|
167
|
-
def
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
end
|
173
|
-
}
|
174
|
-
end
|
175
|
-
builder.to_xml(:save_with => 0)
|
163
|
+
def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end
|
164
|
+
|
165
|
+
# Serialize the app.xml document
|
166
|
+
# @return [String]
|
167
|
+
def to_xml_string(str = '')
|
168
|
+
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
169
|
+
str << '<Properties xmlns="' << APP_NS << '" xmlns:vt="' << APP_NS_VT << '">'
|
170
|
+
str << instance_values.map { |key, value| '<' << key.to_s << '>' << value.to_s << '</' << key.to_s << '>' }.join
|
171
|
+
str << '</Properties>'
|
176
172
|
end
|
173
|
+
|
177
174
|
end
|
178
175
|
end
|