axlsx 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -7
- data/Rakefile +2 -1
- data/examples/chart_colors.xlsx +0 -0
- data/examples/data_validation.rb +50 -0
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/examples_saved.xlsx +0 -0
- data/examples/fish.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/pareto.rb +28 -0
- data/examples/pareto.xlsx +0 -0
- data/examples/pie_chart.rb +16 -0
- data/examples/pie_chart.xlsx +0 -0
- data/examples/pie_chart_saved.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/sheet_protection.rb +10 -0
- data/examples/sheet_protection.xlsx +0 -0
- data/examples/two_cell_anchor_image.rb +11 -0
- data/examples/two_cell_anchor_image.xlsx +0 -0
- data/examples/~$pie_chart_saved.xlsx +0 -0
- data/lib/axlsx.rb +7 -0
- data/lib/axlsx/content_type/default.rb +15 -9
- data/lib/axlsx/content_type/override.rb +10 -6
- data/lib/axlsx/doc_props/app.rb +152 -99
- data/lib/axlsx/drawing/axis.rb +30 -23
- data/lib/axlsx/drawing/bar_series.rb +1 -1
- data/lib/axlsx/drawing/drawing.rb +7 -2
- data/lib/axlsx/drawing/pic.rb +44 -4
- data/lib/axlsx/drawing/two_cell_anchor.rb +6 -1
- data/lib/axlsx/drawing/vml_shape.rb +2 -5
- data/lib/axlsx/rels/relationships.rb +1 -1
- data/lib/axlsx/stylesheet/table_style.rb +3 -3
- data/lib/axlsx/util/simple_typed_list.rb +0 -13
- data/lib/axlsx/util/validators.rb +21 -0
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +2 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +3 -4
- data/lib/axlsx/workbook/worksheet/comment.rb +3 -9
- data/lib/axlsx/workbook/worksheet/data_validation.rb +245 -0
- data/lib/axlsx/workbook/worksheet/page_setup.rb +17 -3
- data/lib/axlsx/workbook/worksheet/row.rb +34 -18
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +224 -0
- data/lib/axlsx/workbook/worksheet/table.rb +2 -2
- data/lib/axlsx/workbook/worksheet/worksheet.rb +57 -22
- data/test/doc_props/tc_app.rb +31 -1
- data/test/drawing/tc_axis.rb +12 -2
- data/test/drawing/tc_chart.rb +21 -3
- data/test/drawing/tc_drawing.rb +6 -1
- data/test/drawing/tc_hyperlink.rb +0 -5
- data/test/drawing/tc_pic.rb +22 -2
- data/test/drawing/tc_scatter_chart.rb +6 -1
- data/test/drawing/tc_two_cell_anchor.rb +1 -2
- data/test/stylesheet/tc_styles.rb +3 -4
- data/test/stylesheet/tc_table_style.rb +8 -0
- data/test/stylesheet/tc_table_style_element.rb +10 -1
- data/test/tc_package.rb +43 -15
- data/test/util/tc_simple_typed_list.rb +13 -0
- data/test/util/tc_validators.rb +7 -7
- data/test/workbook/worksheet/table/tc_table.rb +3 -3
- data/test/workbook/worksheet/tc_cell.rb +15 -6
- data/test/workbook/worksheet/tc_col.rb +9 -0
- data/test/workbook/worksheet/tc_comment.rb +8 -7
- data/test/workbook/worksheet/tc_comments.rb +8 -1
- data/test/workbook/worksheet/tc_conditional_formatting.rb +44 -0
- data/test/workbook/worksheet/tc_data_bar.rb +1 -1
- data/test/workbook/worksheet/tc_data_validation.rb +265 -0
- data/test/workbook/worksheet/tc_page_setup.rb +22 -4
- data/test/workbook/worksheet/tc_row.rb +14 -2
- data/test/workbook/worksheet/tc_sheet_protection.rb +117 -0
- data/test/workbook/worksheet/tc_worksheet.rb +29 -4
- metadata +31 -10
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
16
16
|
|
17
17
|
**License**: MIT License
|
18
18
|
|
19
|
-
**Latest Version**: 1.1.
|
19
|
+
**Latest Version**: 1.1.6
|
20
20
|
|
21
21
|
**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
|
22
22
|
|
@@ -24,7 +24,7 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
24
24
|
|
25
25
|
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
|
26
26
|
|
27
|
-
**Release Date**: May
|
27
|
+
**Release Date**: May 30th 2012
|
28
28
|
|
29
29
|
If you are working in rails, or with active record see:
|
30
30
|
http://github.com/randym/acts_as_xlsx
|
@@ -32,6 +32,9 @@ http://github.com/randym/acts_as_xlsx
|
|
32
32
|
There are guides for using axlsx and acts_as_xlsx here:
|
33
33
|
[http://axlsx.blogspot.com](http://axlsx.blogspot.com)
|
34
34
|
|
35
|
+
The examples directory contains a number of more specific examples as
|
36
|
+
well.
|
37
|
+
|
35
38
|
Synopsis
|
36
39
|
--------
|
37
40
|
|
@@ -63,7 +66,8 @@ Feature List
|
|
63
66
|
|
64
67
|
**9. Cell level style overrides for default and customized style objects
|
65
68
|
|
66
|
-
**10. Support for formulas
|
69
|
+
**10. Support for formulas, merging, row and column outlining as well as
|
70
|
+
cell level input data validation.
|
67
71
|
|
68
72
|
**11. Support for cell merging as well as column and row outline
|
69
73
|
|
@@ -75,6 +79,8 @@ Feature List
|
|
75
79
|
|
76
80
|
**15. Support for page margins and print options
|
77
81
|
|
82
|
+
**16. Support for password and non password based sheet protection.
|
83
|
+
|
78
84
|
Installing
|
79
85
|
----------
|
80
86
|
|
@@ -86,12 +92,12 @@ To install Axlsx, use the following command:
|
|
86
92
|
------
|
87
93
|
|
88
94
|
The example listing is getting overly large to maintain here.
|
89
|
-
If you are using Yard, you will be able to see the examples
|
95
|
+
If you are using Yard, you will be able to see the examples in line below.
|
90
96
|
If not, please refer to the Please see the {file:examples/example.rb} file.
|
91
97
|
|
92
98
|
{include:file:examples/example.rb}
|
93
99
|
|
94
|
-
There is much, much more you can do with this gem. If you get stuck, grab me on IRC or submit an issue to
|
100
|
+
There is much, much more you can do with this gem. If you get stuck, grab me on IRC or submit an issue to GitHub. Chances are that it has already been implemented. If it hasn't - let's take a look at adding it in.
|
95
101
|
|
96
102
|
#Documentation
|
97
103
|
--------------
|
@@ -107,12 +113,23 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
|
|
107
113
|
|
108
114
|
#Change log
|
109
115
|
---------
|
116
|
+
- ** May.30.12**: 1.1.6 release
|
117
|
+
- data protection with passwords for sheets
|
118
|
+
- cell level input validators
|
119
|
+
- added support for two cell anchors for images
|
120
|
+
- test coverage now back up to 100%
|
121
|
+
- bugfix for merge cell sorting algorithm
|
122
|
+
- added fit_to method for page_setup to simplify managing witdh/height
|
123
|
+
- added ph (phonetics) and s (style) attributes for row.
|
124
|
+
- resolved all warnings generating from this gem.
|
125
|
+
- improved comment relationship management for multiple comments
|
126
|
+
|
110
127
|
- ** May.13.12**: 1.1.5 release
|
111
128
|
- MOAR print options! You can now specify paper size, orientation,
|
112
129
|
fit to width, page margings and gridlines for printing.
|
113
|
-
- Support for adding comments
|
130
|
+
- Support for adding comments to your worksheets
|
114
131
|
- bugfix for applying style to empty cells
|
115
|
-
- bugfix for parsing formula with
|
132
|
+
- bugfix for parsing formula with multiple '='
|
116
133
|
|
117
134
|
- ** May.3.12:**: 1.1.4 release
|
118
135
|
- MOAR examples
|
@@ -159,6 +176,8 @@ Please see the {file:CHANGELOG.md} document for past release information.
|
|
159
176
|
|
160
177
|
[scpike](https://github.com/scpike) - for keeping numbers fixed even when they are rational and a super clean implementation of conditional formatting.
|
161
178
|
|
179
|
+
[janhuehne](https://github.com/janhuehne) - for working out the decoder ring and adding in cell level validation.
|
180
|
+
|
162
181
|
#Copyright and License
|
163
182
|
----------
|
164
183
|
|
data/Rakefile
CHANGED
data/examples/chart_colors.xlsx
CHANGED
Binary file
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby -w -s
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
+
require 'axlsx'
|
5
|
+
|
6
|
+
p = Axlsx::Package.new
|
7
|
+
p.workbook.add_worksheet do |ws|
|
8
|
+
ws.add_data_validation("A10", {
|
9
|
+
:type => :whole,
|
10
|
+
:operator => :between,
|
11
|
+
:formula1 => '5',
|
12
|
+
:formula2 => '10',
|
13
|
+
:showErrorMessage => true,
|
14
|
+
:errorTitle => 'Wrong input',
|
15
|
+
:error => 'Only values between 5 and 10',
|
16
|
+
:errorStyle => :information,
|
17
|
+
:showInputMessage => true,
|
18
|
+
:promptTitle => 'Be carful!',
|
19
|
+
:prompt => 'Only values between 5 and 10'})
|
20
|
+
|
21
|
+
ws.add_data_validation("B10", {
|
22
|
+
:type => :textLength,
|
23
|
+
:operator => :greaterThan,
|
24
|
+
:formula1 => '10',
|
25
|
+
:showErrorMessage => true,
|
26
|
+
:errorTitle => 'Text is too long',
|
27
|
+
:error => 'Max text length is 10 characters',
|
28
|
+
:errorStyle => :stop,
|
29
|
+
:showInputMessage => true,
|
30
|
+
:promptTitle => 'Text length',
|
31
|
+
:prompt => 'Max text length is 10 characters'})
|
32
|
+
|
33
|
+
8.times do |i|
|
34
|
+
ws.add_row [nil, nil, i*2]
|
35
|
+
end
|
36
|
+
|
37
|
+
ws.add_data_validation("C10", {
|
38
|
+
:type => :list,
|
39
|
+
:formula1 => 'C1:C8',
|
40
|
+
:showDropDown => false,
|
41
|
+
:showErrorMessage => true,
|
42
|
+
:errorTitle => '',
|
43
|
+
:error => 'Only values from C1:C8',
|
44
|
+
:errorStyle => :stop,
|
45
|
+
:showInputMessage => true,
|
46
|
+
:promptTitle => '',
|
47
|
+
:prompt => 'Only values from C1:C8'})
|
48
|
+
end
|
49
|
+
|
50
|
+
p.serialize 'data_validation.xlsx'
|
data/examples/example.xlsx
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/examples/fish.xlsx
ADDED
Binary file
|
Binary file
|
data/examples/pareto.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby -w -s
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
+
require 'axlsx'
|
5
|
+
|
6
|
+
p = Axlsx::Package.new
|
7
|
+
percent = p.workbook.styles.add_style :format_code => "#0.00"
|
8
|
+
|
9
|
+
p.workbook.add_worksheet(:name => 'Pareto') do |ws|
|
10
|
+
ws.add_row ['Pareto Chart Example']
|
11
|
+
ws.add_row ['Print Failure Analysis']
|
12
|
+
ws.add_row ['Problem', 'Count', 'Percent Of Total', 'Cum. Percent']
|
13
|
+
ws.add_row ['Out of Paper', '32', '=B4/sum(B4:B7)*100', '=C4'], :style => [nil, nil, percent, percent]
|
14
|
+
ws.add_row ['Out of Toner', '12', '=B5/sum(B4:B7)*100', '=D4+C5'], :style => [nil, nil, percent, percent]
|
15
|
+
ws.add_row ['Paper Jam', '72', '=B6/sum(B4:B7)*100', '=D5+C6'], :style => [nil, nil, percent, percent]
|
16
|
+
ws.add_row ['Firmware failure', '77', '=B7/sum(B4:B7)*100', '=D6+C7'], :style => [nil, nil, percent, percent]
|
17
|
+
|
18
|
+
ws.add_chart(Axlsx::Bar3DChart, :grouping => :clustered, :barDir => :col) do |chart|
|
19
|
+
chart.add_series(:data => ws['B4:B7'], :title => 'count')
|
20
|
+
chart.add_series(:data => ws['C4:C7'], :title => 'PoT')
|
21
|
+
chart.add_series(:data => ws['D4:D7'], :title => 'CP')
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
p.serialize 'pareto.xlsx'
|
26
|
+
|
27
|
+
|
28
|
+
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
2
|
+
require 'axlsx'
|
3
|
+
p = Axlsx::Package.new
|
4
|
+
wb = p.workbook
|
5
|
+
##Generating A Pie Chart
|
6
|
+
#```ruby
|
7
|
+
wb.add_worksheet(:name => "Pie Chart") do |sheet|
|
8
|
+
sheet.add_row ["First", "Second", "Third", "Fourth"]
|
9
|
+
sheet.add_row [1, 2, 3, "=PRODUCT(A2:C2)"]
|
10
|
+
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title => "example 3: Pie Chart") do |chart|
|
11
|
+
chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
p.serialize('pie_chart.xlsx')
|
16
|
+
#
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby -w -s
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
+
require 'axlsx'
|
5
|
+
|
6
|
+
p = Axlsx::Package.new
|
7
|
+
p.workbook.add_worksheet(:name => 'Open Office') { |ws| ws.sheet_protection.password = 'fish' }
|
8
|
+
p.serialize 'sheet_protection.xlsx'
|
9
|
+
|
10
|
+
|
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby -w -s
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
+
require 'axlsx'
|
5
|
+
|
6
|
+
p = Axlsx::Package.new
|
7
|
+
src = "#{File.dirname(__FILE__)}/image1.png"
|
8
|
+
p.workbook.add_worksheet(:name => 'double_anchor') do |ws|
|
9
|
+
ws.add_image(:image_src => src, :start_at => [0,0], :end_at => [2,4])
|
10
|
+
end
|
11
|
+
p.serialize('two_cell_anchor_image.xlsx')
|
Binary file
|
Binary file
|
data/lib/axlsx.rb
CHANGED
@@ -84,4 +84,11 @@ module Axlsx
|
|
84
84
|
Axlsx::col_ref(c_index).to_s << (r_index+1).to_s
|
85
85
|
end
|
86
86
|
|
87
|
+
# performs the increadible feat of changing snake_case to CamelCase
|
88
|
+
# @param [String] s The snake case string to camelize
|
89
|
+
# @return [String]
|
90
|
+
def self.camel(s="")
|
91
|
+
s = s.capitalize.gsub(/_(.)/){ $1.upcase }
|
92
|
+
end
|
93
|
+
|
87
94
|
end
|
@@ -5,35 +5,41 @@ module Axlsx
|
|
5
5
|
|
6
6
|
# The extension of the content type.
|
7
7
|
# @return [String]
|
8
|
-
attr_reader :
|
8
|
+
attr_reader :extension
|
9
|
+
alias :Extension :extension
|
9
10
|
|
10
11
|
# The type of content.
|
11
12
|
# @return [String]
|
12
|
-
attr_reader :
|
13
|
+
attr_reader :content_type
|
14
|
+
alias :ContentType :content_type
|
13
15
|
|
14
16
|
#Creates a new Default object
|
15
|
-
# @option options [String]
|
16
|
-
# @option options [String]
|
17
|
-
# @raise [ArgumentError] An argument error is raised if both
|
17
|
+
# @option options [String] extension
|
18
|
+
# @option options [String] content_type
|
19
|
+
# @raise [ArgumentError] An argument error is raised if both extension and content_type are not specified.
|
18
20
|
def initialize(options={})
|
19
|
-
raise ArgumentError, "
|
21
|
+
raise ArgumentError, "extension and content_type are required" unless (options[:Extension] || options[:extension]) && (options[:content_type] || options[:ContentType])
|
20
22
|
options.each do |o|
|
21
23
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
22
24
|
end
|
23
25
|
end
|
26
|
+
|
27
|
+
|
24
28
|
# Sets the file extension for this content type.
|
25
|
-
def
|
29
|
+
def extension=(v) Axlsx::validate_string v; @extension = v end
|
30
|
+
alias :Extension= :extension=
|
26
31
|
|
27
32
|
# Sets the content type
|
28
33
|
# @see Axlsx#validate_content_type
|
29
|
-
def
|
34
|
+
def content_type=(v) Axlsx::validate_content_type v; @content_type = v end
|
35
|
+
alias :ContentType= :content_type=
|
30
36
|
|
31
37
|
# Serializes the object
|
32
38
|
# @param [String] str
|
33
39
|
# @return [String]
|
34
40
|
def to_xml_string(str = '')
|
35
41
|
str << '<Default '
|
36
|
-
str << instance_values.map { |key, value| '' << key
|
42
|
+
str << instance_values.map { |key, value| '' << Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ')
|
37
43
|
str << '/>'
|
38
44
|
end
|
39
45
|
|
@@ -5,36 +5,40 @@ module Axlsx
|
|
5
5
|
|
6
6
|
# The type of content.
|
7
7
|
# @return [String]
|
8
|
-
attr_reader :
|
8
|
+
attr_reader :content_type
|
9
|
+
alias :ContentType :content_type
|
9
10
|
|
10
11
|
# The name and location of the part.
|
11
12
|
# @return [String]
|
12
|
-
attr_reader :
|
13
|
+
attr_reader :part_name
|
14
|
+
alias :PartName :part_name
|
13
15
|
|
14
16
|
#Creates a new Override object
|
15
17
|
# @option options [String] PartName
|
16
18
|
# @option options [String] ContentType
|
17
19
|
# @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
|
18
20
|
def initialize(options={})
|
19
|
-
raise ArgumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
|
21
|
+
raise ArgumentError, "PartName and ContentType are required" unless (options[:PartName] || options[:part_name]) && (options[:ContentType] || options[:content_type])
|
20
22
|
options.each do |o|
|
21
23
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
27
|
# The name and location of the part.
|
26
|
-
def
|
28
|
+
def part_name=(v) Axlsx::validate_string v; @part_name = v end
|
29
|
+
alias :PartName= :part_name=
|
27
30
|
|
28
31
|
# The content type.
|
29
32
|
# @see Axlsx#validate_content_type
|
30
|
-
def
|
33
|
+
def content_type=(v) Axlsx::validate_content_type v; @content_type = v end
|
34
|
+
alias :ContentType= :content_type=
|
31
35
|
|
32
36
|
# Serializes the object
|
33
37
|
# @param [String] str
|
34
38
|
# @return [String]
|
35
39
|
def to_xml_string(str = '')
|
36
40
|
str << '<Override '
|
37
|
-
str << instance_values.map { |key, value| '' << key
|
41
|
+
str << instance_values.map { |key, value| '' << Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ')
|
38
42
|
str << '/>'
|
39
43
|
end
|
40
44
|
|
data/lib/axlsx/doc_props/app.rb
CHANGED
@@ -11,163 +11,216 @@ module Axlsx
|
|
11
11
|
class App
|
12
12
|
|
13
13
|
# @return [String] The name of the document template.
|
14
|
-
attr_reader :
|
14
|
+
attr_reader :template
|
15
|
+
alias :Template :template
|
15
16
|
|
16
17
|
# @return [String] The name of the manager for the document.
|
17
|
-
attr_reader :
|
18
|
+
attr_reader :manager
|
19
|
+
alias :Manager :manager
|
18
20
|
|
19
21
|
# @return [String] The name of the company generating the document.
|
20
|
-
attr_reader :
|
22
|
+
attr_reader :company
|
23
|
+
alias :Company :company
|
21
24
|
|
22
25
|
# @return [Integer] The number of pages in the document.
|
23
|
-
attr_reader :
|
26
|
+
attr_reader :pages
|
27
|
+
alias :Pages :pages
|
24
28
|
|
25
29
|
# @return [Integer] The number of words in the document.
|
26
|
-
attr_reader :
|
30
|
+
attr_reader :words
|
31
|
+
alias :Words :words
|
27
32
|
|
28
33
|
# @return [Integer] The number of characters in the document.
|
29
|
-
attr_reader :
|
34
|
+
attr_reader :characters
|
35
|
+
alias :Characters :characters
|
30
36
|
|
31
37
|
# @return [String] The intended format of the presentation.
|
32
|
-
attr_reader :
|
38
|
+
attr_reader :presentation_format
|
39
|
+
alias :PresentationFormat :presentation_format
|
33
40
|
|
34
41
|
# @return [Integer] The number of lines in the document.
|
35
|
-
attr_reader :
|
42
|
+
attr_reader :lines
|
43
|
+
alias :Lines :lines
|
36
44
|
|
37
45
|
# @return [Integer] The number of paragraphs in the document
|
38
|
-
attr_reader :
|
46
|
+
attr_reader :paragraphs
|
47
|
+
alias :Paragraphs :paragraphs
|
39
48
|
|
40
49
|
# @return [Intger] The number of slides in the document.
|
41
|
-
attr_reader :
|
50
|
+
attr_reader :slides
|
51
|
+
alias :Slides :slides
|
42
52
|
|
43
53
|
# @return [Integer] The number of slides that have notes.
|
44
|
-
attr_reader :
|
54
|
+
attr_reader :notes
|
55
|
+
alias :Notes :notes
|
45
56
|
|
46
57
|
# @return [Integer] The total amount of time spent editing.
|
47
|
-
attr_reader :
|
58
|
+
attr_reader :total_time
|
59
|
+
alias :TotalTime :total_time
|
48
60
|
|
49
61
|
# @return [Integer] The number of hidden slides.
|
50
|
-
attr_reader :
|
62
|
+
attr_reader :hidden_slides
|
63
|
+
alias :HiddenSlides :hidden_slides
|
51
64
|
|
52
65
|
# @return [Integer] The total number multimedia clips
|
53
|
-
attr_reader :
|
66
|
+
attr_reader :m_m_clips
|
67
|
+
alias :MMClips :m_m_clips
|
54
68
|
|
55
69
|
# @return [Boolean] The display mode for the document thumbnail.
|
56
|
-
attr_reader :
|
70
|
+
attr_reader :scale_crop
|
71
|
+
alias :ScaleCrop :scale_crop
|
57
72
|
|
58
73
|
# @return [Boolean] The links in the document are up to date.
|
59
|
-
attr_reader :
|
74
|
+
attr_reader :links_up_to_date
|
75
|
+
alias :LinksUpToDate :links_up_to_date
|
60
76
|
|
61
77
|
# @return [Integer] The number of characters in the document including spaces.
|
62
|
-
attr_reader :
|
78
|
+
attr_reader :characters_with_spaces
|
79
|
+
alias :CharactersWithSpaces :characters_with_spaces
|
63
80
|
|
64
81
|
# @return [Boolean] Indicates if the document is shared.
|
65
|
-
attr_reader :
|
82
|
+
attr_reader :shared_doc
|
83
|
+
alias :SharedDoc :shared_doc
|
66
84
|
|
67
85
|
# @return [String] The base for hyper links in the document.
|
68
|
-
attr_reader :
|
86
|
+
attr_reader :hyperlink_base
|
87
|
+
alias :HyperlinkBase :hyperlink_base
|
69
88
|
|
70
89
|
# @return [Boolean] Indicates that the hyper links in the document have been changed.
|
71
|
-
attr_reader :
|
72
|
-
|
90
|
+
attr_reader :hyperlinks_changed
|
91
|
+
alias :HyperlinksChanged :hyperlinks_changed
|
92
|
+
|
73
93
|
# @return [String] The name of the application
|
74
|
-
attr_reader :
|
94
|
+
attr_reader :application
|
95
|
+
alias :Applicatoin :application
|
75
96
|
|
76
97
|
# @return [String] The version of the application.
|
77
|
-
attr_reader :
|
98
|
+
attr_reader :app_version
|
99
|
+
alias :AppVersion :app_version
|
78
100
|
|
79
101
|
# @return [Integer] Document security
|
80
|
-
attr_reader :
|
102
|
+
attr_reader :doc_security
|
103
|
+
alias :DocSecurity :doc_security
|
81
104
|
|
82
105
|
# Creates an App object
|
83
|
-
# @option options [String]
|
84
|
-
# @option options [String]
|
85
|
-
# @option options [Integer]
|
86
|
-
# @option options [Integer]
|
87
|
-
# @option options [Integer]
|
88
|
-
# @option options [String]
|
89
|
-
# @option options [Integer]
|
90
|
-
# @option options [Integer]
|
91
|
-
# @option options [Integer]
|
92
|
-
# @option options [Integer]
|
93
|
-
# @option options [Integer]
|
94
|
-
# @option options [Integer]
|
95
|
-
# @option options [Integer]
|
96
|
-
# @option options [Boolean]
|
97
|
-
# @option options [Boolean]
|
98
|
-
# @option options [Integer]
|
99
|
-
# @option options [Boolean]
|
100
|
-
# @option options [String]
|
101
|
-
# @option options [String]
|
102
|
-
# @option options [String]
|
103
|
-
# @option options [String]
|
104
|
-
# @option options [Integer]
|
106
|
+
# @option options [String] template
|
107
|
+
# @option options [String] manager
|
108
|
+
# @option options [Integer] pages
|
109
|
+
# @option options [Integer] words
|
110
|
+
# @option options [Integer] characters
|
111
|
+
# @option options [String] presentation_format
|
112
|
+
# @option options [Integer] lines
|
113
|
+
# @option options [Integer] paragraphs
|
114
|
+
# @option options [Integer] slides
|
115
|
+
# @option options [Integer] notes
|
116
|
+
# @option options [Integer] total_time
|
117
|
+
# @option options [Integer] hidden_slides
|
118
|
+
# @option options [Integer] m_m_clips
|
119
|
+
# @option options [Boolean] scale_crop
|
120
|
+
# @option options [Boolean] links_up_to_date
|
121
|
+
# @option options [Integer] characters_with_spaces
|
122
|
+
# @option options [Boolean] share_doc
|
123
|
+
# @option options [String] hyperlink_base
|
124
|
+
# @option options [String] hyperlinks_changed
|
125
|
+
# @option options [String] application
|
126
|
+
# @option options [String] app_version
|
127
|
+
# @option options [Integer] doc_security
|
105
128
|
def initialize(options={})
|
106
129
|
options.each do |o|
|
107
130
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
108
131
|
end
|
109
132
|
end
|
110
133
|
|
111
|
-
# Sets the
|
112
|
-
def
|
113
|
-
|
114
|
-
# Sets the
|
115
|
-
def
|
116
|
-
|
117
|
-
# Sets the
|
118
|
-
def
|
119
|
-
|
120
|
-
# Sets the
|
121
|
-
def
|
122
|
-
|
123
|
-
# Sets the
|
124
|
-
def
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
134
|
+
# Sets the template property of your app.xml file
|
135
|
+
def template=(v) Axlsx::validate_string v; @template = v; end
|
136
|
+
|
137
|
+
# Sets the manager property of your app.xml file
|
138
|
+
def manager=(v) Axlsx::validate_string v; @manager = v; end
|
139
|
+
|
140
|
+
# Sets the company property of your app.xml file
|
141
|
+
def company=(v) Axlsx::validate_string v; @company = v; end
|
142
|
+
|
143
|
+
# Sets the pages property of your app.xml file
|
144
|
+
def pages=(v) Axlsx::validate_int v; @pages = v; end
|
145
|
+
|
146
|
+
# Sets the words property of your app.xml file
|
147
|
+
def words=(v) Axlsx::validate_int v; @words = v; end
|
148
|
+
alias :Words= :words=
|
149
|
+
|
150
|
+
# Sets the characters property of your app.xml file
|
151
|
+
def characters=(v) Axlsx::validate_int v; @characters = v; end
|
152
|
+
alias :Characters= :characters=
|
153
|
+
|
154
|
+
# Sets the presentation_format property of your app.xml file
|
155
|
+
def presentation_format=(v) Axlsx::validate_string v; @presentation_format = v; end
|
156
|
+
alias :PresentationFormat= :presentation_format=
|
157
|
+
|
158
|
+
# Sets the lines property of your app.xml file
|
159
|
+
def lines=(v) Axlsx::validate_int v; @lines = v; end
|
160
|
+
alias :Lines= :lines=
|
161
|
+
|
162
|
+
# Sets the paragraphs property of your app.xml file
|
163
|
+
def paragraphs=(v) Axlsx::validate_int v; @paragraphs = v; end
|
164
|
+
alias :Paragraphs= :paragraphs=
|
165
|
+
|
166
|
+
# sets the slides property of your app.xml file
|
167
|
+
def slides=(v) Axlsx::validate_int v; @slides = v; end
|
168
|
+
alias :Slides= :slides=
|
169
|
+
|
170
|
+
# sets the notes property of your app.xml file
|
171
|
+
def notes=(v) Axlsx::validate_int v; @notes = v; end
|
172
|
+
alias :Notes= :notes=
|
173
|
+
|
174
|
+
# Sets the total_time property of your app.xml file
|
175
|
+
def total_time=(v) Axlsx::validate_int v; @total_time = v; end
|
176
|
+
alias :TotalTime= :total_time=
|
177
|
+
|
178
|
+
# Sets the hidden_slides property of your app.xml file
|
179
|
+
def hidden_slides=(v) Axlsx::validate_int v; @hidden_slides = v; end
|
180
|
+
alias :HiddenSlides= :hidden_slides=
|
181
|
+
|
182
|
+
# Sets the m_m_clips property of your app.xml file
|
183
|
+
def m_m_clips=(v) Axlsx::validate_int v; @m_m_clips = v; end
|
184
|
+
alias :MMClips= :m_m_clips=
|
185
|
+
|
186
|
+
# Sets the scale_crop property of your app.xml file
|
187
|
+
def scale_crop=(v) Axlsx::validate_boolean v; @scale_crop = v; end
|
188
|
+
alias :ScaleCrop= :scale_crop=
|
189
|
+
|
190
|
+
# Sets the links_up_to_date property of your app.xml file
|
191
|
+
def links_up_to_date=(v) Axlsx::validate_boolean v; @links_up_to_date = v; end
|
192
|
+
alias :LinksUpToDate= :links_up_to_date=
|
193
|
+
|
194
|
+
# Sets the characters_with_spaces property of your app.xml file
|
195
|
+
def characters_with_spaces=(v) Axlsx::validate_int v; @characters_with_spaces = v; end
|
196
|
+
alias :CharactersWithSpaces= :characters_with_spaces=
|
197
|
+
|
198
|
+
# Sets the share_doc property of your app.xml file
|
199
|
+
def shared_doc=(v) Axlsx::validate_boolean v; @shared_doc = v; end
|
200
|
+
alias :SharedDoc= :shared_doc=
|
201
|
+
|
202
|
+
# Sets the hyperlink_base property of your app.xml file
|
203
|
+
def hyperlink_base=(v) Axlsx::validate_string v; @hyperlink_base = v; end
|
204
|
+
alias :HyperlinkBase= :hyperlink_base=
|
205
|
+
|
156
206
|
# Sets the HyperLinksChanged property of your app.xml file
|
157
|
-
def
|
158
|
-
|
159
|
-
|
160
|
-
# Sets the
|
161
|
-
def
|
162
|
-
|
163
|
-
def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end
|
207
|
+
def hyperlinks_changed=(v) Axlsx::validate_boolean v; @hyperlinks_changed = v; end
|
208
|
+
alias :HyperLinksChanged= :hyperlinks_changed=
|
209
|
+
|
210
|
+
# Sets the app_version property of your app.xml file
|
211
|
+
def app_version=(v) Axlsx::validate_string v; @app_version = v; end
|
212
|
+
alias :AppVersion= :app_version=
|
164
213
|
|
214
|
+
# Sets the doc_security property of your app.xml file
|
215
|
+
def doc_security=(v) Axlsx::validate_int v; @doc_security = v; end
|
216
|
+
alias :DocSecurity= :doc_security=
|
217
|
+
|
165
218
|
# Serialize the app.xml document
|
166
219
|
# @return [String]
|
167
220
|
def to_xml_string(str = '')
|
168
221
|
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
169
222
|
str << '<Properties xmlns="' << APP_NS << '" xmlns:vt="' << APP_NS_VT << '">'
|
170
|
-
str << instance_values.map { |key, value| '<' << key
|
223
|
+
str << instance_values.map { |key, value| '<' << Axlsx.camel(key) << '>' << value.to_s << '</' << Axlsx.camel(key) << '>' }.join
|
171
224
|
str << '</Properties>'
|
172
225
|
end
|
173
226
|
|