axlsx 1.0.15 → 1.1.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.
- data/.yardopts +1 -0
- data/CHANGELOG.md +40 -2
- data/README.md +223 -92
- data/examples/example.csv +1000 -0
- data/examples/example.rb +266 -132
- 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/content_type/content_type.rb +13 -12
- data/lib/axlsx/content_type/default.rb +10 -6
- data/lib/axlsx/content_type/override.rb +13 -8
- data/lib/axlsx/doc_props/app.rb +38 -41
- data/lib/axlsx/doc_props/core.rb +13 -17
- data/lib/axlsx/drawing/axis.rb +39 -19
- data/lib/axlsx/drawing/bar_3D_chart.rb +34 -32
- data/lib/axlsx/drawing/bar_series.rb +14 -14
- data/lib/axlsx/drawing/cat_axis.rb +16 -14
- data/lib/axlsx/drawing/cat_axis_data.rb +17 -18
- data/lib/axlsx/drawing/chart.rb +40 -41
- data/lib/axlsx/drawing/drawing.rb +27 -12
- data/lib/axlsx/drawing/graphic_frame.rb +22 -21
- data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
- data/lib/axlsx/drawing/hyperlink.rb +96 -0
- data/lib/axlsx/drawing/hyperlink.rb~ +64 -0
- data/lib/axlsx/drawing/line_3D_chart.rb +31 -28
- data/lib/axlsx/drawing/line_series.rb +12 -11
- data/lib/axlsx/drawing/marker.rb +11 -8
- data/lib/axlsx/drawing/named_axis_data.rb +36 -0
- data/lib/axlsx/drawing/one_cell_anchor.rb +18 -16
- data/lib/axlsx/drawing/pic.rb +47 -33
- data/lib/axlsx/drawing/picture_locking.rb +22 -18
- data/lib/axlsx/drawing/pie_3D_chart.rb +11 -8
- data/lib/axlsx/drawing/pie_series.rb +16 -12
- data/lib/axlsx/drawing/scaling.rb +11 -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 +11 -10
- data/lib/axlsx/drawing/series.rb +16 -15
- data/lib/axlsx/drawing/series_title.rb +15 -14
- data/lib/axlsx/drawing/title.rb +27 -26
- data/lib/axlsx/drawing/two_cell_anchor.rb +19 -20
- data/lib/axlsx/drawing/val_axis.rb +9 -7
- data/lib/axlsx/drawing/val_axis_data.rb +18 -17
- data/lib/axlsx/drawing/view_3D.rb +23 -20
- data/lib/axlsx/package.rb +117 -52
- data/lib/axlsx/rels/relationship.rb +27 -8
- data/lib/axlsx/rels/relationships.rb +9 -2
- data/lib/axlsx/stylesheet/#num_fmt.rb# +69 -0
- data/lib/axlsx/stylesheet/border.rb +28 -23
- data/lib/axlsx/stylesheet/border_pr.rb +17 -15
- data/lib/axlsx/stylesheet/cell_alignment.rb +24 -21
- data/lib/axlsx/stylesheet/cell_protection.rb +11 -7
- data/lib/axlsx/stylesheet/cell_style.rb +9 -5
- data/lib/axlsx/stylesheet/color.rb +21 -14
- data/lib/axlsx/stylesheet/fill.rb +8 -5
- data/lib/axlsx/stylesheet/font.rb +22 -14
- data/lib/axlsx/stylesheet/gradient_fill.rb +20 -17
- data/lib/axlsx/stylesheet/gradient_stop.rb +10 -6
- data/lib/axlsx/stylesheet/num_fmt.rb +13 -6
- data/lib/axlsx/stylesheet/pattern_fill.rb +26 -10
- data/lib/axlsx/stylesheet/styles.rb +53 -41
- data/lib/axlsx/stylesheet/table_style.rb +10 -4
- data/lib/axlsx/stylesheet/table_style_element.rb +11 -7
- data/lib/axlsx/stylesheet/table_styles.rb +12 -8
- data/lib/axlsx/stylesheet/xf.rb +30 -25
- data/lib/axlsx/util/cbf.rb +69 -33
- data/lib/axlsx/util/constants.rb +39 -20
- data/lib/axlsx/util/ms_off_crypto.rb +10 -10
- data/lib/axlsx/util/parser.rb +1 -0
- data/lib/axlsx/util/simple_typed_list.rb +20 -10
- data/lib/axlsx/util/storage.rb +1 -1
- data/lib/axlsx/util/validators.rb +23 -7
- data/lib/axlsx/version.rb +5 -2
- data/lib/axlsx/workbook/shared_strings_table.rb +69 -0
- data/lib/axlsx/workbook/shared_strings_table.rb~ +69 -0
- data/lib/axlsx/workbook/workbook.rb +82 -26
- data/lib/axlsx/workbook/worksheet/cell.rb +172 -117
- data/lib/axlsx/workbook/worksheet/col.rb +114 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/date_time_converter.rb +29 -0
- data/lib/axlsx/workbook/worksheet/page_margins.rb +97 -0
- data/lib/axlsx/workbook/worksheet/row.rb +53 -21
- data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
- 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 +270 -121
- data/lib/axlsx.rb +41 -14
- 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 +31 -31
- data/test/content_type/tc_default.rb +9 -22
- data/test/content_type/tc_override.rb +8 -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 +13 -14
- data/test/drawing/tc_drawing.rb +7 -8
- data/test/drawing/tc_graphic_frame.rb +3 -4
- data/test/drawing/tc_hyperlink.rb +69 -0
- 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 +13 -8
- 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 +10 -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 +10 -6
- 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 +12 -5
- 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 +16 -6
- 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 +43 -9
- 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 +38 -0
- data/test/workbook/tc_workbook.rb +32 -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 +70 -13
- 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 +126 -0
- data/test/workbook/worksheet/tc_page_margins.rb +97 -0
- data/test/workbook/worksheet/tc_row.rb +54 -4
- data/test/workbook/worksheet/tc_worksheet.rb +198 -31
- metadata +167 -111
- data/test/drawing/tc_line_series.tc~ +0 -34
- data/test/drawing/tc_picture_locking.rb~ +0 -77
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
3
|
# A GradientFill defines the color and positioning for gradiant cell fill.
|
|
4
|
-
# @see Open Office XML Part 1 §18.8.24
|
|
4
|
+
# @see Open Office XML Part 1 §18.8.24
|
|
5
5
|
class GradientFill
|
|
6
6
|
|
|
7
7
|
# The type of gradient.
|
|
8
|
-
# @note
|
|
8
|
+
# @note
|
|
9
9
|
# valid options are
|
|
10
10
|
# :linear
|
|
11
11
|
# :path
|
|
@@ -26,7 +26,7 @@ module Axlsx
|
|
|
26
26
|
|
|
27
27
|
# Percentage format top
|
|
28
28
|
# @return [Float]
|
|
29
|
-
attr_reader :top
|
|
29
|
+
attr_reader :top
|
|
30
30
|
|
|
31
31
|
# Percentage format bottom
|
|
32
32
|
# @return [Float]
|
|
@@ -35,7 +35,7 @@ module Axlsx
|
|
|
35
35
|
# Collection of stop objects
|
|
36
36
|
# @return [SimpleTypedList]
|
|
37
37
|
attr_reader :stop
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
# Creates a new GradientFill object
|
|
40
40
|
# @option options [Symbol] type
|
|
41
41
|
# @option options [Float] degree
|
|
@@ -52,25 +52,28 @@ module Axlsx
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# @see type
|
|
55
|
-
def type=(v) Axlsx::validate_gradient_type v; @type = v end
|
|
55
|
+
def type=(v) Axlsx::validate_gradient_type v; @type = v end
|
|
56
56
|
# @see degree
|
|
57
|
-
def degree=(v) Axlsx::validate_float v; @degree = v end
|
|
57
|
+
def degree=(v) Axlsx::validate_float v; @degree = v end
|
|
58
58
|
# @see left
|
|
59
|
-
def left=(v) DataTypeValidator.validate "GradientFill.left", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @left = v end
|
|
59
|
+
def left=(v) DataTypeValidator.validate "GradientFill.left", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @left = v end
|
|
60
60
|
# @see right
|
|
61
|
-
def right=(v) DataTypeValidator.validate "GradientFill.right", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @right = v end
|
|
61
|
+
def right=(v) DataTypeValidator.validate "GradientFill.right", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @right = v end
|
|
62
62
|
# @see top
|
|
63
|
-
def top=(v) DataTypeValidator.validate "GradientFill.top", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @top = v end
|
|
63
|
+
def top=(v) DataTypeValidator.validate "GradientFill.top", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @top = v end
|
|
64
64
|
# @see bottom
|
|
65
|
-
def bottom=(v) DataTypeValidator.validate "GradientFill.bottom", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @bottom= v end
|
|
65
|
+
def bottom=(v) DataTypeValidator.validate "GradientFill.bottom", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @bottom= v end
|
|
66
66
|
|
|
67
|
-
# Serializes the
|
|
68
|
-
# @param [
|
|
67
|
+
# Serializes the object
|
|
68
|
+
# @param [String] str
|
|
69
69
|
# @return [String]
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
70
|
+
def to_xml_string(str = '')
|
|
71
|
+
str << '<gradientFill'
|
|
72
|
+
h = self.instance_values.reject { |k,v| k.to_sym == :stop }
|
|
73
|
+
str << h.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
74
|
+
str << '>'
|
|
75
|
+
@stop.each { |s| s.to_xml_string(str) }
|
|
76
|
+
str << '</gradientFill>'
|
|
74
77
|
end
|
|
75
78
|
end
|
|
76
79
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
3
|
# The GradientStop object represents a color point in a gradient.
|
|
4
|
-
# @see Open Office XML Part 1 §18.8.24
|
|
4
|
+
# @see Open Office XML Part 1 §18.8.24
|
|
5
5
|
class GradientStop
|
|
6
6
|
# The color for this gradient stop
|
|
7
7
|
# @return [Color]
|
|
@@ -23,11 +23,15 @@ module Axlsx
|
|
|
23
23
|
# @see color
|
|
24
24
|
def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color=v end
|
|
25
25
|
# @see position
|
|
26
|
-
def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end
|
|
26
|
+
def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end
|
|
27
27
|
|
|
28
|
-
# Serializes the
|
|
29
|
-
# @param [
|
|
28
|
+
# Serializes the object
|
|
29
|
+
# @param [String] str
|
|
30
30
|
# @return [String]
|
|
31
|
-
def
|
|
31
|
+
def to_xml_string(str = '')
|
|
32
|
+
str << '<stop position="' << position.to_s << '">'
|
|
33
|
+
self.color.to_xml_string(str)
|
|
34
|
+
str << '</stop>'
|
|
35
|
+
end
|
|
32
36
|
end
|
|
33
37
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
|
-
# A NumFmt object defines an identifier and formatting code for data in cells.
|
|
3
|
+
# A NumFmt object defines an identifier and formatting code for data in cells.
|
|
3
4
|
# @note The recommended way to manage styles is Styles#add_style
|
|
4
5
|
class NumFmt
|
|
5
6
|
# @return [Integer] An unsinged integer referencing a standard or custom number format.
|
|
6
7
|
# @note
|
|
7
|
-
# These are the known formats I can dig up. The constant NUM_FMT_PERCENT is 9, and uses the default % formatting. Axlsx also defines a few formats for date and time that are commonly used in asia as NUM_FMT_YYYYMMDD and NUM_FRM_YYYYMMDDHHMMSS.
|
|
8
|
+
# These are the known formats I can dig up. The constant NUM_FMT_PERCENT is 9, and uses the default % formatting. Axlsx also defines a few formats for date and time that are commonly used in asia as NUM_FMT_YYYYMMDD and NUM_FRM_YYYYMMDDHHMMSS.
|
|
8
9
|
# 1 0
|
|
9
10
|
# 2 0.00
|
|
10
11
|
# 3 #,##0
|
|
@@ -39,7 +40,7 @@ module Axlsx
|
|
|
39
40
|
# @see Axlsx
|
|
40
41
|
attr_reader :numFmtId
|
|
41
42
|
|
|
42
|
-
# @return [String] The formatting to use for this number format.
|
|
43
|
+
# @return [String] The formatting to use for this number format.
|
|
43
44
|
# @see http://support.microsoft.com/kb/264372
|
|
44
45
|
attr_reader :formatCode
|
|
45
46
|
def initialize(options={})
|
|
@@ -55,9 +56,15 @@ module Axlsx
|
|
|
55
56
|
# @see formatCode
|
|
56
57
|
def formatCode=(v) Axlsx::validate_string v; @formatCode = v end
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
#
|
|
60
|
-
|
|
59
|
+
|
|
60
|
+
# Serializes the object
|
|
61
|
+
# @param [String] str
|
|
62
|
+
# @return [String]
|
|
63
|
+
def to_xml_string(str = '')
|
|
64
|
+
str << '<numFmt '
|
|
65
|
+
str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
66
|
+
str << '/>'
|
|
67
|
+
end
|
|
61
68
|
|
|
62
69
|
end
|
|
63
70
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
3
|
# A PatternFill is the pattern and solid fill styling for a cell.
|
|
3
4
|
# @note The recommended way to manage styles is with Styles#add_style
|
|
@@ -6,15 +7,15 @@ module Axlsx
|
|
|
6
7
|
|
|
7
8
|
# The color to use for the the background in solid fills.
|
|
8
9
|
# @return [Color]
|
|
9
|
-
attr_reader :fgColor
|
|
10
|
+
attr_reader :fgColor
|
|
10
11
|
|
|
11
12
|
# The color to use for the background of the fill when the type is not solid.
|
|
12
13
|
# @return [Color]
|
|
13
14
|
attr_reader :bgColor
|
|
14
15
|
|
|
15
16
|
# The pattern type to use
|
|
16
|
-
# @note
|
|
17
|
-
# patternType must be one of
|
|
17
|
+
# @note
|
|
18
|
+
# patternType must be one of
|
|
18
19
|
# :none
|
|
19
20
|
# :solid
|
|
20
21
|
# :mediumGray
|
|
@@ -52,15 +53,30 @@ module Axlsx
|
|
|
52
53
|
# @see bgColor
|
|
53
54
|
def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end
|
|
54
55
|
# @see patternType
|
|
55
|
-
def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end
|
|
56
|
+
def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end
|
|
56
57
|
|
|
57
|
-
# Serializes the
|
|
58
|
-
# @param [
|
|
58
|
+
# Serializes the object
|
|
59
|
+
# @param [String] str
|
|
59
60
|
# @return [String]
|
|
60
|
-
def
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
def to_xml_string(str = '')
|
|
62
|
+
str << '<patternFill patternType="' << patternType.to_s << '">'
|
|
63
|
+
if fgColor.is_a?(Color)
|
|
64
|
+
str << "<fgColor "
|
|
65
|
+
fgColor.instance_values.each do |key, value|
|
|
66
|
+
str << key.to_s << '="' << value.to_s << '" '
|
|
67
|
+
end
|
|
68
|
+
str << "/>"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if bgColor.is_a?(Color)
|
|
72
|
+
str << "<bgColor "
|
|
73
|
+
bgColor.instance_values.each do |key, value|
|
|
74
|
+
str << key.to_s << '="' << value.to_s << '" '
|
|
75
|
+
end
|
|
76
|
+
str << "/>"
|
|
77
|
+
end
|
|
78
|
+
str << '</patternFill>'
|
|
64
79
|
end
|
|
80
|
+
|
|
65
81
|
end
|
|
66
82
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
3
|
require 'axlsx/stylesheet/border.rb'
|
|
4
4
|
require 'axlsx/stylesheet/border_pr.rb'
|
|
@@ -120,25 +120,26 @@ module Axlsx
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
# Drastically simplifies style creation and management.
|
|
123
|
-
# @return [Integer]
|
|
123
|
+
# @return [Integer]
|
|
124
124
|
# @option options [String] fg_color The text color
|
|
125
125
|
# @option options [Integer] sz The text size
|
|
126
126
|
# @option options [Boolean] b Indicates if the text should be bold
|
|
127
127
|
# @option options [Boolean] i Indicates if the text should be italicised
|
|
128
|
+
# @option options [Boolean] u Indicates if the text should be underlined
|
|
128
129
|
# @option options [Boolean] strike Indicates if the text should be rendered with a strikethrough
|
|
129
130
|
# @option options [Boolean] strike Indicates if the text should be rendered with a shadow
|
|
130
131
|
# @option options [Integer] charset The character set to use.
|
|
131
132
|
# @option options [Integer] family The font family to use.
|
|
132
|
-
# @option options [String]
|
|
133
|
+
# @option options [String] font_name The name of the font to use
|
|
133
134
|
# @option options [Integer] num_fmt The number format to apply
|
|
134
135
|
# @option options [String] format_code The formatting to apply. If this is specified, num_fmt is ignored.
|
|
135
|
-
# @option options [Integer] border The border style to use.
|
|
136
|
+
# @option options [Integer] border The border style to use.
|
|
136
137
|
# @option options [String] bg_color The background color to apply to the cell
|
|
137
138
|
# @option options [Boolean] hidden Indicates if the cell should be hidden
|
|
138
139
|
# @option options [Boolean] locked Indicates if the cell should be locked
|
|
139
140
|
# @option options [Hash] alignment A hash defining any of the attributes used in CellAlignment
|
|
140
141
|
# @see CellAlignment
|
|
141
|
-
#
|
|
142
|
+
#
|
|
142
143
|
# @example You Got Style
|
|
143
144
|
# require "rubygems" # if that is your preferred way to manage gems!
|
|
144
145
|
# require "axlsx"
|
|
@@ -147,7 +148,7 @@ module Axlsx
|
|
|
147
148
|
# ws = p.workbook.add_worksheet
|
|
148
149
|
#
|
|
149
150
|
# # black text on a white background at 14pt with thin borders!
|
|
150
|
-
# title = ws.style.add_style(:bg_color => "FFFF0000", :fg_color=>"#FF000000", :sz=>14, :border=>
|
|
151
|
+
# title = ws.style.add_style(:bg_color => "FFFF0000", :fg_color=>"#FF000000", :sz=>14, :border=> {:style => :thin, :color => "FFFF0000"}
|
|
151
152
|
#
|
|
152
153
|
# ws.add_row :values => ["Least Popular Pets"]
|
|
153
154
|
# ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"], :style=>title
|
|
@@ -164,15 +165,15 @@ module Axlsx
|
|
|
164
165
|
# ws = p.workbook.add_worksheet
|
|
165
166
|
#
|
|
166
167
|
# # define your styles
|
|
167
|
-
# title = ws.style.add_style(:bg_color => "FFFF0000",
|
|
168
|
+
# title = ws.style.add_style(:bg_color => "FFFF0000",
|
|
168
169
|
# :fg_color=>"#FF000000",
|
|
169
|
-
# :border=>Axlsx::STYLE_THIN_BORDER,
|
|
170
|
+
# :border=>Axlsx::STYLE_THIN_BORDER,
|
|
170
171
|
# :alignment=>{:horizontal => :center})
|
|
171
172
|
#
|
|
172
173
|
# date_time = ws.style.add_style(:num_fmt => Axlsx::NUM_FMT_YYYYMMDDHHMMSS,
|
|
173
174
|
# :border=>Axlsx::STYLE_THIN_BORDER)
|
|
174
175
|
#
|
|
175
|
-
# percent = ws.style.add_style(:num_fmt => Axlsx::NUM_FMT_PERCENT,
|
|
176
|
+
# percent = ws.style.add_style(:num_fmt => Axlsx::NUM_FMT_PERCENT,
|
|
176
177
|
# :border=>Axlsx::STYLE_THIN_BORDER)
|
|
177
178
|
#
|
|
178
179
|
# currency = ws.style.add_style(:format_code=>"¥#,##0;[Red]¥-#,##0",
|
|
@@ -189,7 +190,7 @@ module Axlsx
|
|
|
189
190
|
# f = File.open('example_you_got_style.xlsx', 'w')
|
|
190
191
|
# p.serialize(f)
|
|
191
192
|
def add_style(options={})
|
|
192
|
-
|
|
193
|
+
|
|
193
194
|
numFmtId = if options[:format_code]
|
|
194
195
|
n = @numFmts.map{ |f| f.numFmtId }.max + 1
|
|
195
196
|
numFmts << NumFmt.new(:numFmtId => n, :formatCode=> options[:format_code])
|
|
@@ -197,82 +198,93 @@ module Axlsx
|
|
|
197
198
|
else
|
|
198
199
|
options[:num_fmt] || 0
|
|
199
200
|
end
|
|
200
|
-
|
|
201
|
+
|
|
201
202
|
borderId = options[:border] || 0
|
|
203
|
+
|
|
204
|
+
if borderId.is_a?(Hash)
|
|
205
|
+
raise ArgumentError, "border hash definitions must include both style and color" unless borderId.keys.include?(:style) && borderId.keys.include?(:color)
|
|
206
|
+
|
|
207
|
+
s = borderId.delete :style
|
|
208
|
+
c = borderId.delete :color
|
|
209
|
+
border = Border.new
|
|
210
|
+
[:left, :right, :top, :bottom].each {|pr| border.prs << BorderPr.new(:name => pr, :style=>s, :color => Color.new(:rgb => c))}
|
|
211
|
+
borderId = self.borders << border
|
|
212
|
+
end
|
|
213
|
+
|
|
202
214
|
raise ArgumentError, "Invalid borderId" unless borderId < borders.size
|
|
203
|
-
|
|
215
|
+
|
|
204
216
|
fill = if options[:bg_color]
|
|
205
217
|
color = Color.new(:rgb=>options[:bg_color])
|
|
206
218
|
pattern = PatternFill.new(:patternType =>:solid, :fgColor=>color)
|
|
207
|
-
fills << Fill.new(pattern)
|
|
219
|
+
fills << Fill.new(pattern)
|
|
208
220
|
else
|
|
209
221
|
0
|
|
210
222
|
end
|
|
211
|
-
|
|
212
|
-
fontId = if (options.values_at(:fg_color, :sz, :b, :i, :strike, :outline, :shadow, :charset, :family, :font_name).length)
|
|
223
|
+
|
|
224
|
+
fontId = if (options.values_at(:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name).length)
|
|
213
225
|
font = Font.new()
|
|
214
|
-
[:b, :i, :strike, :outline, :shadow, :charset, :family, :sz].each { |k| font.send("#{k}=", options[k]) unless options[k].nil? }
|
|
226
|
+
[:b, :i, :u, :strike, :outline, :shadow, :charset, :family, :sz].each { |k| font.send("#{k}=", options[k]) unless options[k].nil? }
|
|
215
227
|
font.color = Color.new(:rgb => options[:fg_color]) unless options[:fg_color].nil?
|
|
216
228
|
font.name = options[:font_name] unless options[:font_name].nil?
|
|
217
229
|
fonts << font
|
|
218
230
|
else
|
|
219
|
-
0
|
|
231
|
+
0
|
|
220
232
|
end
|
|
221
|
-
|
|
233
|
+
|
|
222
234
|
applyProtection = (options[:hidden] || options[:locked]) ? 1 : 0
|
|
223
|
-
|
|
235
|
+
|
|
224
236
|
xf = Xf.new(:fillId => fill, :fontId=>fontId, :applyFill=>1, :applyFont=>1, :numFmtId=>numFmtId, :borderId=>borderId, :applyProtection=>applyProtection)
|
|
225
237
|
|
|
226
238
|
xf.applyNumberFormat = true if xf.numFmtId > 0
|
|
227
|
-
|
|
239
|
+
xf.applyBorder = true if borderId > 0
|
|
240
|
+
|
|
228
241
|
if options[:alignment]
|
|
229
242
|
xf.alignment = CellAlignment.new(options[:alignment])
|
|
243
|
+
xf.applyAlignment = true
|
|
230
244
|
end
|
|
231
|
-
|
|
245
|
+
|
|
232
246
|
if applyProtection
|
|
233
247
|
xf.protection = CellProtection.new(options)
|
|
234
248
|
end
|
|
235
|
-
|
|
249
|
+
|
|
236
250
|
cellXfs << xf
|
|
237
251
|
end
|
|
238
|
-
|
|
239
|
-
# Serializes the
|
|
252
|
+
|
|
253
|
+
# Serializes the object
|
|
254
|
+
# @param [String] str
|
|
240
255
|
# @return [String]
|
|
241
|
-
def
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
self.instance_values[key.to_s].to_xml(xml) unless self.instance_values[key.to_s].nil?
|
|
246
|
-
end
|
|
247
|
-
}
|
|
256
|
+
def to_xml_string(str = '')
|
|
257
|
+
str << '<styleSheet xmlns="' << XML_NS << '">'
|
|
258
|
+
[:numFmts, :fonts, :fills, :borders, :cellStyleXfs, :cellXfs, :cellStyles, :dxfs, :tableStyles].each do |key|
|
|
259
|
+
self.instance_values[key.to_s].to_xml_string(str) unless self.instance_values[key.to_s].nil?
|
|
248
260
|
end
|
|
249
|
-
|
|
261
|
+
str << '</styleSheet>'
|
|
250
262
|
end
|
|
251
263
|
|
|
252
264
|
private
|
|
253
|
-
# Creates the default set of styles the exel requires to be valid as well as setting up the
|
|
265
|
+
# Creates the default set of styles the exel requires to be valid as well as setting up the
|
|
254
266
|
# Axlsx::STYLE_THIN_BORDER
|
|
255
267
|
def load_default_styles
|
|
256
|
-
@numFmts = SimpleTypedList.new NumFmt
|
|
268
|
+
@numFmts = SimpleTypedList.new NumFmt, 'numFmts'
|
|
257
269
|
@numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDD, :formatCode=> "yyyy/mm/dd")
|
|
258
270
|
@numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDDHHMMSS, :formatCode=> "yyyy/mm/dd hh:mm:ss")
|
|
259
271
|
|
|
260
272
|
@numFmts.lock
|
|
261
273
|
|
|
262
|
-
@fonts = SimpleTypedList.new Font
|
|
274
|
+
@fonts = SimpleTypedList.new Font, 'fonts'
|
|
263
275
|
@fonts << Font.new(:name => "Arial", :sz => 11, :family=>1)
|
|
264
276
|
@fonts.lock
|
|
265
277
|
|
|
266
|
-
@fills = SimpleTypedList.new Fill
|
|
278
|
+
@fills = SimpleTypedList.new Fill, 'fills'
|
|
267
279
|
@fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:none))
|
|
268
280
|
@fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:gray125))
|
|
269
281
|
@fills.lock
|
|
270
282
|
|
|
271
|
-
@borders = SimpleTypedList.new Border
|
|
283
|
+
@borders = SimpleTypedList.new Border, 'borders'
|
|
272
284
|
@borders << Border.new
|
|
273
285
|
black_border = Border.new
|
|
274
|
-
[:left, :right, :top, :bottom].each do |item|
|
|
275
|
-
black_border.prs << BorderPr.new(:name=>item, :style=>:thin, :color=>Color.new(:rgb=>"FF000000"))
|
|
286
|
+
[:left, :right, :top, :bottom].each do |item|
|
|
287
|
+
black_border.prs << BorderPr.new(:name=>item, :style=>:thin, :color=>Color.new(:rgb=>"FF000000"))
|
|
276
288
|
end
|
|
277
289
|
@borders << black_border
|
|
278
290
|
@borders.lock
|
|
@@ -281,7 +293,7 @@ module Axlsx
|
|
|
281
293
|
@cellStyleXfs << Xf.new(:borderId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0)
|
|
282
294
|
@cellStyleXfs.lock
|
|
283
295
|
|
|
284
|
-
@cellStyles = SimpleTypedList.new CellStyle
|
|
296
|
+
@cellStyles = SimpleTypedList.new CellStyle, 'cellStyles'
|
|
285
297
|
@cellStyles << CellStyle.new(:name =>"Normal", :builtinId =>0, :xfId=>0)
|
|
286
298
|
@cellStyles.lock
|
|
287
299
|
|
|
@@ -297,4 +309,4 @@ module Axlsx
|
|
|
297
309
|
end
|
|
298
310
|
end
|
|
299
311
|
end
|
|
300
|
-
|
|
312
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
3
|
# A single table style definition and is a collection for tableStyleElements
|
|
3
4
|
# @note Table are not supported in this version and only the defaults required for a valid workbook are created.
|
|
@@ -35,13 +36,18 @@ module Axlsx
|
|
|
35
36
|
# @see table
|
|
36
37
|
def table=(v) Axlsx::validate_boolean v; @table=v end
|
|
37
38
|
|
|
38
|
-
# Serializes the
|
|
39
|
-
# @param [
|
|
39
|
+
# Serializes the object
|
|
40
|
+
# @param [String] str
|
|
40
41
|
# @return [String]
|
|
41
|
-
def
|
|
42
|
+
def to_xml_string(str = '')
|
|
42
43
|
attr = self.instance_values.select { |k, v| [:name, :pivot, :table].include? k }
|
|
43
44
|
attr[:count] = self.size
|
|
44
|
-
|
|
45
|
+
str << '<tableStyle '
|
|
46
|
+
str << attr.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
47
|
+
str << '>'
|
|
48
|
+
each { |table_style_el| table_style_el.to_xml_string(str) }
|
|
49
|
+
str << '</tableStyle>'
|
|
45
50
|
end
|
|
51
|
+
|
|
46
52
|
end
|
|
47
53
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
|
-
# an element of style that belongs to a table style.
|
|
3
|
-
# @note tables and table styles are not supported in this version. This class exists in preparation for that support.
|
|
3
|
+
# an element of style that belongs to a table style.
|
|
4
|
+
# @note tables and table styles are not supported in this version. This class exists in preparation for that support.
|
|
4
5
|
class TableStyleElement
|
|
5
6
|
# The type of style element. The following type are allowed
|
|
6
7
|
# :wholeTable
|
|
@@ -38,7 +39,7 @@ module Axlsx
|
|
|
38
39
|
# @return [Integer]
|
|
39
40
|
attr_reader :size
|
|
40
41
|
|
|
41
|
-
# The dxfId this style element points to
|
|
42
|
+
# The dxfId this style element points to
|
|
42
43
|
# @return [Integer]
|
|
43
44
|
attr_reader :dxfId
|
|
44
45
|
|
|
@@ -61,11 +62,14 @@ module Axlsx
|
|
|
61
62
|
# @see dxfId
|
|
62
63
|
def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfId = v end
|
|
63
64
|
|
|
64
|
-
# Serializes the
|
|
65
|
-
# @param [
|
|
65
|
+
# Serializes the object
|
|
66
|
+
# @param [String] str
|
|
66
67
|
# @return [String]
|
|
67
|
-
def
|
|
68
|
-
|
|
68
|
+
def to_xml_string(str = '')
|
|
69
|
+
str << '<tableStyleElement '
|
|
70
|
+
str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
71
|
+
str << '/>'
|
|
69
72
|
end
|
|
73
|
+
|
|
70
74
|
end
|
|
71
75
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
3
|
# TableStyles represents a collection of style definitions for table styles and pivot table styles.
|
|
3
4
|
# @note Support for custom table styles does not exist in this version. Many of the classes required are defined in preparation for future release. Please do not attempt to add custom table styles.
|
|
@@ -10,13 +11,13 @@ module Axlsx
|
|
|
10
11
|
# The default pivot table style. The default value is 'PivotStyleLight6'
|
|
11
12
|
# @return [String]
|
|
12
13
|
attr_reader :defaultPivotStyle
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
# Creates a new TableStyles object that is a container for TableStyle objects
|
|
15
16
|
# @option options [String] defaultTableStyle
|
|
16
17
|
# @option options [String] defaultPivotStyle
|
|
17
18
|
def initialize(options={})
|
|
18
19
|
@defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
|
|
19
|
-
@defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
|
|
20
|
+
@defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
|
|
20
21
|
super TableStyle
|
|
21
22
|
end
|
|
22
23
|
# @see defaultTableStyle
|
|
@@ -24,16 +25,19 @@ module Axlsx
|
|
|
24
25
|
# @see defaultPivotStyle
|
|
25
26
|
def defaultPivotStyle=(v) Axlsx::validate_string(v); @defaultPivotStyle = v; end
|
|
26
27
|
|
|
27
|
-
# Serializes the
|
|
28
|
-
# @param [
|
|
28
|
+
# Serializes the object
|
|
29
|
+
# @param [String] str
|
|
29
30
|
# @return [String]
|
|
30
|
-
def
|
|
31
|
+
def to_xml_string(str = '')
|
|
31
32
|
attr = self.instance_values.reject {|k, v| ![:defaultTableStyle, :defaultPivotStyle].include?(k.to_sym) }
|
|
32
33
|
attr[:count] = self.size
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
str << '<tableStyles '
|
|
35
|
+
str << attr.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
36
|
+
str << '>'
|
|
37
|
+
each { |table_style| table_style.to_xml_string(str) }
|
|
38
|
+
str << '</tableStyles>'
|
|
36
39
|
end
|
|
40
|
+
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
end
|
data/lib/axlsx/stylesheet/xf.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
module Axlsx
|
|
2
3
|
# The Xf class defines a formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style
|
|
3
4
|
# @see Styles#add_style
|
|
@@ -21,7 +22,7 @@ module Axlsx
|
|
|
21
22
|
# index (0 based) of the font to be used in this style
|
|
22
23
|
# @return [Integer]
|
|
23
24
|
attr_reader :fontId
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
# index (0 based) of the fill to be used in this style
|
|
26
27
|
# @return [Integer]
|
|
27
28
|
attr_reader :fillId
|
|
@@ -49,7 +50,7 @@ module Axlsx
|
|
|
49
50
|
# indicates if the fontId should be applied
|
|
50
51
|
# @return [Boolean]
|
|
51
52
|
attr_reader :applyFont
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
# indicates if the fillId should be applied
|
|
54
55
|
# @return [Boolean]
|
|
55
56
|
attr_reader :applyFill
|
|
@@ -74,7 +75,7 @@ module Axlsx
|
|
|
74
75
|
# @option options [Integer] xfId
|
|
75
76
|
# @option options [Boolean] quotePrefix
|
|
76
77
|
# @option options [Boolean] pivotButton
|
|
77
|
-
# @option options [Boolean] applyNumberFormat
|
|
78
|
+
# @option options [Boolean] applyNumberFormat
|
|
78
79
|
# @option options [Boolean] applyFont
|
|
79
80
|
# @option options [Boolean] applyFill
|
|
80
81
|
# @option options [Boolean] applyBorder
|
|
@@ -86,8 +87,8 @@ module Axlsx
|
|
|
86
87
|
options.each do |o|
|
|
87
88
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
88
89
|
end
|
|
89
|
-
end
|
|
90
|
-
|
|
90
|
+
end
|
|
91
|
+
|
|
91
92
|
# @see Xf#alignment
|
|
92
93
|
def alignment=(v) DataTypeValidator.validate "Xf.alignment", CellAlignment, v; @alignment = v end
|
|
93
94
|
|
|
@@ -95,44 +96,48 @@ module Axlsx
|
|
|
95
96
|
def protection=(v) DataTypeValidator.validate "Xf.protection", CellProtection, v; @protection = v end
|
|
96
97
|
|
|
97
98
|
# @see numFmtId
|
|
98
|
-
def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end
|
|
99
|
+
def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end
|
|
99
100
|
|
|
100
101
|
# @see fontId
|
|
101
|
-
def fontId=(v) Axlsx::validate_unsigned_int v; @fontId = v end
|
|
102
|
+
def fontId=(v) Axlsx::validate_unsigned_int v; @fontId = v end
|
|
102
103
|
# @see fillId
|
|
103
|
-
def fillId=(v) Axlsx::validate_unsigned_int v; @fillId = v end
|
|
104
|
+
def fillId=(v) Axlsx::validate_unsigned_int v; @fillId = v end
|
|
104
105
|
# @see borderId
|
|
105
|
-
def borderId=(v) Axlsx::validate_unsigned_int v; @borderId = v end
|
|
106
|
+
def borderId=(v) Axlsx::validate_unsigned_int v; @borderId = v end
|
|
106
107
|
# @see xfId
|
|
107
|
-
def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end
|
|
108
|
+
def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end
|
|
108
109
|
# @see quotePrefix
|
|
109
|
-
def quotePrefix=(v) Axlsx::validate_boolean v; @quotePrefix = v end
|
|
110
|
+
def quotePrefix=(v) Axlsx::validate_boolean v; @quotePrefix = v end
|
|
110
111
|
# @see pivotButton
|
|
111
|
-
def pivotButton=(v) Axlsx::validate_boolean v; @pivotButton = v end
|
|
112
|
+
def pivotButton=(v) Axlsx::validate_boolean v; @pivotButton = v end
|
|
112
113
|
# @see applyNumberFormat
|
|
113
|
-
def applyNumberFormat=(v) Axlsx::validate_boolean v; @applyNumberFormat = v end
|
|
114
|
+
def applyNumberFormat=(v) Axlsx::validate_boolean v; @applyNumberFormat = v end
|
|
114
115
|
# @see applyFont
|
|
115
|
-
def applyFont=(v) Axlsx::validate_boolean v; @applyFont = v end
|
|
116
|
+
def applyFont=(v) Axlsx::validate_boolean v; @applyFont = v end
|
|
116
117
|
# @see applyFill
|
|
117
|
-
def applyFill=(v) Axlsx::validate_boolean v; @applyFill = v end
|
|
118
|
+
def applyFill=(v) Axlsx::validate_boolean v; @applyFill = v end
|
|
118
119
|
|
|
119
120
|
# @see applyBorder
|
|
120
|
-
def applyBorder=(v) Axlsx::validate_boolean v; @applyBorder = v end
|
|
121
|
+
def applyBorder=(v) Axlsx::validate_boolean v; @applyBorder = v end
|
|
121
122
|
|
|
122
123
|
# @see applyAlignment
|
|
123
|
-
def applyAlignment=(v) Axlsx::validate_boolean v; @applyAlignment = v end
|
|
124
|
+
def applyAlignment=(v) Axlsx::validate_boolean v; @applyAlignment = v end
|
|
124
125
|
|
|
125
126
|
# @see applyProtection
|
|
126
|
-
def applyProtection=(v) Axlsx::validate_boolean v; @applyProtection = v end
|
|
127
|
+
def applyProtection=(v) Axlsx::validate_boolean v; @applyProtection = v end
|
|
127
128
|
|
|
128
|
-
# Serializes the
|
|
129
|
-
# @param [
|
|
129
|
+
# Serializes the object
|
|
130
|
+
# @param [String] str
|
|
130
131
|
# @return [String]
|
|
131
|
-
def
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
def to_xml_string(str = '')
|
|
133
|
+
str << '<xf '
|
|
134
|
+
h = instance_values.reject { |k, v| [:alignment, :protection, :extList, :name].include? k.to_sym}
|
|
135
|
+
str << h.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
|
|
136
|
+
str << '>'
|
|
137
|
+
alignment.to_xml_string(str) if self.alignment
|
|
138
|
+
protection.to_xml_string(str) if self.protection
|
|
139
|
+
str << '</xf>'
|
|
136
140
|
end
|
|
141
|
+
|
|
137
142
|
end
|
|
138
143
|
end
|