axlsx 1.2.0 → 2.0.0
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.
- checksums.yaml +7 -0
- data/.yardopts +3 -2
- data/.yardopts_guide +19 -0
- data/CHANGELOG.md +64 -1
- data/README.md +105 -87
- data/Rakefile +0 -5
- data/examples/2010_comments.rb +17 -0
- data/examples/anchor_swapping.rb +28 -0
- data/examples/auto_filter.rb +16 -0
- data/examples/basic_charts.rb +4 -0
- data/examples/colored_links.rb +59 -0
- data/examples/conditional_formatting/example_conditional_formatting.rb +4 -2
- data/examples/example.rb +569 -258
- data/examples/ios_preview.rb +14 -0
- data/examples/page_setup.rb +11 -0
- data/examples/pivot_table.rb +39 -0
- data/examples/skydrive/real_example.rb +8 -8
- data/examples/styles.rb +66 -0
- data/examples/underline.rb +13 -0
- data/examples/wrap_text.rb +21 -0
- data/lib/axlsx/content_type/abstract_content_type.rb +32 -0
- data/lib/axlsx/content_type/content_type.rb +1 -1
- data/lib/axlsx/content_type/default.rb +6 -37
- data/lib/axlsx/content_type/override.rb +6 -38
- data/lib/axlsx/doc_props/app.rb +10 -7
- data/lib/axlsx/doc_props/core.rb +6 -1
- data/lib/axlsx/drawing/axes.rb +61 -0
- data/lib/axlsx/drawing/axis.rb +20 -17
- data/lib/axlsx/drawing/bar_3D_chart.rb +31 -22
- data/lib/axlsx/drawing/cat_axis.rb +2 -10
- data/lib/axlsx/drawing/chart.rb +33 -6
- data/lib/axlsx/drawing/d_lbls.rb +21 -31
- data/lib/axlsx/drawing/drawing.rb +11 -17
- data/lib/axlsx/drawing/graphic_frame.rb +3 -3
- data/lib/axlsx/drawing/hyperlink.rb +42 -36
- data/lib/axlsx/drawing/line_3D_chart.rb +28 -70
- data/lib/axlsx/drawing/line_chart.rb +99 -0
- data/lib/axlsx/drawing/line_series.rb +20 -2
- data/lib/axlsx/drawing/marker.rb +38 -18
- data/lib/axlsx/drawing/num_data.rb +6 -6
- data/lib/axlsx/drawing/num_data_source.rb +17 -16
- data/lib/axlsx/drawing/one_cell_anchor.rb +28 -21
- data/lib/axlsx/drawing/pic.rb +43 -45
- data/lib/axlsx/drawing/picture_locking.rb +12 -44
- data/lib/axlsx/drawing/pie_3D_chart.rb +2 -1
- data/lib/axlsx/drawing/scaling.rb +13 -13
- data/lib/axlsx/drawing/scatter_chart.rb +32 -21
- data/lib/axlsx/drawing/ser_axis.rb +15 -16
- data/lib/axlsx/drawing/series.rb +3 -6
- data/lib/axlsx/drawing/str_data.rb +3 -3
- data/lib/axlsx/drawing/str_val.rb +7 -8
- data/lib/axlsx/drawing/two_cell_anchor.rb +7 -27
- data/lib/axlsx/drawing/val_axis.rb +14 -13
- data/lib/axlsx/drawing/view_3D.rb +52 -38
- data/lib/axlsx/drawing/vml_shape.rb +20 -79
- data/lib/axlsx/package.rb +58 -28
- data/lib/axlsx/rels/relationship.rb +75 -9
- data/lib/axlsx/rels/relationships.rb +8 -1
- data/lib/axlsx/stylesheet/border.rb +29 -20
- data/lib/axlsx/stylesheet/border_pr.rb +5 -4
- data/lib/axlsx/stylesheet/cell_alignment.rb +55 -29
- data/lib/axlsx/stylesheet/cell_protection.rb +7 -4
- data/lib/axlsx/stylesheet/cell_style.rb +19 -14
- data/lib/axlsx/stylesheet/color.rb +20 -17
- data/lib/axlsx/stylesheet/dxf.rb +4 -4
- data/lib/axlsx/stylesheet/font.rb +22 -22
- data/lib/axlsx/stylesheet/gradient_fill.rb +45 -21
- data/lib/axlsx/stylesheet/num_fmt.rb +23 -14
- data/lib/axlsx/stylesheet/pattern_fill.rb +12 -21
- data/lib/axlsx/stylesheet/styles.rb +37 -22
- data/lib/axlsx/stylesheet/table_style.rb +17 -16
- data/lib/axlsx/stylesheet/table_style_element.rb +15 -11
- data/lib/axlsx/stylesheet/table_styles.rb +14 -11
- data/lib/axlsx/stylesheet/xf.rb +28 -26
- data/lib/axlsx/util/accessors.rb +64 -0
- data/lib/axlsx/util/constants.rb +127 -6
- data/lib/axlsx/util/options_parser.rb +15 -0
- data/lib/axlsx/util/serialized_attributes.rb +79 -0
- data/lib/axlsx/util/simple_typed_list.rb +50 -15
- data/lib/axlsx/util/validators.rb +51 -16
- data/lib/axlsx/version.rb +2 -2
- data/lib/axlsx/workbook/defined_name.rb +14 -59
- data/lib/axlsx/workbook/shared_strings_table.rb +13 -4
- data/lib/axlsx/workbook/workbook.rb +85 -6
- data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +77 -0
- data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +94 -0
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +246 -0
- data/lib/axlsx/workbook/worksheet/break.rb +37 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +109 -107
- data/lib/axlsx/workbook/worksheet/cell_serializer.rb +144 -0
- data/lib/axlsx/workbook/worksheet/cfvo.rb +15 -15
- data/lib/axlsx/workbook/worksheet/cfvos.rb +15 -0
- data/lib/axlsx/workbook/worksheet/col.rb +43 -29
- data/lib/axlsx/workbook/worksheet/col_breaks.rb +35 -0
- data/lib/axlsx/workbook/worksheet/color_scale.rb +62 -28
- data/lib/axlsx/workbook/worksheet/comment.rb +28 -37
- data/lib/axlsx/workbook/worksheet/comments.rb +3 -3
- data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +11 -11
- data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +31 -27
- data/lib/axlsx/workbook/worksheet/data_bar.rb +75 -41
- data/lib/axlsx/workbook/worksheet/data_validation.rb +61 -62
- data/lib/axlsx/workbook/worksheet/date_time_converter.rb +6 -5
- data/lib/axlsx/workbook/worksheet/dimension.rb +0 -1
- data/lib/axlsx/workbook/worksheet/header_footer.rb +54 -0
- data/lib/axlsx/workbook/worksheet/icon_set.rb +20 -20
- data/lib/axlsx/workbook/worksheet/page_margins.rb +21 -19
- data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +44 -0
- data/lib/axlsx/workbook/worksheet/page_setup.rb +152 -23
- data/lib/axlsx/workbook/worksheet/pane.rb +48 -51
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +273 -0
- data/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +66 -0
- data/lib/axlsx/workbook/worksheet/pivot_tables.rb +24 -0
- data/lib/axlsx/workbook/worksheet/print_options.rb +8 -30
- data/lib/axlsx/workbook/worksheet/protected_range.rb +16 -13
- data/lib/axlsx/workbook/worksheet/row.rb +59 -83
- data/lib/axlsx/workbook/worksheet/row_breaks.rb +33 -0
- data/lib/axlsx/workbook/worksheet/selection.rb +30 -38
- data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +29 -0
- data/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +60 -0
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +49 -4
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +51 -155
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +68 -234
- data/lib/axlsx/workbook/worksheet/table.rb +25 -19
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +51 -0
- data/lib/axlsx/workbook/worksheet/tables.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet.rb +174 -35
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +6 -5
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +4 -10
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +74 -0
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +38 -0
- data/lib/axlsx.rb +55 -5
- data/lib/schema/sml.xsd +4 -0
- data/test/axlsx.qcachegrind +2226 -0
- data/test/benchmark.rb +2 -3
- data/test/content_type/tc_default.rb +0 -11
- data/test/content_type/tc_override.rb +0 -13
- data/test/doc_props/tc_core.rb +7 -0
- data/test/drawing/tc_axes.rb +8 -0
- data/test/drawing/tc_axis.rb +15 -17
- data/test/drawing/tc_bar_3D_chart.rb +6 -0
- data/test/drawing/tc_cat_axis.rb +9 -9
- data/test/drawing/tc_chart.rb +20 -0
- data/test/drawing/tc_d_lbls.rb +14 -4
- data/test/drawing/tc_drawing.rb +0 -5
- data/test/drawing/tc_graphic_frame.rb +5 -3
- data/test/drawing/tc_hyperlink.rb +0 -4
- data/test/drawing/tc_line_chart.rb +39 -0
- data/test/drawing/tc_line_series.rb +8 -2
- data/test/drawing/tc_pic.rb +14 -3
- data/test/drawing/tc_ser_axis.rb +13 -12
- data/test/drawing/tc_two_cell_anchor.rb +3 -3
- data/test/drawing/tc_val_axis.rb +6 -6
- data/test/drawing/tc_vml_shape.rb +9 -3
- data/test/profile.rb +11 -21
- data/test/rels/tc_relationship.rb +32 -9
- data/test/rels/tc_relationships.rb +12 -1
- data/test/stylesheet/tc_color.rb +6 -0
- data/test/stylesheet/tc_styles.rb +15 -2
- data/test/tc_axlsx.rb +35 -2
- data/test/tc_helper.rb +7 -1
- data/test/tc_package.rb +44 -5
- data/test/util/tc_serialized_attributes.rb +19 -0
- data/test/util/tc_validators.rb +26 -1
- data/test/workbook/tc_defined_name.rb +2 -2
- data/test/workbook/tc_shared_strings_table.rb +6 -0
- data/test/workbook/tc_workbook.rb +38 -1
- data/test/workbook/worksheet/auto_filter/tc_auto_filter.rb +38 -0
- data/test/workbook/worksheet/auto_filter/tc_filter_column.rb +76 -0
- data/test/workbook/worksheet/auto_filter/tc_filters.rb +50 -0
- data/test/workbook/worksheet/tc_break.rb +49 -0
- data/test/workbook/worksheet/tc_cell.rb +40 -6
- data/test/workbook/worksheet/tc_col.rb +11 -1
- data/test/workbook/worksheet/tc_color_scale.rb +31 -2
- data/test/workbook/worksheet/tc_comment.rb +21 -6
- data/test/workbook/worksheet/tc_comments.rb +2 -2
- data/test/workbook/worksheet/tc_conditional_formatting.rb +7 -0
- data/test/workbook/worksheet/tc_data_bar.rb +7 -0
- data/test/workbook/worksheet/tc_date_time_converter.rb +3 -11
- data/test/workbook/worksheet/tc_header_footer.rb +151 -0
- data/test/workbook/worksheet/tc_page_set_up_pr.rb +15 -0
- data/test/workbook/worksheet/tc_page_setup.rb +6 -1
- data/test/workbook/worksheet/tc_pane.rb +5 -45
- data/test/workbook/worksheet/tc_pivot_table.rb +120 -0
- data/test/workbook/worksheet/tc_pivot_table_cache_definition.rb +54 -0
- data/test/workbook/worksheet/tc_row.rb +4 -4
- data/test/workbook/worksheet/tc_selection.rb +9 -48
- data/test/workbook/worksheet/tc_sheet_calc_pr.rb +18 -0
- data/test/workbook/worksheet/tc_sheet_format_pr.rb +88 -0
- data/test/workbook/worksheet/tc_sheet_pr.rb +27 -0
- data/test/workbook/worksheet/tc_sheet_view.rb +39 -39
- data/test/workbook/worksheet/{table/tc_table.rb → tc_table.rb} +8 -3
- data/test/workbook/worksheet/tc_table_style_info.rb +53 -0
- data/test/workbook/worksheet/tc_worksheet.rb +131 -16
- data/test/workbook/worksheet/tc_worksheet_hyperlink.rb +55 -0
- metadata +97 -64
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/extractive.pdf +0 -0
- data/examples/image1.gif +0 -0
- data/examples/image1.jpg +0 -0
- data/examples/image1.png +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/sample.png +0 -0
- data/examples/scraping_html.rb +0 -91
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/sheet_view.rb +0 -34
- data/examples/two_cell_anchor_image.rb +0 -11
- data/lib/axlsx/workbook/worksheet/auto_filter.rb +0 -34
|
@@ -6,6 +6,16 @@ module Axlsx
|
|
|
6
6
|
# @see ConditionalFormattingRule
|
|
7
7
|
class ConditionalFormatting
|
|
8
8
|
|
|
9
|
+
include Axlsx::OptionsParser
|
|
10
|
+
|
|
11
|
+
# Creates a new {ConditionalFormatting} object
|
|
12
|
+
# @option options [Array] rules The rules to apply
|
|
13
|
+
# @option options [String] sqref The range to apply the rules to
|
|
14
|
+
def initialize(options={})
|
|
15
|
+
@rules = []
|
|
16
|
+
parse_options options
|
|
17
|
+
end
|
|
18
|
+
|
|
9
19
|
# Range over which the formatting is applied, in "A1:B2" format
|
|
10
20
|
# @return [String]
|
|
11
21
|
attr_reader :sqref
|
|
@@ -18,17 +28,7 @@ module Axlsx
|
|
|
18
28
|
# @return [Array]
|
|
19
29
|
attr_reader :rules
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
# @option options [Array] rules The rules to apply
|
|
23
|
-
# @option options [String] sqref The range to apply the rules to
|
|
24
|
-
def initialize(options={})
|
|
25
|
-
@rules = []
|
|
26
|
-
options.each do |o|
|
|
27
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Add Conditional Formatting Rules to this object. Rules can either
|
|
31
|
+
# Add Conditional Formatting Rules to this object. Rules can either
|
|
32
32
|
# be already created {ConditionalFormattingRule} elements or
|
|
33
33
|
# hashes of options for automatic creation. If rules is a hash
|
|
34
34
|
# instead of an array, assume only one rule being added.
|
|
@@ -8,10 +8,36 @@ module Axlsx
|
|
|
8
8
|
# @see ConditionalFormattingRule#initialize
|
|
9
9
|
class ConditionalFormattingRule
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
include Axlsx::OptionsParser
|
|
12
|
+
include Axlsx::SerializedAttributes
|
|
13
|
+
|
|
14
|
+
# Creates a new Conditional Formatting Rule object
|
|
15
|
+
# @option options [Symbol] type The type of this formatting rule
|
|
16
|
+
# @option options [Boolean] aboveAverage This is an aboveAverage rule
|
|
17
|
+
# @option options [Boolean] bottom This is a bottom N rule.
|
|
18
|
+
# @option options [Integer] dxfId The formatting id to apply to matches
|
|
19
|
+
# @option options [Boolean] equalAverage Is the aboveAverage or belowAverage rule inclusive
|
|
20
|
+
# @option options [Integer] priority The priority of the rule, 1 is highest
|
|
21
|
+
# @option options [Symbol] operator Which operator to apply
|
|
22
|
+
# @option options [String] text The value to apply a text operator against
|
|
23
|
+
# @option options [Boolean] percent If a top/bottom N rule, evaluate as N% rather than N
|
|
24
|
+
# @option options [Integer] rank If a top/bottom N rule, the value of N
|
|
25
|
+
# @option options [Integer] stdDev The number of standard deviations above or below the average to match
|
|
26
|
+
# @option options [Boolean] stopIfTrue Stop evaluating rules after this rule matches
|
|
27
|
+
# @option options [Symbol] timePeriod The time period in a date occuring... rule
|
|
28
|
+
# @option options [String] formula The formula to match against in i.e. an equal rule. Use a [minimum, maximum] array for cellIs between/notBetween conditionals.
|
|
29
|
+
def initialize(options={})
|
|
30
|
+
@color_scale = @data_bar = @icon_set = @formula = nil
|
|
31
|
+
parse_options options
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
serializable_attributes :type, :aboveAverage, :bottom, :dxfId, :equalAverage,
|
|
35
|
+
:priority, :operator, :text, :percent, :rank, :stdDev,
|
|
36
|
+
:stopIfTrue, :timePeriod
|
|
13
37
|
|
|
14
38
|
# Formula
|
|
39
|
+
# The formula or value to match against (e.g. 5 with an operator of :greaterThan to specify cell_value > 5).
|
|
40
|
+
# If the operator is :between or :notBetween, use an array to specify [minimum, maximum]
|
|
15
41
|
# @return [String]
|
|
16
42
|
attr_reader :formula
|
|
17
43
|
|
|
@@ -129,28 +155,6 @@ module Axlsx
|
|
|
129
155
|
@icon_set ||= IconSet.new
|
|
130
156
|
end
|
|
131
157
|
|
|
132
|
-
# Creates a new Conditional Formatting Rule object
|
|
133
|
-
# @option options [Symbol] type The type of this formatting rule
|
|
134
|
-
# @option options [Boolean] aboveAverage This is an aboveAverage rule
|
|
135
|
-
# @option options [Boolean] bottom This is a bottom N rule.
|
|
136
|
-
# @option options [Integer] dxfId The formatting id to apply to matches
|
|
137
|
-
# @option options [Boolean] equalAverage Is the aboveAverage or belowAverage rule inclusive
|
|
138
|
-
# @option options [Integer] priority The priority of the rule, 1 is highest
|
|
139
|
-
# @option options [Symbol] operator Which operator to apply
|
|
140
|
-
# @option options [String] text The value to apply a text operator against
|
|
141
|
-
# @option options [Boolean] percent If a top/bottom N rule, evaluate as N% rather than N
|
|
142
|
-
# @option options [Integer] rank If a top/bottom N rule, the value of N
|
|
143
|
-
# @option options [Integer] stdDev The number of standard deviations above or below the average to match
|
|
144
|
-
# @option options [Boolean] stopIfTrue Stop evaluating rules after this rule matches
|
|
145
|
-
# @option options [Symbol] timePeriod The time period in a date occuring... rule
|
|
146
|
-
# @option options [String] formula The formula to match against in i.e. an equal rule
|
|
147
|
-
def initialize(options={})
|
|
148
|
-
@color_scale = @data_bar = @icon_set = @formula = nil
|
|
149
|
-
options.each do |o|
|
|
150
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
158
|
# @see type
|
|
155
159
|
def type=(v); Axlsx::validate_conditional_formatting_type(v); @type = v end
|
|
156
160
|
# @see aboveAverage
|
|
@@ -178,7 +182,7 @@ module Axlsx
|
|
|
178
182
|
# @see timePeriod
|
|
179
183
|
def timePeriod=(v); Axlsx::validate_time_period_type(v); @timePeriod = v end
|
|
180
184
|
# @see formula
|
|
181
|
-
def formula=(v); Axlsx::validate_string(
|
|
185
|
+
def formula=(v); [*v].each {|x| Axlsx::validate_string(x) }; @formula = [*v].map { |form| ::CGI.escapeHTML(form) } end
|
|
182
186
|
|
|
183
187
|
# @see color_scale
|
|
184
188
|
def color_scale=(v)
|
|
@@ -204,9 +208,9 @@ module Axlsx
|
|
|
204
208
|
# @return [String]
|
|
205
209
|
def to_xml_string(str = '')
|
|
206
210
|
str << '<cfRule '
|
|
207
|
-
str
|
|
211
|
+
serialized_attributes str
|
|
208
212
|
str << '>'
|
|
209
|
-
str << '<formula>' << self.formula << '</formula>' if @formula
|
|
213
|
+
str << '<formula>' << [*self.formula].join('</formula><formula>') << '</formula>' if @formula
|
|
210
214
|
@color_scale.to_xml_string(str) if @color_scale && @type == :colorScale
|
|
211
215
|
@data_bar.to_xml_string(str) if @data_bar && @type == :dataBar
|
|
212
216
|
@icon_set.to_xml_string(str) if @icon_set && @type == :iconSet
|
|
@@ -7,6 +7,35 @@ module Axlsx
|
|
|
7
7
|
# @see ConditionalFormattingRule#initialize
|
|
8
8
|
class DataBar
|
|
9
9
|
|
|
10
|
+
include Axlsx::OptionsParser
|
|
11
|
+
include Axlsx::SerializedAttributes
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
# This differs from ColorScale. There must be exactly two cfvos one color
|
|
15
|
+
def default_cfvos
|
|
16
|
+
[{:type => :min, :val => "0"},
|
|
17
|
+
{:type => :max, :val => "0"}]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Creates a new data bar conditional formatting object
|
|
22
|
+
# @param [Hash] options
|
|
23
|
+
# @option options [Integer] minLength
|
|
24
|
+
# @option options [Integer] maxLength
|
|
25
|
+
# @option options [Boolean] showValue
|
|
26
|
+
# @option options [String] color - the rbg value used to color the bars
|
|
27
|
+
# @param [Array] cfvos hashes defining the gradient interpolation points for this formatting.
|
|
28
|
+
def initialize(options = {}, *cfvos)
|
|
29
|
+
@min_length = 10
|
|
30
|
+
@max_length = 90
|
|
31
|
+
@show_value = true
|
|
32
|
+
parse_options options
|
|
33
|
+
initialize_cfvos(cfvos)
|
|
34
|
+
yield self if block_given?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
serializable_attributes :min_length, :max_length, :show_value
|
|
38
|
+
|
|
10
39
|
# instance values that must be serialized as their own elements - e.g. not attributes.
|
|
11
40
|
CHILD_ELEMENTS = [:value_objects, :color]
|
|
12
41
|
|
|
@@ -14,24 +43,29 @@ module Axlsx
|
|
|
14
43
|
# The minimum length of the data bar, as a percentage of the cell width.
|
|
15
44
|
# The default value is 10
|
|
16
45
|
# @return [Integer]
|
|
17
|
-
attr_reader :
|
|
46
|
+
attr_reader :min_length
|
|
47
|
+
alias :minLength :min_length
|
|
18
48
|
|
|
19
49
|
# maxLength attribute
|
|
20
50
|
# The maximum length of the data bar, as a percentage of the cell width.
|
|
21
51
|
# The default value is 90
|
|
22
52
|
# @return [Integer]
|
|
23
|
-
attr_reader :
|
|
53
|
+
attr_reader :max_length
|
|
54
|
+
alias :maxLength :max_length
|
|
24
55
|
|
|
25
56
|
# maxLength attribute
|
|
26
57
|
# Indicates whether to show the values of the cells on which this data bar is applied.
|
|
27
58
|
# The default value is true
|
|
28
59
|
# @return [Boolean]
|
|
29
|
-
attr_reader :
|
|
60
|
+
attr_reader :show_value
|
|
61
|
+
alias :showValue :show_value
|
|
30
62
|
|
|
31
63
|
# A simple typed list of cfvos
|
|
32
64
|
# @return [SimpleTypedList]
|
|
33
65
|
# @see Cfvo
|
|
34
|
-
|
|
66
|
+
def value_objects
|
|
67
|
+
@value_objects ||= Cfvos.new
|
|
68
|
+
end
|
|
35
69
|
|
|
36
70
|
# color
|
|
37
71
|
# the color object used in the data bar formatting
|
|
@@ -40,58 +74,58 @@ module Axlsx
|
|
|
40
74
|
@color ||= Color.new :rgb => "FF0000FF"
|
|
41
75
|
end
|
|
42
76
|
|
|
43
|
-
# Creates a new data bar conditional formatting object
|
|
44
|
-
# @option options [Integer] minLength
|
|
45
|
-
# @option options [Integer] maxLength
|
|
46
|
-
# @option options [Boolean] showValue
|
|
47
|
-
# @option options [String] color - the rbg value used to color the bars
|
|
48
|
-
def initialize(options = {})
|
|
49
|
-
@minLength = 10
|
|
50
|
-
@maxLength = 90
|
|
51
|
-
@showValue = true
|
|
52
|
-
initialize_value_objects
|
|
53
|
-
options.each do |o|
|
|
54
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
55
|
-
end
|
|
56
|
-
yield self if block_given?
|
|
57
|
-
end
|
|
58
|
-
|
|
59
77
|
# @see minLength
|
|
60
|
-
def
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# @see showValue
|
|
65
|
-
def showValue=(v); Axlsx.validate_boolean(v); @showValue = v end
|
|
66
|
-
|
|
67
|
-
# Sets the color for the data bars.
|
|
68
|
-
# @param [Color|String] v The color object, or rgb string value to apply
|
|
69
|
-
def color=(v)
|
|
70
|
-
@color = v if v.is_a? Color
|
|
71
|
-
self.color.rgb = v if v.is_a? String
|
|
72
|
-
@color
|
|
78
|
+
def min_length=(v)
|
|
79
|
+
Axlsx.validate_unsigned_int(v)
|
|
80
|
+
@min_length = v
|
|
73
81
|
end
|
|
82
|
+
alias :minLength= :min_length=
|
|
83
|
+
|
|
84
|
+
# @see maxLength
|
|
85
|
+
def max_length=(v)
|
|
86
|
+
Axlsx.validate_unsigned_int(v)
|
|
87
|
+
@max_length = v
|
|
88
|
+
end
|
|
89
|
+
alias :maxLength= :max_length=
|
|
90
|
+
|
|
91
|
+
# @see showValue
|
|
92
|
+
def show_value=(v)
|
|
93
|
+
Axlsx.validate_boolean(v)
|
|
94
|
+
@show_value = v
|
|
95
|
+
end
|
|
96
|
+
alias :showValue= :show_value=
|
|
97
|
+
|
|
98
|
+
# Sets the color for the data bars.
|
|
99
|
+
# @param [Color|String] v The color object, or rgb string value to apply
|
|
100
|
+
def color=(v)
|
|
101
|
+
@color = v if v.is_a? Color
|
|
102
|
+
self.color.rgb = v if v.is_a? String
|
|
103
|
+
@color
|
|
104
|
+
end
|
|
74
105
|
|
|
75
106
|
# Serialize this object to an xml string
|
|
76
107
|
# @param [String] str
|
|
77
108
|
# @return [String]
|
|
78
109
|
def to_xml_string(str="")
|
|
79
110
|
str << '<dataBar '
|
|
80
|
-
str
|
|
111
|
+
serialized_attributes str
|
|
81
112
|
str << '>'
|
|
82
|
-
|
|
113
|
+
value_objects.to_xml_string(str)
|
|
83
114
|
self.color.to_xml_string(str)
|
|
84
115
|
str << '</dataBar>'
|
|
85
116
|
end
|
|
86
117
|
|
|
87
118
|
private
|
|
88
119
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
def initialize_cfvos(cfvos)
|
|
121
|
+
self.class.default_cfvos.each_with_index.map do |default, index|
|
|
122
|
+
if index < cfvos.size
|
|
123
|
+
value_objects << Cfvo.new(default.merge(cfvos[index]))
|
|
124
|
+
else
|
|
125
|
+
value_objects << Cfvo.new(default)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
95
128
|
end
|
|
129
|
+
|
|
96
130
|
end
|
|
97
131
|
end
|
|
@@ -5,24 +5,50 @@ module Axlsx
|
|
|
5
5
|
# @note The recommended way to manage data validations is via Worksheet#add_data_validation
|
|
6
6
|
# @see Worksheet#add_data_validation
|
|
7
7
|
class DataValidation
|
|
8
|
-
|
|
8
|
+
include Axlsx::OptionsParser
|
|
9
|
+
|
|
10
|
+
# Creates a new {DataValidation} object
|
|
11
|
+
# @option options [String] formula1
|
|
12
|
+
# @option options [String] formula2
|
|
13
|
+
# @option options [Boolean] allowBlank - A boolean value indicating whether the data validation allows the use of empty or blank entries.
|
|
14
|
+
# @option options [String] error - Message text of error alert.
|
|
15
|
+
# @option options [Symbol] errorStyle - The style of error alert used for this data validation.
|
|
16
|
+
# @option options [String] errorTitle - itle bar text of error alert.
|
|
17
|
+
# @option options [Symbol] operator - The relational operator used with this data validation.
|
|
18
|
+
# @option options [String] prompt - Message text of input prompt.
|
|
19
|
+
# @option options [String] promptTitle - Title bar text of input prompt.
|
|
20
|
+
# @option options [Boolean] showDropDown - A boolean value indicating whether to display a dropdown combo box for a list type data validation
|
|
21
|
+
# @option options [Boolean] showErrorMessage - A boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified.
|
|
22
|
+
# @option options [Boolean] showInputMessage - A boolean value indicating whether to display the input prompt message.
|
|
23
|
+
# @option options [String] sqref - Range over which data validation is applied, in "A1:B2" format.
|
|
24
|
+
# @option options [Symbol] type - The type of data validation.
|
|
25
|
+
def initialize(options={})
|
|
26
|
+
# defaults
|
|
27
|
+
@formula1 = @formula2 = @error = @errorTitle = @operator = @prompt = @promptTitle = @sqref = nil
|
|
28
|
+
@allowBlank = @showErrorMessage = true
|
|
29
|
+
@showDropDown = @showInputMessage = false
|
|
30
|
+
@type = :none
|
|
31
|
+
@errorStyle = :stop
|
|
32
|
+
parse_options options
|
|
33
|
+
end
|
|
34
|
+
|
|
9
35
|
# instance values that must be serialized as their own elements - e.g. not attributes.
|
|
10
36
|
CHILD_ELEMENTS = [:formula1, :formula2]
|
|
11
|
-
|
|
37
|
+
|
|
12
38
|
# Formula1
|
|
13
39
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
14
40
|
# @see type
|
|
15
41
|
# @return [String]
|
|
16
42
|
# default nil
|
|
17
43
|
attr_reader :formula1
|
|
18
|
-
|
|
44
|
+
|
|
19
45
|
# Formula2
|
|
20
46
|
# Available for type whole, decimal, date, time, textLength
|
|
21
47
|
# @see type
|
|
22
48
|
# @return [String]
|
|
23
49
|
# default nil
|
|
24
50
|
attr_reader :formula2
|
|
25
|
-
|
|
51
|
+
|
|
26
52
|
# Allow Blank
|
|
27
53
|
# A boolean value indicating whether the data validation allows the use of empty or blank
|
|
28
54
|
# entries. 1 means empty entries are OK and do not violate the validation constraints.
|
|
@@ -31,7 +57,7 @@ module Axlsx
|
|
|
31
57
|
# @return [Boolean]
|
|
32
58
|
# default true
|
|
33
59
|
attr_reader :allowBlank
|
|
34
|
-
|
|
60
|
+
|
|
35
61
|
# Error Message
|
|
36
62
|
# Message text of error alert.
|
|
37
63
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
@@ -39,7 +65,7 @@ module Axlsx
|
|
|
39
65
|
# @return [String]
|
|
40
66
|
# default nil
|
|
41
67
|
attr_reader :error
|
|
42
|
-
|
|
68
|
+
|
|
43
69
|
# Error Style (ST_DataValidationErrorStyle)
|
|
44
70
|
# The style of error alert used for this data validation.
|
|
45
71
|
# Options are:
|
|
@@ -51,7 +77,7 @@ module Axlsx
|
|
|
51
77
|
# @return [Symbol]
|
|
52
78
|
# default :stop
|
|
53
79
|
attr_reader :errorStyle
|
|
54
|
-
|
|
80
|
+
|
|
55
81
|
# Error Title
|
|
56
82
|
# Title bar text of error alert.
|
|
57
83
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
@@ -59,7 +85,7 @@ module Axlsx
|
|
|
59
85
|
# @return [String]
|
|
60
86
|
# default nil
|
|
61
87
|
attr_reader :errorTitle
|
|
62
|
-
|
|
88
|
+
|
|
63
89
|
# Operator (ST_DataValidationOperator)
|
|
64
90
|
# The relational operator used with this data validation.
|
|
65
91
|
# Options are:
|
|
@@ -76,7 +102,7 @@ module Axlsx
|
|
|
76
102
|
# @return [Symbol]
|
|
77
103
|
# default nil
|
|
78
104
|
attr_reader :operator
|
|
79
|
-
|
|
105
|
+
|
|
80
106
|
# Input prompt
|
|
81
107
|
# Message text of input prompt.
|
|
82
108
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
@@ -84,7 +110,7 @@ module Axlsx
|
|
|
84
110
|
# @return [String]
|
|
85
111
|
# default nil
|
|
86
112
|
attr_reader :prompt
|
|
87
|
-
|
|
113
|
+
|
|
88
114
|
# Prompt title
|
|
89
115
|
# Title bar text of input prompt.
|
|
90
116
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
@@ -92,7 +118,7 @@ module Axlsx
|
|
|
92
118
|
# @return [String]
|
|
93
119
|
# default nil
|
|
94
120
|
attr_reader :promptTitle
|
|
95
|
-
|
|
121
|
+
|
|
96
122
|
# Show drop down
|
|
97
123
|
# A boolean value indicating whether to display a dropdown combo box for a list type data
|
|
98
124
|
# validation. Be careful: false shows the dropdown list!
|
|
@@ -101,7 +127,7 @@ module Axlsx
|
|
|
101
127
|
# @return [Boolean]
|
|
102
128
|
# default false
|
|
103
129
|
attr_reader :showDropDown
|
|
104
|
-
|
|
130
|
+
|
|
105
131
|
# Show error message
|
|
106
132
|
# A boolean value indicating whether to display the error alert message when an invalid
|
|
107
133
|
# value has been entered, according to the criteria specified.
|
|
@@ -110,7 +136,7 @@ module Axlsx
|
|
|
110
136
|
# @return [Boolean]
|
|
111
137
|
# default false
|
|
112
138
|
attr_reader :showErrorMessage
|
|
113
|
-
|
|
139
|
+
|
|
114
140
|
# Show input message
|
|
115
141
|
# A boolean value indicating whether to display the input prompt message.
|
|
116
142
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
@@ -118,14 +144,14 @@ module Axlsx
|
|
|
118
144
|
# @return [Boolean]
|
|
119
145
|
# default false
|
|
120
146
|
attr_reader :showInputMessage
|
|
121
|
-
|
|
147
|
+
|
|
122
148
|
# Range over which data validation is applied, in "A1:B2" format
|
|
123
149
|
# Available for type whole, decimal, date, time, textLength, list, custom
|
|
124
150
|
# @see type
|
|
125
151
|
# @return [String]
|
|
126
152
|
# default nil
|
|
127
153
|
attr_reader :sqref
|
|
128
|
-
|
|
154
|
+
|
|
129
155
|
# The type (ST_DataValidationType) of data validation.
|
|
130
156
|
# Options are:
|
|
131
157
|
# * custom: Data validation which uses a custom formula to check the cell value.
|
|
@@ -139,83 +165,56 @@ module Axlsx
|
|
|
139
165
|
# @return [Symbol]
|
|
140
166
|
# default none
|
|
141
167
|
attr_reader :type
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
# @option options [String] formula1
|
|
145
|
-
# @option options [String] formula2
|
|
146
|
-
# @option options [Boolean] allowBlank - A boolean value indicating whether the data validation allows the use of empty or blank entries.
|
|
147
|
-
# @option options [String] error - Message text of error alert.
|
|
148
|
-
# @option options [Symbol] errorStyle - The style of error alert used for this data validation.
|
|
149
|
-
# @option options [String] errorTitle - itle bar text of error alert.
|
|
150
|
-
# @option options [Symbol] operator - The relational operator used with this data validation.
|
|
151
|
-
# @option options [String] prompt - Message text of input prompt.
|
|
152
|
-
# @option options [String] promptTitle - Title bar text of input prompt.
|
|
153
|
-
# @option options [Boolean] showDropDown - A boolean value indicating whether to display a dropdown combo box for a list type data validation
|
|
154
|
-
# @option options [Boolean] showErrorMessage - A boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified.
|
|
155
|
-
# @option options [Boolean] showInputMessage - A boolean value indicating whether to display the input prompt message.
|
|
156
|
-
# @option options [String] sqref - Range over which data validation is applied, in "A1:B2" format.
|
|
157
|
-
# @option options [Symbol] type - The type of data validation.
|
|
158
|
-
def initialize(options={})
|
|
159
|
-
# defaults
|
|
160
|
-
@formula1 = @formula2 = @error = @errorTitle = @operator = @prompt = @promptTitle = @sqref = nil
|
|
161
|
-
@allowBlank = @showErrorMessage = true
|
|
162
|
-
@showDropDown = @showInputMessage = false
|
|
163
|
-
@type = :none
|
|
164
|
-
@errorStyle = :stop
|
|
165
|
-
|
|
166
|
-
options.each do |o|
|
|
167
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
168
|
+
|
|
169
|
+
|
|
171
170
|
# @see formula1
|
|
172
171
|
def formula1=(v); Axlsx::validate_string(v); @formula1 = v end
|
|
173
|
-
|
|
172
|
+
|
|
174
173
|
# @see formula2
|
|
175
174
|
def formula2=(v); Axlsx::validate_string(v); @formula2 = v end
|
|
176
|
-
|
|
175
|
+
|
|
177
176
|
# @see allowBlank
|
|
178
177
|
def allowBlank=(v); Axlsx::validate_boolean(v); @allowBlank = v end
|
|
179
|
-
|
|
178
|
+
|
|
180
179
|
# @see error
|
|
181
180
|
def error=(v); Axlsx::validate_string(v); @error = v end
|
|
182
|
-
|
|
181
|
+
|
|
183
182
|
# @see errorStyle
|
|
184
183
|
def errorStyle=(v); Axlsx::validate_data_validation_error_style(v); @errorStyle = v end
|
|
185
|
-
|
|
184
|
+
|
|
186
185
|
# @see errorTitle
|
|
187
186
|
def errorTitle=(v); Axlsx::validate_string(v); @errorTitle = v end
|
|
188
|
-
|
|
187
|
+
|
|
189
188
|
# @see operator
|
|
190
189
|
def operator=(v); Axlsx::validate_data_validation_operator(v); @operator = v end
|
|
191
|
-
|
|
190
|
+
|
|
192
191
|
# @see prompt
|
|
193
192
|
def prompt=(v); Axlsx::validate_string(v); @prompt = v end
|
|
194
|
-
|
|
193
|
+
|
|
195
194
|
# @see promptTitle
|
|
196
195
|
def promptTitle=(v); Axlsx::validate_string(v); @promptTitle = v end
|
|
197
|
-
|
|
196
|
+
|
|
198
197
|
# @see showDropDown
|
|
199
198
|
def showDropDown=(v); Axlsx::validate_boolean(v); @showDropDown = v end
|
|
200
|
-
|
|
199
|
+
|
|
201
200
|
# @see showErrorMessage
|
|
202
201
|
def showErrorMessage=(v); Axlsx::validate_boolean(v); @showErrorMessage = v end
|
|
203
|
-
|
|
202
|
+
|
|
204
203
|
# @see showInputMessage
|
|
205
204
|
def showInputMessage=(v); Axlsx::validate_boolean(v); @showInputMessage = v end
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
# @see sqref
|
|
208
207
|
def sqref=(v); Axlsx::validate_string(v); @sqref = v end
|
|
209
|
-
|
|
208
|
+
|
|
210
209
|
# @see type
|
|
211
210
|
def type=(v); Axlsx::validate_data_validation_type(v); @type = v end
|
|
212
|
-
|
|
211
|
+
|
|
213
212
|
# Serializes the data validation
|
|
214
213
|
# @param [String] str
|
|
215
214
|
# @return [String]
|
|
216
215
|
def to_xml_string(str = '')
|
|
217
216
|
valid_attributes = get_valid_attributes
|
|
218
|
-
|
|
217
|
+
|
|
219
218
|
str << '<dataValidation '
|
|
220
219
|
str << instance_values.map { |key, value| '' << key << '="' << value.to_s << '"' if (valid_attributes.include?(key.to_sym) and not CHILD_ELEMENTS.include?(key.to_sym)) }.join(' ')
|
|
221
220
|
str << '>'
|
|
@@ -223,11 +222,11 @@ module Axlsx
|
|
|
223
222
|
str << '<formula2>' << self.formula2 << '</formula2>' if @formula2 and valid_attributes.include?(:formula2)
|
|
224
223
|
str << '</dataValidation>'
|
|
225
224
|
end
|
|
226
|
-
|
|
225
|
+
|
|
227
226
|
private
|
|
228
227
|
def get_valid_attributes
|
|
229
228
|
attributes = [:allowBlank, :error, :errorStyle, :errorTitle, :prompt, :promptTitle, :showErrorMessage, :showInputMessage, :sqref, :type ]
|
|
230
|
-
|
|
229
|
+
|
|
231
230
|
if [:whole, :decimal, :data, :time, :textLength].include?(@type)
|
|
232
231
|
attributes << [:operator, :formula1]
|
|
233
232
|
attributes << [:formula2] if [:between, :notBetween].include?(@operator)
|
|
@@ -238,7 +237,7 @@ module Axlsx
|
|
|
238
237
|
else
|
|
239
238
|
attributes = []
|
|
240
239
|
end
|
|
241
|
-
|
|
240
|
+
|
|
242
241
|
attributes.flatten!
|
|
243
242
|
end
|
|
244
243
|
end
|
|
@@ -10,7 +10,8 @@ module Axlsx
|
|
|
10
10
|
# @return [Numeric]
|
|
11
11
|
def self.date_to_serial(date)
|
|
12
12
|
epoch = Axlsx::Workbook::date1904 ? Date.new(1904) : Date.new(1899, 12, 30)
|
|
13
|
-
(date
|
|
13
|
+
offset_date = date.respond_to?(:utc_offset) ? date + date.utc_offset.seconds : date
|
|
14
|
+
(offset_date - epoch).to_f
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
# The time_to_serial methond converts a Time object its excel serialized form.
|
|
@@ -19,11 +20,11 @@ module Axlsx
|
|
|
19
20
|
def self.time_to_serial(time)
|
|
20
21
|
# Using hardcoded offsets here as some operating systems will not except
|
|
21
22
|
# a 'negative' offset from the ruby epoch.
|
|
22
|
-
epoch1900 = -2209161600 # Time.utc(1899, 12, 30).to_i
|
|
23
|
-
epoch1904 = -2082844800 # Time.utc(1904, 1, 1).to_i
|
|
24
|
-
seconds_per_day = 86400 # 60*60*24
|
|
23
|
+
epoch1900 = -2209161600.0 # Time.utc(1899, 12, 30).to_i
|
|
24
|
+
epoch1904 = -2082844800.0 # Time.utc(1904, 1, 1).to_i
|
|
25
|
+
seconds_per_day = 86400.0 # 60*60*24
|
|
25
26
|
epoch = Axlsx::Workbook::date1904 ? epoch1904 : epoch1900
|
|
26
|
-
(time.to_f - epoch)/seconds_per_day
|
|
27
|
+
(time.utc_offset + time.to_f - epoch)/seconds_per_day
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Axlsx
|
|
2
|
+
# Header/Footer options for printing a worksheet. All settings are optional.
|
|
3
|
+
#
|
|
4
|
+
# Headers and footers are generated using a string which is a combination
|
|
5
|
+
# of plain text and control characters. A fairly comprehensive list of control
|
|
6
|
+
# characters can be found here:
|
|
7
|
+
# https://github.com/randym/axlsx/blob/master/notes_on_header_footer.md
|
|
8
|
+
#
|
|
9
|
+
# @note The recommended way of managing header/footers is via Worksheet#header_footer
|
|
10
|
+
# @see Worksheet#initialize
|
|
11
|
+
class HeaderFooter
|
|
12
|
+
|
|
13
|
+
include Axlsx::OptionsParser
|
|
14
|
+
include Axlsx::SerializedAttributes
|
|
15
|
+
include Axlsx::Accessors
|
|
16
|
+
|
|
17
|
+
# Creates a new HeaderFooter object
|
|
18
|
+
# @option options [String] odd_header The content for headers on odd numbered pages.
|
|
19
|
+
# @option options [String] odd_footer The content for footers on odd numbered pages.
|
|
20
|
+
# @option options [String] even_header The content for headers on even numbered pages.
|
|
21
|
+
# @option options [String] even_footer The content for footers on even numbered pages.
|
|
22
|
+
# @option options [String] first_header The content for headers on even numbered pages.
|
|
23
|
+
# @option options [String] first_footer The content for footers on even numbered pages.
|
|
24
|
+
# @option options [Boolean] different_odd_even Setting this to true will show different headers/footers on odd and even pages. When false, the odd headers/footers are used on each page. (Default: false)
|
|
25
|
+
# @option options [Boolean] different_first If true, will use the first header/footer on page 1. Otherwise, the odd header/footer is used.
|
|
26
|
+
def initialize(options = {})
|
|
27
|
+
parse_options options
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
serializable_attributes :different_odd_even, :different_first
|
|
31
|
+
serializable_element_attributes :odd_header, :odd_footer, :even_header, :even_footer, :first_header, :first_footer
|
|
32
|
+
string_attr_accessor :odd_header, :odd_footer, :even_header, :even_footer, :first_header, :first_footer
|
|
33
|
+
boolean_attr_accessor :different_odd_even, :different_first
|
|
34
|
+
|
|
35
|
+
# Set some or all header/footers at once.
|
|
36
|
+
# @param [Hash] options The header/footer options to set (possible keys are :odd_header, :odd_footer, :even_header, :even_footer, :first_header, :first_footer, :different_odd_even, and :different_first).
|
|
37
|
+
def set(options)
|
|
38
|
+
parse_options options
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Serializes the header/footer object.
|
|
42
|
+
# @param [String] str
|
|
43
|
+
# @return [String]
|
|
44
|
+
def to_xml_string(str = '')
|
|
45
|
+
str << "<headerFooter "
|
|
46
|
+
serialized_attributes str
|
|
47
|
+
str << ">"
|
|
48
|
+
serialized_element_attributes(str) do |value|
|
|
49
|
+
value = ::CGI.escapeHTML(value)
|
|
50
|
+
end
|
|
51
|
+
str << "</headerFooter>"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|