axlsx 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -0
- data/lib/axlsx.rb +38 -0
- data/lib/axlsx/content_type/content_type.rb +23 -0
- data/lib/axlsx/content_type/default.rb +32 -0
- data/lib/axlsx/content_type/override.rb +30 -0
- data/lib/axlsx/doc_props/app.rb +148 -0
- data/lib/axlsx/doc_props/core.rb +34 -0
- data/lib/axlsx/drawing/axis.rb +78 -0
- data/lib/axlsx/drawing/bar_3D_chart.rb +138 -0
- data/lib/axlsx/drawing/bar_series.rb +91 -0
- data/lib/axlsx/drawing/cat_axis.rb +58 -0
- data/lib/axlsx/drawing/chart.rb +120 -0
- data/lib/axlsx/drawing/drawing.rb +121 -0
- data/lib/axlsx/drawing/graphic_frame.rb +55 -0
- data/lib/axlsx/drawing/marker.rb +57 -0
- data/lib/axlsx/drawing/pie_3D_chart.rb +59 -0
- data/lib/axlsx/drawing/pie_series.rb +88 -0
- data/lib/axlsx/drawing/scaling.rb +53 -0
- data/lib/axlsx/drawing/series.rb +70 -0
- data/lib/axlsx/drawing/title.rb +69 -0
- data/lib/axlsx/drawing/two_cell_anchor.rb +88 -0
- data/lib/axlsx/drawing/val_axis.rb +34 -0
- data/lib/axlsx/drawing/view_3D.rb +72 -0
- data/lib/axlsx/package.rb +181 -0
- data/lib/axlsx/rels/relationship.rb +43 -0
- data/lib/axlsx/rels/relationships.rb +25 -0
- data/lib/axlsx/stylesheet/border.rb +52 -0
- data/lib/axlsx/stylesheet/border_pr.rb +65 -0
- data/lib/axlsx/stylesheet/cell_alignment.rb +96 -0
- data/lib/axlsx/stylesheet/cell_protection.rb +33 -0
- data/lib/axlsx/stylesheet/cell_style.rb +60 -0
- data/lib/axlsx/stylesheet/color.rb +57 -0
- data/lib/axlsx/stylesheet/fill.rb +31 -0
- data/lib/axlsx/stylesheet/font.rb +128 -0
- data/lib/axlsx/stylesheet/gradient_fill.rb +70 -0
- data/lib/axlsx/stylesheet/gradient_stop.rb +31 -0
- data/lib/axlsx/stylesheet/num_fmt.rb +61 -0
- data/lib/axlsx/stylesheet/pattern_fill.rb +64 -0
- data/lib/axlsx/stylesheet/styles.rb +296 -0
- data/lib/axlsx/stylesheet/table_style.rb +44 -0
- data/lib/axlsx/stylesheet/table_style_element.rb +66 -0
- data/lib/axlsx/stylesheet/table_styles.rb +39 -0
- data/lib/axlsx/stylesheet/xf.rb +117 -0
- data/lib/axlsx/util/constants.rb +189 -0
- data/lib/axlsx/util/simple_typed_list.rb +150 -0
- data/lib/axlsx/util/validators.rb +132 -0
- data/lib/axlsx/workbook/workbook.rb +130 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +184 -0
- data/lib/axlsx/workbook/worksheet/row.rb +92 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +194 -0
- data/lib/schema/dc.xsd +118 -0
- data/lib/schema/dcmitype.xsd +50 -0
- data/lib/schema/dcterms.xsd +331 -0
- data/lib/schema/dml-chart.xsd +1499 -0
- data/lib/schema/dml-chartDrawing.xsd +146 -0
- data/lib/schema/dml-compatibility.xsd +14 -0
- data/lib/schema/dml-diagram.xsd +1091 -0
- data/lib/schema/dml-lockedCanvas.xsd +11 -0
- data/lib/schema/dml-main.xsd +3048 -0
- data/lib/schema/dml-picture.xsd +23 -0
- data/lib/schema/dml-spreadsheetDrawing.xsd +185 -0
- data/lib/schema/dml-wordprocessingDrawing.xsd +185 -0
- data/lib/schema/opc-contentTypes.xsd +42 -0
- data/lib/schema/opc-coreProperties.xsd +50 -0
- data/lib/schema/opc-digSig.xsd +49 -0
- data/lib/schema/opc-relationships.xsd +33 -0
- data/lib/schema/pml.xsd +1676 -0
- data/lib/schema/shared-additionalCharacteristics.xsd +28 -0
- data/lib/schema/shared-bibliography.xsd +144 -0
- data/lib/schema/shared-commonSimpleTypes.xsd +166 -0
- data/lib/schema/shared-customXmlDataProperties.xsd +25 -0
- data/lib/schema/shared-customXmlSchemaProperties.xsd +18 -0
- data/lib/schema/shared-documentPropertiesCustom.xsd +59 -0
- data/lib/schema/shared-documentPropertiesExtended.xsd +56 -0
- data/lib/schema/shared-documentPropertiesVariantTypes.xsd +195 -0
- data/lib/schema/shared-math.xsd +582 -0
- data/lib/schema/shared-relationshipReference.xsd +25 -0
- data/lib/schema/sml.xsd +4430 -0
- data/lib/schema/vml-main.xsd +569 -0
- data/lib/schema/vml-officeDrawing.xsd +509 -0
- data/lib/schema/vml-presentationDrawing.xsd +12 -0
- data/lib/schema/vml-spreadsheetDrawing.xsd +108 -0
- data/lib/schema/vml-wordprocessingDrawing.xsd +96 -0
- data/lib/schema/wml.xsd +3644 -0
- data/lib/schema/xml.xsd +117 -0
- data/test/content_type/tc_content_type.rb +81 -0
- data/test/content_type/tc_content_type.rb~ +81 -0
- data/test/content_type/tc_default.rb +40 -0
- data/test/content_type/tc_default.rb~ +40 -0
- data/test/content_type/tc_override.rb +40 -0
- data/test/content_type/tc_override.rb~ +40 -0
- data/test/doc_props/tc_app.rb +19 -0
- data/test/doc_props/tc_app.rb~ +19 -0
- data/test/doc_props/tc_core.rb +34 -0
- data/test/drawing/tc_axis.rb +39 -0
- data/test/drawing/tc_axis.rb~ +0 -0
- data/test/drawing/tc_bar_3D_chart.rb +66 -0
- data/test/drawing/tc_bar_3D_chart.rb~ +4 -0
- data/test/drawing/tc_bar_series.rb +34 -0
- data/test/drawing/tc_bar_series.rb~ +31 -0
- data/test/drawing/tc_cat_axis.rb +32 -0
- data/test/drawing/tc_cat_axis.rb~ +39 -0
- data/test/drawing/tc_chart.rb +59 -0
- data/test/drawing/tc_chart.rb~ +58 -0
- data/test/drawing/tc_drawing.rb +71 -0
- data/test/drawing/tc_graphic_frame.rb +26 -0
- data/test/drawing/tc_graphic_frame.rb~ +21 -0
- data/test/drawing/tc_marker.rb +45 -0
- data/test/drawing/tc_marker.rb~ +26 -0
- data/test/drawing/tc_pie_3D_chart.rb +33 -0
- data/test/drawing/tc_pie_3D_chart.rb~ +58 -0
- data/test/drawing/tc_pie_series.rb +35 -0
- data/test/drawing/tc_pie_series.rb~ +26 -0
- data/test/drawing/tc_scaling.rb +37 -0
- data/test/drawing/tc_scaling.rb~ +45 -0
- data/test/drawing/tc_series.rb +24 -0
- data/test/drawing/tc_series.rb~ +31 -0
- data/test/drawing/tc_title.rb +34 -0
- data/test/drawing/tc_title.rb~ +37 -0
- data/test/drawing/tc_two_cell_anchor.rb +37 -0
- data/test/drawing/tc_two_cell_anchor.rb~ +35 -0
- data/test/drawing/tc_val_axis.rb +20 -0
- data/test/drawing/tc_val_axis.rb~ +32 -0
- data/test/drawing/tc_view_3D.rb +46 -0
- data/test/drawing/tc_view_3D.rb~ +37 -0
- data/test/rels/tc_relationship.rb +16 -0
- data/test/rels/tc_relationship.rb~ +39 -0
- data/test/rels/tc_relationships.rb +32 -0
- data/test/rels/tc_relationships.rb~ +37 -0
- data/test/stylesheet/tc_border.rb +38 -0
- data/test/stylesheet/tc_border.rb~ +31 -0
- data/test/stylesheet/tc_border_pr.rb +33 -0
- data/test/stylesheet/tc_border_pr.rb~ +31 -0
- data/test/stylesheet/tc_cell_alignment.rb +77 -0
- data/test/stylesheet/tc_cell_alignment.rb~ +38 -0
- data/test/stylesheet/tc_cell_protection.rb +30 -0
- data/test/stylesheet/tc_cell_protection.rb~ +77 -0
- data/test/stylesheet/tc_cell_style.rb +58 -0
- data/test/stylesheet/tc_cell_style.rb~ +30 -0
- data/test/stylesheet/tc_color.rb +38 -0
- data/test/stylesheet/tc_color.rb~ +38 -0
- data/test/stylesheet/tc_fill.rb +19 -0
- data/test/stylesheet/tc_fill.rb~ +19 -0
- data/test/stylesheet/tc_font.rb +114 -0
- data/test/stylesheet/tc_font.rb~ +19 -0
- data/test/stylesheet/tc_gradient_fill.rb +65 -0
- data/test/stylesheet/tc_gradient_fill.rb~ +114 -0
- data/test/stylesheet/tc_gradient_stop.rb +32 -0
- data/test/stylesheet/tc_gradient_stop.rb~ +65 -0
- data/test/stylesheet/tc_num_fmt.rb +31 -0
- data/test/stylesheet/tc_num_fmt.rb~ +32 -0
- data/test/stylesheet/tc_pattern_fill.rb +38 -0
- data/test/stylesheet/tc_pattern_fill.rb~ +31 -0
- data/test/stylesheet/tc_styles.rb +64 -0
- data/test/stylesheet/tc_table_style.rb +37 -0
- data/test/stylesheet/tc_table_style.rb~ +38 -0
- data/test/stylesheet/tc_table_style_element.rb +37 -0
- data/test/stylesheet/tc_table_style_element.rb~ +37 -0
- data/test/stylesheet/tc_table_styles.rb +30 -0
- data/test/stylesheet/tc_table_styles.rb~ +37 -0
- data/test/stylesheet/tc_xf.rb +121 -0
- data/test/stylesheet/tc_xf.rb~ +30 -0
- data/test/tc_app.rb~ +19 -0
- data/test/tc_border_pr.rb~ +21 -0
- data/test/tc_package.rb +70 -0
- data/test/tc_package.rb~ +64 -0
- data/test/tc_pie_3D_chart.rb~ +66 -0
- data/test/tc_relationships.rb~ +37 -0
- data/test/tc_series.rb~ +31 -0
- data/test/tc_styles.rb~ +64 -0
- data/test/tc_validators.rb~ +77 -0
- data/test/tc_worksheet.rb~ +85 -0
- data/test/util/tc_simple_typed_list.rb +66 -0
- data/test/util/tc_validators.rb +76 -0
- data/test/workbook/tc_workbook.rb +53 -0
- data/test/workbook/worksheet/tc_cell.rb +78 -0
- data/test/workbook/worksheet/tc_row.rb +30 -0
- data/test/workbook/worksheet/tc_worksheet.rb +85 -0
- metadata +378 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
module Axlsx
|
2
|
+
# A single table style definition and is a collection for tableStyleElements
|
3
|
+
# @note Table are not supported in this version and only the defaults required for a valid workbook are created.
|
4
|
+
class TableStyle < SimpleTypedList
|
5
|
+
|
6
|
+
# The name of this table style
|
7
|
+
# @return [string]
|
8
|
+
attr_accessor :name
|
9
|
+
|
10
|
+
# indicates if this style should be applied to pivot tables
|
11
|
+
# @return [Boolean]
|
12
|
+
attr_accessor :pivot
|
13
|
+
|
14
|
+
# indicates if this style should be applied to tables
|
15
|
+
# @return [Boolean]
|
16
|
+
attr_accessor :table
|
17
|
+
|
18
|
+
# creates a new TableStyle object
|
19
|
+
# @raise [ArgumentError] if name option is not provided.
|
20
|
+
# @param [String] name
|
21
|
+
# @option options [Boolean] pivot
|
22
|
+
# @option options [Boolean] table
|
23
|
+
def initialize(name, options={})
|
24
|
+
self.name = name
|
25
|
+
options.each do |o|
|
26
|
+
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
27
|
+
end
|
28
|
+
super TableStyleElement
|
29
|
+
end
|
30
|
+
|
31
|
+
def name=(v) Axlsx::validate_string v; @name=v end
|
32
|
+
def pivot=(v) Axlsx::validate_boolean v; @pivot=v end
|
33
|
+
def table=(v) Axlsx::validate_boolean v; @table=v end
|
34
|
+
|
35
|
+
# Serializes the table style
|
36
|
+
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
37
|
+
# @return [String]
|
38
|
+
def to_xml(xml)
|
39
|
+
attr = self.instance_values.select { |k, v| [:name, :pivot, :table].include? k }
|
40
|
+
attr[:count] = self.size
|
41
|
+
xml.tableStyle(attr) { self.each { |table_style_el| table_style_el.to_xml(xml) } }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
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.
|
4
|
+
class TableStyleElement
|
5
|
+
# The type of style element. The following type are allowed
|
6
|
+
# :wholeTable
|
7
|
+
# :headerRow
|
8
|
+
# :totalRow
|
9
|
+
# :firstColumn
|
10
|
+
# :lastColumn
|
11
|
+
# :firstRowStripe
|
12
|
+
# :secondRowStripe
|
13
|
+
# :firstColumnStripe
|
14
|
+
# :secondColumnStripe
|
15
|
+
# :firstHeaderCell
|
16
|
+
# :lastHeaderCell
|
17
|
+
# :firstTotalCell
|
18
|
+
# :lastTotalCell
|
19
|
+
# :firstSubtotalColumn
|
20
|
+
# :secondSubtotalColumn
|
21
|
+
# :thirdSubtotalColumn
|
22
|
+
# :firstSubtotalRow
|
23
|
+
# :secondSubtotalRow
|
24
|
+
# :thirdSubtotalRow
|
25
|
+
# :blankRow
|
26
|
+
# :firstColumnSubheading
|
27
|
+
# :secondColumnSubheading
|
28
|
+
# :thirdColumnSubheading
|
29
|
+
# :firstRowSubheading
|
30
|
+
# :secondRowSubheading
|
31
|
+
# :thirdRowSubheading
|
32
|
+
# :pageFieldLabels
|
33
|
+
# :pageFieldValues
|
34
|
+
# @return [Symbol]
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
# Number of rows or columns used in striping when the type is firstRowStripe, secondRowStripe, firstColumnStripe, or secondColumnStripe.
|
38
|
+
# @return [Integer]
|
39
|
+
attr_accessor :size
|
40
|
+
|
41
|
+
# The dxfId this style element points to
|
42
|
+
# @return [Integer]
|
43
|
+
attr_accessor :dxfId
|
44
|
+
|
45
|
+
# creates a new TableStyleElement object
|
46
|
+
# @option options [Symbol] type
|
47
|
+
# @option options [Integer] size
|
48
|
+
# @option options [Integer] dxfId
|
49
|
+
def initialize(options={})
|
50
|
+
options.each do |o|
|
51
|
+
self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def type=(v) Axlsx::validate_table_element_type v; @type = v end
|
56
|
+
def size=(v) Axlsx::validate_unsigned_int v; @size = v end
|
57
|
+
def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfId = v end
|
58
|
+
|
59
|
+
# Serializes the table style element
|
60
|
+
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
61
|
+
# @return [String]
|
62
|
+
def to_xml(xml)
|
63
|
+
xml.tableStyleElement self.instance_values
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Axlsx
|
2
|
+
# TableStyles represents a collection of style definitions for table styles and pivot table styles.
|
3
|
+
# @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.
|
4
|
+
class TableStyles < SimpleTypedList
|
5
|
+
|
6
|
+
# The default table style. The default value is 'TableStyleMedium9'
|
7
|
+
# @return [String]
|
8
|
+
#
|
9
|
+
attr_accessor :defaultTableStyle
|
10
|
+
|
11
|
+
# The default pivot table style. The default value is 'PivotStyleLight6'
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :defaultPivotStyle
|
14
|
+
|
15
|
+
# Creates a new TableStyles object that is a container for TableStyle objects
|
16
|
+
# @option options [String] defaultTableStyle
|
17
|
+
# @option options [String] defaultPivotStyle
|
18
|
+
def initialize(options={})
|
19
|
+
@defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
|
20
|
+
@defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
|
21
|
+
super TableStyle
|
22
|
+
end
|
23
|
+
|
24
|
+
def defaultTableStyle=(v) Axlsx::validate_string(v); @defaultTableStyle = v; end
|
25
|
+
def defaultPivotStyle=(v) Axlsx::validate_string(v); @defaultPivotStyle = v; end
|
26
|
+
|
27
|
+
# Serializes the table styles element
|
28
|
+
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
29
|
+
# @return [String]
|
30
|
+
def to_xml(xml)
|
31
|
+
attr = self.instance_values.reject {|k, v| ![:defaultTableStyle, :defaultPivotStyle].include?(k.to_sym) }
|
32
|
+
attr[:count] = self.size
|
33
|
+
xml.tableStyles(attr) {
|
34
|
+
self.each { |table_style| table_style.to_xml(xml) }
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Axlsx
|
2
|
+
# The Xf class defines a formatting record for use in Styles
|
3
|
+
class Xf
|
4
|
+
#does not support extList (ExtensionList)
|
5
|
+
|
6
|
+
# The cell alignment for this style
|
7
|
+
# @return [CellAlignment]
|
8
|
+
# @see CellAlignment
|
9
|
+
attr_accessor :alignment
|
10
|
+
|
11
|
+
# The cell protection for this style
|
12
|
+
# @return [CellProtection]
|
13
|
+
# @see CellProtection
|
14
|
+
attr_accessor :protection
|
15
|
+
|
16
|
+
# id of the numFmt to apply to this style
|
17
|
+
# @return [Integer]
|
18
|
+
attr_accessor :numFmtId
|
19
|
+
|
20
|
+
# index (0 based) of the font to be used in this style
|
21
|
+
# @return [Integer]
|
22
|
+
attr_accessor :fontId
|
23
|
+
|
24
|
+
# index (0 based) of the fill to be used in this style
|
25
|
+
# @return [Integer]
|
26
|
+
attr_accessor :fillId
|
27
|
+
|
28
|
+
# index (0 based) of the border to be used in this style
|
29
|
+
# @return [Integer]
|
30
|
+
attr_accessor :borderId
|
31
|
+
|
32
|
+
# index (0 based) of cellStylesXfs item to be used in this style. Only applies to cellXfs items
|
33
|
+
# @return [Integer]
|
34
|
+
attr_accessor :xfId
|
35
|
+
|
36
|
+
# indecates if text should be prefixed by a single quote in the cell
|
37
|
+
# @return [Boolean]
|
38
|
+
attr_accessor :quotePrefix
|
39
|
+
|
40
|
+
# indicates if the cell has a pivot table drop down button
|
41
|
+
# @return [Boolean]
|
42
|
+
attr_accessor :pivotButton
|
43
|
+
|
44
|
+
# indicates if the numFmtId should be applied
|
45
|
+
# @return [Boolean]
|
46
|
+
attr_accessor :applyNumberFormat
|
47
|
+
|
48
|
+
# indicates if the fontId should be applied
|
49
|
+
# @return [Boolean]
|
50
|
+
attr_accessor :applyFont
|
51
|
+
|
52
|
+
# indicates if the fillId should be applied
|
53
|
+
# @return [Boolean]
|
54
|
+
attr_accessor :applyFill
|
55
|
+
|
56
|
+
# indicates if the borderId should be applied
|
57
|
+
# @return [Boolean]
|
58
|
+
attr_accessor :applyBorder
|
59
|
+
|
60
|
+
# Indicates if the alignment options should be applied
|
61
|
+
# @return [Boolean]
|
62
|
+
attr_accessor :applyAlignment
|
63
|
+
|
64
|
+
# Indicates if the protection options should be applied
|
65
|
+
# @return [Boolean]
|
66
|
+
attr_accessor :applyProtection
|
67
|
+
|
68
|
+
# Creates a new Xf object
|
69
|
+
# @option [Integer] numFmtId
|
70
|
+
# @option [Integer] fontId
|
71
|
+
# @option [Integer] fillId
|
72
|
+
# @option [Integer] borderId
|
73
|
+
# @option [Integer] xfId
|
74
|
+
# @option [Boolean] quotePrefix
|
75
|
+
# @option [Boolean] pivotButton
|
76
|
+
# @option [Boolean] applyNumberFormat
|
77
|
+
# @option [Boolean] applyFont
|
78
|
+
# @option [Boolean] applyFill
|
79
|
+
# @option [Boolean] applyBorder
|
80
|
+
# @option [Boolean] applyAlignment
|
81
|
+
# @option [Boolean] applyProtection
|
82
|
+
# @option [CellAlignment] alignment
|
83
|
+
# @option [CellProtection] protection
|
84
|
+
def initialize(options={})
|
85
|
+
options.each do |o|
|
86
|
+
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def alignment=(v) DataTypeValidator.validate "Xf.alignment", CellAlignment, v; @alignment = v end
|
91
|
+
def protection=(v) DataTypeValidator.validate "Xf.protection", CellProtection, v; @protection = v end
|
92
|
+
|
93
|
+
def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end
|
94
|
+
def fontId=(v) Axlsx::validate_unsigned_int v; @fontId = v end
|
95
|
+
def fillId=(v) Axlsx::validate_unsigned_int v; @fillId = v end
|
96
|
+
def borderId=(v) Axlsx::validate_unsigned_int v; @borderId = v end
|
97
|
+
def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end
|
98
|
+
def quotePrefix=(v) Axlsx::validate_boolean v; @quotePrefix = v end
|
99
|
+
def pivotButton=(v) Axlsx::validate_boolean v; @pivotButton = v end
|
100
|
+
def applyNumberFormat=(v) Axlsx::validate_boolean v; @applyNumberFormat = v end
|
101
|
+
def applyFont=(v) Axlsx::validate_boolean v; @applyFont = v end
|
102
|
+
def applyFill=(v) Axlsx::validate_boolean v; @applyFill = v end
|
103
|
+
def applyBorder=(v) Axlsx::validate_boolean v; @applyBorder = v end
|
104
|
+
def applyAlignment=(v) Axlsx::validate_boolean v; @applyAlignment = v end
|
105
|
+
def applyProtection=(v) Axlsx::validate_boolean v; @applyProtection = v end
|
106
|
+
|
107
|
+
# Serializes the xf elemen
|
108
|
+
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
109
|
+
# @return [String]
|
110
|
+
def to_xml(xml)
|
111
|
+
xml.xf(self.instance_values.reject { |k, v| [:alignment, :protection, :extList, :name].include? k.to_sym}) {
|
112
|
+
alignment.to_xml(xml) if self.alignment
|
113
|
+
protection.to_xml(xml) if self.protection
|
114
|
+
}
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
module Axlsx
|
2
|
+
|
3
|
+
# version
|
4
|
+
VERSION="1.0.1.a"
|
5
|
+
|
6
|
+
# XML Encoding
|
7
|
+
ENCODING = "UTF-8"
|
8
|
+
|
9
|
+
# spreadsheetML namespace
|
10
|
+
XML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
|
11
|
+
|
12
|
+
# content-types namespace
|
13
|
+
XML_NS_T = "http://schemas.openxmlformats.org/package/2006/content-types"
|
14
|
+
|
15
|
+
# extended-properties namespace
|
16
|
+
APP_NS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
17
|
+
|
18
|
+
# doc props namespace
|
19
|
+
APP_NS_VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
|
20
|
+
|
21
|
+
# core properties namespace
|
22
|
+
CORE_NS = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
|
23
|
+
|
24
|
+
# dc elements (core) namespace
|
25
|
+
CORE_NS_DC = "http://purl.org/dc/elements/1.1/"
|
26
|
+
|
27
|
+
# dcmit (core) namespcace
|
28
|
+
CORE_NS_DCMIT = "http://purl.org/dc/dcmitype/"
|
29
|
+
|
30
|
+
# dc terms namespace
|
31
|
+
CORE_NS_DCT = "http://purl.org/dc/terms/"
|
32
|
+
|
33
|
+
# xml schema namespace
|
34
|
+
CORE_NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
|
35
|
+
|
36
|
+
# spreadsheet drawing namespace
|
37
|
+
XML_NS_XDR = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
|
38
|
+
|
39
|
+
# drawing namespace
|
40
|
+
XML_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main"
|
41
|
+
|
42
|
+
# chart namespace
|
43
|
+
XML_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart"
|
44
|
+
|
45
|
+
# relationships namespace
|
46
|
+
XML_NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
47
|
+
|
48
|
+
|
49
|
+
# relationships name space
|
50
|
+
RELS_R = "http://schemas.openxmlformats.org/package/2006/relationships"
|
51
|
+
|
52
|
+
# table rels namespace
|
53
|
+
TABLE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
|
54
|
+
|
55
|
+
# workbook rels namespace
|
56
|
+
WORKBOOK_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
|
57
|
+
|
58
|
+
# worksheet rels namespace
|
59
|
+
WORKSHEET_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
|
60
|
+
|
61
|
+
# app rels namespace
|
62
|
+
APP_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
|
63
|
+
|
64
|
+
# core rels namespace
|
65
|
+
CORE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
|
66
|
+
|
67
|
+
# styles rels namespace
|
68
|
+
STYLES_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
|
69
|
+
|
70
|
+
# drawing rels namespace
|
71
|
+
DRAWING_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
|
72
|
+
|
73
|
+
# chart rels namespace
|
74
|
+
CHART_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
|
75
|
+
|
76
|
+
# table content type
|
77
|
+
TABLE_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
|
78
|
+
|
79
|
+
# workbook content type
|
80
|
+
WORKBOOK_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
|
81
|
+
|
82
|
+
# app content type
|
83
|
+
APP_CT = "application/vnd.openxmlformats-officedocument.extended-properties+xml"
|
84
|
+
|
85
|
+
# rels content type
|
86
|
+
RELS_CT = "application/vnd.openxmlformats-package.relationships+xml"
|
87
|
+
|
88
|
+
# styles content type
|
89
|
+
STYLES_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
|
90
|
+
|
91
|
+
# xml content type
|
92
|
+
XML_CT = "application/xml"
|
93
|
+
|
94
|
+
# worksheet content type
|
95
|
+
WORKSHEET_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
|
96
|
+
|
97
|
+
# shared strings content type
|
98
|
+
SHARED_STRINGS_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
|
99
|
+
|
100
|
+
# core content type
|
101
|
+
CORE_CT = "application/vnd.openxmlformats-package.core-properties+xml"
|
102
|
+
|
103
|
+
# chart content type
|
104
|
+
CHART_CT = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
|
105
|
+
|
106
|
+
#drawing content type
|
107
|
+
DRAWING_CT = "application/vnd.openxmlformats-officedocument.drawing+xml"
|
108
|
+
|
109
|
+
# xml content type extensions
|
110
|
+
XML_EX = "xml"
|
111
|
+
|
112
|
+
# rels content type extension
|
113
|
+
RELS_EX = "rels"
|
114
|
+
|
115
|
+
# workbook part
|
116
|
+
WORKBOOK_PN = "xl/workbook.xml"
|
117
|
+
|
118
|
+
# styles part
|
119
|
+
STYLES_PN = "styles.xml"
|
120
|
+
|
121
|
+
# app part
|
122
|
+
APP_PN = "docProps/app.xml"
|
123
|
+
|
124
|
+
# core part
|
125
|
+
CORE_PN = "docProps/core.xml"
|
126
|
+
|
127
|
+
# content types part
|
128
|
+
CONTENT_TYPES_PN = "[Content_Types].xml"
|
129
|
+
|
130
|
+
# rels part
|
131
|
+
RELS_PN = "_rels/.rels"
|
132
|
+
|
133
|
+
# workbook rels part
|
134
|
+
WORKBOOK_RELS_PN = "xl/_rels/workbook.xml.rels"
|
135
|
+
|
136
|
+
# worksheet part
|
137
|
+
WORKSHEET_PN = "worksheets/sheet%d.xml"
|
138
|
+
|
139
|
+
# worksheet rels part
|
140
|
+
WORKSHEET_RELS_PN = "worksheets/_rels/sheet%d.xml.rels"
|
141
|
+
|
142
|
+
# drawing part
|
143
|
+
DRAWING_PN = "drawings/drawing%d.xml"
|
144
|
+
|
145
|
+
# drawing rels part
|
146
|
+
DRAWING_RELS_PN = "drawings/_rels/drawing%d.xml.rels"
|
147
|
+
|
148
|
+
# chart part
|
149
|
+
CHART_PN = "charts/chart%d.xml"
|
150
|
+
|
151
|
+
# App validation schema
|
152
|
+
APP_XSD = "lib/schema/shared-documentPropertiesExtended.xsd"
|
153
|
+
|
154
|
+
# core validation schema
|
155
|
+
CORE_XSD = "lib/schema/opc-coreProperties.xsd"
|
156
|
+
|
157
|
+
# content types validation schema
|
158
|
+
CONTENT_TYPES_XSD = "lib/schema/opc-contentTypes.xsd"
|
159
|
+
|
160
|
+
# rels validation schema
|
161
|
+
RELS_XSD = "lib/schema/opc-relationships.xsd"
|
162
|
+
|
163
|
+
# spreadsheetML validation schema
|
164
|
+
SML_XSD = "lib/schema/sml.xsd"
|
165
|
+
|
166
|
+
# drawing validation schema
|
167
|
+
DRAWING_XSD = "lib/schema/dml-spreadsheetDrawing.xsd"
|
168
|
+
|
169
|
+
# number format id for pecentage formatting using the default formatting id.
|
170
|
+
NUM_FMT_PERCENT = 9
|
171
|
+
|
172
|
+
# number format id for date format like 2011/11/13
|
173
|
+
NUM_FMT_YYYYMMDD = 100
|
174
|
+
|
175
|
+
# number format id for time format the creates 2011/11/13 12:23:10
|
176
|
+
NUM_FMT_YYYYMMDDHHMMSS = 101
|
177
|
+
|
178
|
+
# cellXfs id for thin borders around the cell
|
179
|
+
STYLE_THIN_BORDER = 1
|
180
|
+
|
181
|
+
# error messages RestrictionValidor
|
182
|
+
ERR_RESTRICTION = "Invalid Data: %s. %s must be one of %s."
|
183
|
+
|
184
|
+
# error message DataTypeValidator
|
185
|
+
ERR_TYPE = "Invalid Data %s for %s. must be %s."
|
186
|
+
|
187
|
+
# error message for RegexValidator
|
188
|
+
ERR_REGEX = "Invalid Data. %s does not match %s."
|
189
|
+
end
|