axlsx 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -3
- data/doc/Axlsx.html +150 -6
- data/doc/Axlsx/App.html +1 -1
- data/doc/Axlsx/Axis.html +1 -1
- data/doc/Axlsx/Bar3DChart.html +1 -1
- data/doc/Axlsx/BarSeries.html +1 -1
- data/doc/Axlsx/Border.html +1 -1
- data/doc/Axlsx/BorderPr.html +1 -1
- data/doc/Axlsx/CatAxis.html +1 -1
- data/doc/Axlsx/CatAxisData.html +7 -5
- data/doc/Axlsx/Cell.html +1 -1
- data/doc/Axlsx/CellAlignment.html +1 -1
- data/doc/Axlsx/CellProtection.html +1 -1
- data/doc/Axlsx/CellStyle.html +1 -1
- data/doc/Axlsx/Chart.html +16 -16
- data/doc/Axlsx/Color.html +1 -1
- data/doc/Axlsx/ContentType.html +1 -1
- data/doc/Axlsx/Core.html +1 -1
- data/doc/Axlsx/DataTypeValidator.html +1 -1
- data/doc/Axlsx/Default.html +1 -1
- data/doc/Axlsx/Drawing.html +243 -65
- data/doc/Axlsx/Fill.html +1 -1
- data/doc/Axlsx/Font.html +1 -1
- data/doc/Axlsx/GradientFill.html +1 -1
- data/doc/Axlsx/GradientStop.html +1 -1
- data/doc/Axlsx/GraphicFrame.html +21 -21
- data/doc/Axlsx/Line3DChart.html +1 -1
- data/doc/Axlsx/LineSeries.html +6 -8
- data/doc/Axlsx/Marker.html +1 -1
- data/doc/Axlsx/NumFmt.html +1 -1
- data/doc/Axlsx/OneCellAnchor.html +988 -0
- data/doc/Axlsx/Override.html +1 -1
- data/doc/Axlsx/Package.html +127 -75
- data/doc/Axlsx/PatternFill.html +1 -1
- data/doc/Axlsx/Pic.html +1532 -0
- data/doc/Axlsx/Pie3DChart.html +5 -7
- data/doc/Axlsx/PieSeries.html +1 -1
- data/doc/Axlsx/RegexValidator.html +1 -1
- data/doc/Axlsx/Relationship.html +6 -6
- data/doc/Axlsx/Relationships.html +1 -1
- data/doc/Axlsx/RestrictionValidator.html +1 -1
- data/doc/Axlsx/Row.html +1 -1
- data/doc/Axlsx/Scaling.html +1 -1
- data/doc/Axlsx/SerAxis.html +1 -1
- data/doc/Axlsx/Series.html +1 -1
- data/doc/Axlsx/SeriesTitle.html +1 -1
- data/doc/Axlsx/SimpleTypedList.html +1 -1
- data/doc/Axlsx/Styles.html +1 -1
- data/doc/Axlsx/TableStyle.html +1 -1
- data/doc/Axlsx/TableStyleElement.html +1 -1
- data/doc/Axlsx/TableStyles.html +1 -1
- data/doc/Axlsx/Title.html +1 -1
- data/doc/Axlsx/TwoCellAnchor.html +165 -61
- data/doc/Axlsx/ValAxis.html +1 -1
- data/doc/Axlsx/ValAxisData.html +1 -1
- data/doc/Axlsx/View3D.html +1 -1
- data/doc/Axlsx/Workbook.html +151 -47
- data/doc/Axlsx/Worksheet.html +172 -35
- data/doc/Axlsx/Xf.html +1 -1
- data/doc/_index.html +15 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +29 -4
- data/doc/index.html +29 -4
- data/doc/method_list.html +571 -363
- data/doc/top-level-namespace.html +1 -1
- data/examples/example.rb +13 -0
- data/examples/image1.gif +0 -0
- data/examples/image1.jpeg +0 -0
- data/examples/image1.jpg +0 -0
- data/examples/image1.png +0 -0
- data/lib/axlsx/drawing/bar_series.rb +0 -1
- data/lib/axlsx/drawing/cat_axis_data.rb +1 -0
- data/lib/axlsx/drawing/chart.rb +0 -1
- data/lib/axlsx/drawing/drawing.rb +31 -7
- data/lib/axlsx/drawing/graphic_frame.rb +0 -2
- data/lib/axlsx/drawing/line_series.rb +0 -1
- data/lib/axlsx/drawing/one_cell_anchor.rb +89 -0
- data/lib/axlsx/drawing/pic.rb +158 -0
- data/lib/axlsx/drawing/pie_3D_chart.rb +0 -1
- data/lib/axlsx/drawing/two_cell_anchor.rb +17 -4
- data/lib/axlsx/package.rb +31 -5
- data/lib/axlsx/rels/relationship.rb +1 -2
- data/lib/axlsx/util/constants.rb +24 -0
- data/lib/axlsx/util/validators.rb +2 -2
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +8 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +10 -1
- data/test/drawing/tc_drawing.rb +10 -1
- data/test/drawing/tc_one_cell_anchor.rb +67 -0
- data/test/drawing/tc_pic.rb +71 -0
- data/test/tc_package.rb +0 -2
- metadata +13 -118
- data/examples/#example.rb# +0 -87
- data/examples/example.rb~ +0 -79
- data/examples/multi_chart.xlsx +0 -0
- data/lib/axlsx.rb~ +0 -67
- data/lib/axlsx/content_type/content_type.rb~ +0 -20
- data/lib/axlsx/content_type/default.rb~ +0 -32
- data/lib/axlsx/content_type/override.rb~ +0 -30
- data/lib/axlsx/doc_props/app.rb~ +0 -127
- data/lib/axlsx/doc_props/core.rb~ +0 -25
- data/lib/axlsx/drawing/#bar_series.rb# +0 -62
- data/lib/axlsx/drawing/axis.rb~ +0 -0
- data/lib/axlsx/drawing/bar_3D_chart.rb~ +0 -64
- data/lib/axlsx/drawing/bar_series.rb~ +0 -92
- data/lib/axlsx/drawing/cat_axis.rb~ +0 -32
- data/lib/axlsx/drawing/cat_axis_data.rb~ +0 -28
- data/lib/axlsx/drawing/chart.rb~ +0 -0
- data/lib/axlsx/drawing/drawing.rb~ +0 -102
- data/lib/axlsx/drawing/graphic_frame.rb~ +0 -40
- data/lib/axlsx/drawing/line_3D_chart.rb~ +0 -138
- data/lib/axlsx/drawing/line_series.rb~ +0 -91
- data/lib/axlsx/drawing/marker.rb~ +0 -50
- data/lib/axlsx/drawing/pie_3D_chart.rb~ +0 -132
- data/lib/axlsx/drawing/pie_series.rb~ +0 -0
- data/lib/axlsx/drawing/scaling.rb~ +0 -0
- data/lib/axlsx/drawing/ser_axis.rb~ +0 -48
- data/lib/axlsx/drawing/series.rb~ +0 -114
- data/lib/axlsx/drawing/series_title.rb~ +0 -18
- data/lib/axlsx/drawing/title.rb~ +0 -69
- data/lib/axlsx/drawing/two_cell_anchor.rb~ +0 -70
- data/lib/axlsx/drawing/val_axis.rb~ +0 -34
- data/lib/axlsx/drawing/val_axis_data.rb~ +0 -29
- data/lib/axlsx/drawing/view_3D.rb~ +0 -21
- data/lib/axlsx/package.rb~ +0 -181
- data/lib/axlsx/rels/relationship.rb~ +0 -18
- data/lib/axlsx/rels/relationships.rb~ +0 -23
- data/lib/axlsx/stylesheet/border.rb~ +0 -24
- data/lib/axlsx/stylesheet/border_pr.rb~ +0 -64
- data/lib/axlsx/stylesheet/cell_alignment.rb~ +0 -93
- data/lib/axlsx/stylesheet/cell_protection.rb~ +0 -16
- data/lib/axlsx/stylesheet/cell_style.rb~ +0 -61
- data/lib/axlsx/stylesheet/color.rb~ +0 -56
- data/lib/axlsx/stylesheet/fill.rb~ +0 -31
- data/lib/axlsx/stylesheet/font.rb~ +0 -33
- data/lib/axlsx/stylesheet/gradient_fill.rb~ +0 -70
- data/lib/axlsx/stylesheet/gradient_stop.rb~ +0 -15
- data/lib/axlsx/stylesheet/num_fmt.rb~ +0 -60
- data/lib/axlsx/stylesheet/pattern_fill.rb~ +0 -63
- data/lib/axlsx/stylesheet/styles.rb~ +0 -279
- data/lib/axlsx/stylesheet/table_style.rb~ +0 -43
- data/lib/axlsx/stylesheet/table_style_element.rb~ +0 -66
- data/lib/axlsx/stylesheet/table_styles.rb~ +0 -36
- data/lib/axlsx/stylesheet/xf.rb~ +0 -37
- data/lib/axlsx/util/constants.rb~ +0 -187
- data/lib/axlsx/util/monkey_patches_for_true_zip_stream.rb~ +0 -61
- data/lib/axlsx/util/simple_typed_list.rb~ +0 -79
- data/lib/axlsx/util/validators.rb~ +0 -132
- data/lib/axlsx/util/xml_escape.rb~ +0 -6
- data/lib/axlsx/workbook/workbook.rb~ +0 -130
- data/lib/axlsx/workbook/worksheet/cell.rb~ +0 -185
- data/lib/axlsx/workbook/worksheet/row.rb~ +0 -92
- data/lib/axlsx/workbook/worksheet/worksheet.rb~ +0 -194
- data/test/content_type/tc_content_type.rb~ +0 -81
- data/test/content_type/tc_default.rb~ +0 -40
- data/test/content_type/tc_override.rb~ +0 -40
- data/test/doc_props/tc_app.rb~ +0 -19
- data/test/drawing/tc_axis.rb~ +0 -0
- data/test/drawing/tc_bar_3D_chart.rb~ +0 -66
- data/test/drawing/tc_bar_series.rb~ +0 -31
- data/test/drawing/tc_cat_axis.rb~ +0 -39
- data/test/drawing/tc_cat_axis_data.rb~ +0 -32
- data/test/drawing/tc_chart.rb~ +0 -59
- data/test/drawing/tc_graphic_frame.rb~ +0 -21
- data/test/drawing/tc_line_3d_chart.rb~ +0 -48
- data/test/drawing/tc_line_series.rb~ +0 -34
- data/test/drawing/tc_marker.rb~ +0 -26
- data/test/drawing/tc_pie_3D_chart.rb~ +0 -33
- data/test/drawing/tc_pie_series.rb~ +0 -26
- data/test/drawing/tc_scaling.rb~ +0 -45
- data/test/drawing/tc_ser_axis.rb~ +0 -20
- data/test/drawing/tc_series.rb~ +0 -31
- data/test/drawing/tc_series_title.rb~ +0 -34
- data/test/drawing/tc_title.rb~ +0 -34
- data/test/drawing/tc_two_cell_anchor.rb~ +0 -37
- data/test/drawing/tc_val_axis.rb~ +0 -32
- data/test/drawing/tc_val_axis_data.rb~ +0 -18
- data/test/drawing/tc_view_3D.rb~ +0 -37
- data/test/rels/tc_relationship.rb~ +0 -39
- data/test/rels/tc_relationships.rb~ +0 -37
- data/test/stylesheet/tc_border.rb~ +0 -31
- data/test/stylesheet/tc_border_pr.rb~ +0 -31
- data/test/stylesheet/tc_cell_alignment.rb~ +0 -38
- data/test/stylesheet/tc_cell_protection.rb~ +0 -77
- data/test/stylesheet/tc_cell_style.rb~ +0 -30
- data/test/stylesheet/tc_color.rb~ +0 -38
- data/test/stylesheet/tc_fill.rb~ +0 -19
- data/test/stylesheet/tc_font.rb~ +0 -19
- data/test/stylesheet/tc_gradient_fill.rb~ +0 -114
- data/test/stylesheet/tc_gradient_stop.rb~ +0 -65
- data/test/stylesheet/tc_num_fmt.rb~ +0 -32
- data/test/stylesheet/tc_pattern_fill.rb~ +0 -31
- data/test/stylesheet/tc_table_style.rb~ +0 -38
- data/test/stylesheet/tc_table_style_element.rb~ +0 -37
- data/test/stylesheet/tc_table_styles.rb~ +0 -37
- data/test/stylesheet/tc_xf.rb~ +0 -30
- data/test/tc_app.rb~ +0 -19
- data/test/tc_border_pr.rb~ +0 -21
- data/test/tc_package.rb~ +0 -64
- data/test/tc_pie_3D_chart.rb~ +0 -66
- data/test/tc_relationships.rb~ +0 -37
- data/test/tc_series.rb~ +0 -31
- data/test/tc_styles.rb~ +0 -64
- data/test/tc_validators.rb~ +0 -77
- data/test/tc_worksheet.rb~ +0 -85
- data/test/workbook/worksheet/tc_row.rb~ +0 -30
- data/test/workbook/worksheet/tc_worksheet.rb~ +0 -85
@@ -1,18 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
class Relationship
|
3
|
-
attr_accessor :Target, :Type
|
4
|
-
def initialize(type, target)
|
5
|
-
self.Target=target
|
6
|
-
self.Type=type
|
7
|
-
end
|
8
|
-
|
9
|
-
def Target=(v) Axlsx::validate_string v; @Target = v end
|
10
|
-
def Type=(v) Axlsx::validate_relationship_type v; @Type = v end
|
11
|
-
|
12
|
-
def to_xml(xml, rId)
|
13
|
-
h = self.instance_values
|
14
|
-
h[:Id] = rId
|
15
|
-
xml.Relationship(h)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# Relationships are a collection of Relations that define how package parts are related.
|
3
|
-
# @note The package automatically manages releationships.
|
4
|
-
class Relationships < SimpleTypedList
|
5
|
-
|
6
|
-
# Creates a new Relationships collection based on SimpleTypedList
|
7
|
-
def initialize
|
8
|
-
super Relationship
|
9
|
-
end
|
10
|
-
|
11
|
-
# Serializes the relationships document.
|
12
|
-
# @return [String]
|
13
|
-
def to_xml()
|
14
|
-
builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
|
15
|
-
xml.Relationships(:xmlns => Axlsx::RELS_R) {
|
16
|
-
each_with_index { |rel, index| rel.to_xml(xml, "rId#{index+1}") }
|
17
|
-
}
|
18
|
-
end
|
19
|
-
builder.to_xml
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
class Border
|
3
|
-
attr_accessor :diagonalUp, :diagonalDown, :outline
|
4
|
-
attr_reader :prs
|
5
|
-
def initialize(options={})
|
6
|
-
@prs = SimpleTypedList.new BorderPr
|
7
|
-
options.each do |o|
|
8
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def diagonalUp=(v) Axlsx::validate_boolean v; @diagonalUp = v end
|
13
|
-
def diagonalDown=(v) Axlsx::validate_boolean v; @diagonalDown = v end
|
14
|
-
def outline=(v) Axlsx::validate_boolean v; @outline = v end
|
15
|
-
|
16
|
-
def to_xml(xml)
|
17
|
-
xml.border(self.instance_values.select{ |k,v| [:diagonalUp, :diagonalDown, :outline].include? k }) {
|
18
|
-
[:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal].each do |k|
|
19
|
-
@prs.select { |pr| pr.name == k }.each { |pr| pr.to_xml(xml) }
|
20
|
-
end
|
21
|
-
}
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# A border part.
|
3
|
-
class BorderPr
|
4
|
-
|
5
|
-
# @return [Color] The color of this border part.
|
6
|
-
attr_accessor :color
|
7
|
-
|
8
|
-
# @return [Symbol] The syle of this border part.
|
9
|
-
# @note
|
10
|
-
# The following are allowed
|
11
|
-
# :none
|
12
|
-
# :thin
|
13
|
-
# :medium
|
14
|
-
# :dashed
|
15
|
-
# :dotted
|
16
|
-
# :thick
|
17
|
-
# :double
|
18
|
-
# :hair
|
19
|
-
# :mediumDashed
|
20
|
-
# :dashDot
|
21
|
-
# :mediumDashDot
|
22
|
-
# :dashDotDot
|
23
|
-
# :mediumDashDotDot
|
24
|
-
# :slantDashDot
|
25
|
-
attr_accessor :style
|
26
|
-
|
27
|
-
# @return [Symbol] The name of this border part
|
28
|
-
# @note
|
29
|
-
# The following are allowed
|
30
|
-
# :start
|
31
|
-
# :end
|
32
|
-
# :left
|
33
|
-
# :right
|
34
|
-
# :top
|
35
|
-
# :bottom
|
36
|
-
# :diagonal
|
37
|
-
# :vertical
|
38
|
-
# :horizontal
|
39
|
-
attr_accessor :name
|
40
|
-
|
41
|
-
# Creates a new Border Part Object
|
42
|
-
# @option options [Color] color
|
43
|
-
# @option options [Symbol] name
|
44
|
-
# @option options [Symbol] style
|
45
|
-
# @see Axlsx::Border
|
46
|
-
def initialize(options={})
|
47
|
-
options.each do |o|
|
48
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def name=(v) RestrictionValidator.validate "BorderPr.name", [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal], v; @name = v end
|
53
|
-
def color=(v) DataTypeValidator.validate(:color, Color, v); @color = v end
|
54
|
-
def style=(v) RestrictionValidator.validate "BorderPr.style", [:none, :thin, :medium, :dashed, :dotted, :thick, :double, :hair, :mediumDashed, :dashDot, :mediumDashDot, :dashDotDot, :mediumDashDotDot, :slantDashDot], v; @style = v end
|
55
|
-
|
56
|
-
# Serializes the border part
|
57
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
58
|
-
def to_xml(xml)
|
59
|
-
xml.send(@name, :style=>@style) {
|
60
|
-
@color.to_xml(xml) if @color.is_a? Color
|
61
|
-
}
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# CellAlignment stores information about the cell alignment of a style Xf Object.
|
3
|
-
# @note Using Styles#add_style is the recommended way to manage cell alignment.
|
4
|
-
# @see Styles#add_style
|
5
|
-
class CellAlignment
|
6
|
-
# The horizontal alignment of the cell.
|
7
|
-
# @note
|
8
|
-
# The horizontal cell alignement style must be one of
|
9
|
-
# :general
|
10
|
-
# :left
|
11
|
-
# :center
|
12
|
-
# :right
|
13
|
-
# :fill
|
14
|
-
# :justify
|
15
|
-
# :centerContinuous
|
16
|
-
# :distributed
|
17
|
-
# @return [Symbol]
|
18
|
-
attr_accessor :horizontal
|
19
|
-
|
20
|
-
# The vertical alignment of the cell.
|
21
|
-
# @note
|
22
|
-
# The vertical cell allingment style must be one of the following:
|
23
|
-
# :top
|
24
|
-
# :center
|
25
|
-
# :bottom
|
26
|
-
# :justify
|
27
|
-
# :distributed
|
28
|
-
# @return [Symbol]
|
29
|
-
attr_accessor :vertical
|
30
|
-
|
31
|
-
# The textRotation of the cell.
|
32
|
-
# @return [Integer]
|
33
|
-
attr_accessor :textRotation
|
34
|
-
|
35
|
-
# Indicate if the text of the cell should wrap
|
36
|
-
# @return [Boolean]
|
37
|
-
attr_accessor :wrapText
|
38
|
-
|
39
|
-
# The amount of indent
|
40
|
-
# @return [Integer]
|
41
|
-
attr_accessor :indent
|
42
|
-
|
43
|
-
# The amount of relativeIndent
|
44
|
-
# @return [Integer]
|
45
|
-
attr_accessor :relativeIndent
|
46
|
-
|
47
|
-
# Indicate if the last line should be justified.
|
48
|
-
# @return [Boolean]
|
49
|
-
attr_accessor :justifyLastLine
|
50
|
-
|
51
|
-
# Indicate if the text should be shrunk to the fit in the cell.
|
52
|
-
# @return [Boolean]
|
53
|
-
attr_accessor :shrinkToFit
|
54
|
-
|
55
|
-
# The reading order of the text
|
56
|
-
# @return [Integer]
|
57
|
-
attr_accessor :readingOrder
|
58
|
-
|
59
|
-
# Create a new cell_alignment object
|
60
|
-
# @option options [Symbol] horizontal
|
61
|
-
# @option options [Symbol] vertical
|
62
|
-
# @option options [Integer] textRotation
|
63
|
-
# @option options [Boolean] wrapText
|
64
|
-
# @option options [Integer] indent
|
65
|
-
# @option options [Integer] relativeIndent
|
66
|
-
# @option options [Boolean] justifyLastLine
|
67
|
-
# @option options [Boolean] shrinkToFit
|
68
|
-
# @option options [Integer] readingOrder
|
69
|
-
def initialize(options={})
|
70
|
-
options.each do |o|
|
71
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def horizontal=(v) Axlsx::validate_horizontal_alignment v; @horizontal = v end
|
76
|
-
def vertical=(v) Axlsx::validate_vertical_alignment v; @vertical = v end
|
77
|
-
def textRotation=(v) Axlsx::validate_unsigned_int v; @textRotation = v end
|
78
|
-
def wrapText=(v) Axlsx::validate_boolean v; @wrapText = v end
|
79
|
-
def indent=(v) Axlsx::validate_unsigned_int v; @indent = v end
|
80
|
-
def relativeIndent=(v) Axlsx::validate_int v; @relativeIndent = v end
|
81
|
-
def justifyLastLine=(v) Axlsx::validate_boolean v; @justifyLastLine = v end
|
82
|
-
def shrinkToFit=(v) Axlsx::validate_boolean v; @shrinkToFit = v end
|
83
|
-
def readingOrder=(v) Axlsx::validate_insigned_int v; @readingOrder = v end
|
84
|
-
|
85
|
-
# Serializes the cell alignment
|
86
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
87
|
-
# @return [String]
|
88
|
-
def to_xml(xml)
|
89
|
-
xml.alignment(self.instance_values)
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
|
3
|
-
class CellProtection
|
4
|
-
attr_accessor :hidden, :locked
|
5
|
-
def initialize(options={})
|
6
|
-
options.each do |o|
|
7
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
8
|
-
end
|
9
|
-
end
|
10
|
-
def hidden=(v) Axlsx::validate_boolean v; @hidden = v end
|
11
|
-
def locked=(v) Axlsx::validate_boolean v; @locked = v end
|
12
|
-
def to_xml(xml)
|
13
|
-
xml.protection(self.instance_values)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# CellStyle defines named styles that reference defined formatting records and can be used in your worksheet.
|
3
|
-
# @note Using Styles#add_style is the recommended way to manage cell styling.
|
4
|
-
# @see Styles#add_style
|
5
|
-
class CellStyle
|
6
|
-
# The name of this cell style
|
7
|
-
# @return [String]
|
8
|
-
attr_accessor :name
|
9
|
-
|
10
|
-
# The formatting record id this named style utilizes
|
11
|
-
# @return [Integer]
|
12
|
-
# @see Axlsx::Xf
|
13
|
-
attr_accessor :xfId
|
14
|
-
|
15
|
-
# The buildinId to use when this named style is applied
|
16
|
-
# @return [Integer]
|
17
|
-
# @see Axlsx::NumFmt
|
18
|
-
attr_accessor :builtinId
|
19
|
-
|
20
|
-
# Determines if this formatting is for an outline style, and what level of the outline it is to be applied to.
|
21
|
-
# @return [Integer]
|
22
|
-
attr_accessor :iLevel
|
23
|
-
|
24
|
-
# Determines if this named style should show in the list of styles when using excel
|
25
|
-
# @return [Boolean]
|
26
|
-
attr_accessor :hidden
|
27
|
-
|
28
|
-
# Indicates that the build in style reference has been customized.
|
29
|
-
# @return [Boolean]
|
30
|
-
attr_accessor :customBuiltin
|
31
|
-
|
32
|
-
# Creats a new CellStyle object
|
33
|
-
# @option options [String] name
|
34
|
-
# @option options [Integer] xfId
|
35
|
-
# @option options [Integer] buildinId
|
36
|
-
# @option options [Integer] iLevel
|
37
|
-
# @option options [Boolean] hidden
|
38
|
-
# @option options [Boolean] customBuiltIn
|
39
|
-
def initialize(options={})
|
40
|
-
raise ArgumentError, "Support for extLst has not been implimented" if options[:extLst]
|
41
|
-
options.each do |o|
|
42
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def name=(v) Axlsx::validate_string v; @name = v end
|
47
|
-
def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end
|
48
|
-
def builtinId=(v) Axlsx::validate_unsigned_int v; @builtinId = v end
|
49
|
-
def iLevel=(v) Axlsx::validate_unsigned_int v; @iLevel = v end
|
50
|
-
def hidden=(v) Axlsx::validate_boolean v; @hidden = v end
|
51
|
-
def customBuiltin=(v) Axlsx::validate_boolean v; @customBuiltin = v end
|
52
|
-
|
53
|
-
# Serializes the cell style
|
54
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
55
|
-
# @return [String]
|
56
|
-
def to_xml(xml)
|
57
|
-
xml.cellStyle(self.instance_values)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# The color class represents a color used for borders, fills an fonts
|
3
|
-
class Color
|
4
|
-
# Determines if the color is system color dependant
|
5
|
-
# @return [Boolean]
|
6
|
-
attr_accessor :auto
|
7
|
-
|
8
|
-
# Backwards compatability color index
|
9
|
-
# return [Integer]
|
10
|
-
#attr_accessor :indexed
|
11
|
-
|
12
|
-
# The color as defined in rgb terms.
|
13
|
-
# @note
|
14
|
-
# rgb colors need to conform to ST_UnsignedIntHex. That basically means put 'FF' before you color
|
15
|
-
# @example rgb colors
|
16
|
-
# "FF000000" is black
|
17
|
-
# "FFFFFFFF" is white
|
18
|
-
# @return [String]
|
19
|
-
attr_accessor :rgb
|
20
|
-
|
21
|
-
# no support for theme just yet
|
22
|
-
# @return [Integer]
|
23
|
-
#attr_accessor :theme
|
24
|
-
|
25
|
-
# The tint value.
|
26
|
-
# @note valid values are between -1.0 and 1.0
|
27
|
-
# @return [Float]
|
28
|
-
attr_accessor :tint
|
29
|
-
|
30
|
-
# Creates a new Color object
|
31
|
-
# @option options [Boolean] auto
|
32
|
-
# @option options [String] rgb
|
33
|
-
# @option options [Float] tint
|
34
|
-
def initialize(options={})
|
35
|
-
options.each do |o|
|
36
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def auto=(v) Axlsx::validate_boolean v; @auto = v end
|
41
|
-
def rgb=(v) Axlsx::validate_string v; @rgb = v end
|
42
|
-
def tint=(v) Axlsx::validate_float v; @tint = v end
|
43
|
-
|
44
|
-
# This version does not support themes
|
45
|
-
# def theme=(v) Axlsx::validate_unsigned_integer v; @theme = v end
|
46
|
-
|
47
|
-
# Indexed colors are for backward compatability which I am choosing not to support
|
48
|
-
# def indexed=(v) Axlsx::validate_unsigned_integer v; @indexed = v end
|
49
|
-
|
50
|
-
|
51
|
-
# Serializes the color
|
52
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
53
|
-
# @return [String]
|
54
|
-
def to_xml(xml) xml.color(self.instance_values) end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# The Fill is a formatting object that manages the background color, and pattern for cells.
|
3
|
-
# @note The recommended way to manage styles in your workbook is to use Styles#add_style.
|
4
|
-
# @see Styles#add_style
|
5
|
-
# @see PatternFill
|
6
|
-
# @see GradientFill
|
7
|
-
class Fill
|
8
|
-
|
9
|
-
# The type of fill
|
10
|
-
# @return [PatternFill, GradientFill]
|
11
|
-
attr_reader :fill_type
|
12
|
-
|
13
|
-
# Creates a new Fill object
|
14
|
-
# @param [PatternFill, GradientFill] fill_type
|
15
|
-
# @raise [ArgumentError] if the fill_type parameter is not a PatternFill or a GradientFill instance
|
16
|
-
def initialize(fill_type)
|
17
|
-
self.fill_type = fill_type
|
18
|
-
end
|
19
|
-
|
20
|
-
# Serializes the fill
|
21
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
22
|
-
# @return [String]
|
23
|
-
def to_xml(xml)
|
24
|
-
xml.fill { @fill_type.to_xml(xml) }
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
def fill_type=(v) DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v; @fill_type = v; end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
|
3
|
-
|
4
|
-
class Font
|
5
|
-
attr_accessor :name, :charset, :family, :b, :i, :strike, :outline, :shadow, :condense, :extend, :color, :sz
|
6
|
-
def initialize(options={})
|
7
|
-
options.each do |o|
|
8
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
9
|
-
end
|
10
|
-
end
|
11
|
-
#there must be a cleaner way to do this....
|
12
|
-
def name=(v) Axlsx::validate_string v; @name = v end
|
13
|
-
def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end
|
14
|
-
def family=(v) Axlsx::validate_unsigned_int v; @family = v end
|
15
|
-
def b=(v) Axlsx::validate_boolean v; @b = v end
|
16
|
-
def i=(v) Axlsx::validate_boolean v; @i = v end
|
17
|
-
def strike=(v) Axlsx::validate_boolean v; @strike = v end
|
18
|
-
def outline=(v) Axlsx::validate_boolean v; @outline = v end
|
19
|
-
def shadow=(v) Axlsx::validate_boolean v; @shadow = v end
|
20
|
-
def condense=(v) Axlsx::validate_boolean v; @condense = v end
|
21
|
-
def extend=(v) Axlsx::validate_boolean v; @extend = v end
|
22
|
-
def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end
|
23
|
-
def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end
|
24
|
-
|
25
|
-
def to_xml(xml)
|
26
|
-
xml.font {
|
27
|
-
self.instance_values.each do |k, v|
|
28
|
-
v.is_a?(Color) ? v.to_xml(xml) : xml.send(k, {:val => v})
|
29
|
-
end
|
30
|
-
}
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Axlsx
|
3
|
-
# A GradientFill defines the color and positioning for gradiant cell fill.
|
4
|
-
# @see Open Office XML Part 1 §18.8.24
|
5
|
-
class GradientFill
|
6
|
-
|
7
|
-
# The type of gradient.
|
8
|
-
# @note
|
9
|
-
# valid options are
|
10
|
-
# :linear
|
11
|
-
# :path
|
12
|
-
# @return [Symbol]
|
13
|
-
attr_accessor :type
|
14
|
-
|
15
|
-
# Angle of the linear gradient
|
16
|
-
# @return [Float]
|
17
|
-
attr_accessor :degree
|
18
|
-
|
19
|
-
# Percentage format left
|
20
|
-
# @return [Float]
|
21
|
-
attr_accessor :left
|
22
|
-
|
23
|
-
# Percentage format right
|
24
|
-
# @return [Float]
|
25
|
-
attr_accessor :right
|
26
|
-
|
27
|
-
# Percentage format top
|
28
|
-
# @return [Float]
|
29
|
-
attr_accessor :top
|
30
|
-
|
31
|
-
# Percentage format bottom
|
32
|
-
# @return [Float]
|
33
|
-
attr_accessor :bottom
|
34
|
-
|
35
|
-
# Collection of stop objects
|
36
|
-
# @return [SimpleTypedList]
|
37
|
-
attr_reader :stop
|
38
|
-
|
39
|
-
# Creates a new GradientFill object
|
40
|
-
# @option options [Symbol] type
|
41
|
-
# @option options [Float] degree
|
42
|
-
# @option options [Float] left
|
43
|
-
# @option options [Float] right
|
44
|
-
# @option options [Float] top
|
45
|
-
# @option options [Float] bottom
|
46
|
-
def initialize(options={})
|
47
|
-
options[:type] ||= :linear
|
48
|
-
options.each do |o|
|
49
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
50
|
-
end
|
51
|
-
@stop = SimpleTypedList.new GradientStop
|
52
|
-
end
|
53
|
-
|
54
|
-
def type=(v) Axlsx::validate_gradient_type v; @type = v end
|
55
|
-
def degree=(v) Axlsx::validate_float v; @degree = v end
|
56
|
-
def left=(v) DataTypeValidator.validate "GradientFill.left", Float, v, lambda { |v| v >= 0 && v <= 1}; @left = v end
|
57
|
-
def right=(v) DataTypeValidator.validate "GradientFill.right", Float, v, lambda { |v| v >= 0 && v <= 1}; @right = v end
|
58
|
-
def top=(v) DataTypeValidator.validate "GradientFill.top", Float, v, lambda { |v| v >= 0 && v <= 1}; @top = v end
|
59
|
-
def bottom=(v) DataTypeValidator.validate "GradientFill.bottom", Float, v, lambda { |v| v >= 0 && v <= 1}; @bottom= v end
|
60
|
-
|
61
|
-
# Serializes the gradientFill
|
62
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
63
|
-
# @return [String]
|
64
|
-
def to_xml(xml)
|
65
|
-
xml.gradientFill(self.instance_values.reject { |k,v| k.to_sym == :stop }) {
|
66
|
-
@stop.each { |s| s.to_xml(xml) }
|
67
|
-
}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|