rubyXL 2.3.4 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rubyXL.rb +2 -0
- data/lib/rubyXL/objects/calculation_chain.rb +6 -1
- data/lib/rubyXL/objects/chartsheet.rb +7 -1
- data/lib/rubyXL/objects/container_nodes.rb +6 -1
- data/lib/rubyXL/objects/content_types.rb +95 -0
- data/lib/rubyXL/objects/document_properties.rb +77 -1
- data/lib/rubyXL/objects/ooxml_object.rb +11 -7
- data/lib/rubyXL/objects/relationships.rb +9 -5
- data/lib/rubyXL/objects/shared_strings.rb +5 -1
- data/lib/rubyXL/objects/simple_types.rb +35 -1
- data/lib/rubyXL/objects/stylesheet.rb +5 -1
- data/lib/rubyXL/objects/theme.rb +471 -6
- data/lib/rubyXL/objects/workbook.rb +52 -1
- data/lib/rubyXL/objects/worksheet.rb +7 -1
- data/lib/rubyXL/parser.rb +9 -14
- data/lib/rubyXL/workbook.rb +11 -13
- data/rdoc/README_rdoc.html +1 -1
- data/rdoc/RubyXL.html +11 -1
- data/rdoc/RubyXL/AExtension.html +225 -0
- data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/Alignment.html +1 -1
- data/rdoc/RubyXL/AlternateContent.html +1 -1
- data/rdoc/RubyXL/AutoFilter.html +1 -1
- data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
- data/rdoc/RubyXL/BooleanNode.html +1 -1
- data/rdoc/RubyXL/BooleanValue.html +1 -1
- data/rdoc/RubyXL/Border.html +1 -1
- data/rdoc/RubyXL/BorderEdge.html +1 -1
- data/rdoc/RubyXL/Borders.html +1 -1
- data/rdoc/RubyXL/Break.html +1 -1
- data/rdoc/RubyXL/BreakList.html +1 -1
- data/rdoc/RubyXL/CalculationChain.html +41 -6
- data/rdoc/RubyXL/CalculationChainCell.html +1 -1
- data/rdoc/RubyXL/CalculationProperties.html +1 -1
- data/rdoc/RubyXL/Cell.html +1 -1
- data/rdoc/RubyXL/CellSmartTag.html +1 -1
- data/rdoc/RubyXL/CellSmartTagProperty.html +1 -1
- data/rdoc/RubyXL/CellSmartTags.html +1 -1
- data/rdoc/RubyXL/CellStyle.html +1 -1
- data/rdoc/RubyXL/CellStyleXFs.html +1 -1
- data/rdoc/RubyXL/CellStyles.html +1 -1
- data/rdoc/RubyXL/CellValue.html +1 -1
- data/rdoc/RubyXL/CellWatch.html +1 -1
- data/rdoc/RubyXL/CellWatches.html +1 -1
- data/rdoc/RubyXL/CellXFs.html +1 -1
- data/rdoc/RubyXL/Chartsheet.html +1 -1
- data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
- data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
- data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
- data/rdoc/RubyXL/ChartsheetView.html +1 -1
- data/rdoc/RubyXL/ChartsheetViews.html +1 -1
- data/rdoc/RubyXL/Color.html +1 -1
- data/rdoc/RubyXL/ColorFilter.html +1 -1
- data/rdoc/RubyXL/ColorScale.html +1 -1
- data/rdoc/RubyXL/ColorScheme.html +1 -1
- data/rdoc/RubyXL/ColorSet.html +1 -1
- data/rdoc/RubyXL/Colors.html +1 -1
- data/rdoc/RubyXL/ColumnRange.html +1 -1
- data/rdoc/RubyXL/ColumnRanges.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
- data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
- data/rdoc/RubyXL/ContentTypeDefault.html +105 -0
- data/rdoc/RubyXL/ContentTypeOverride.html +105 -0
- data/rdoc/RubyXL/ContentTypes.html +310 -0
- data/rdoc/RubyXL/CoreProperties.html +105 -0
- data/rdoc/RubyXL/CustomColor.html +105 -0
- data/rdoc/RubyXL/CustomColorList.html +105 -0
- data/rdoc/RubyXL/CustomFilter.html +1 -1
- data/rdoc/RubyXL/CustomFilters.html +1 -1
- data/rdoc/RubyXL/CustomGeometry.html +105 -0
- data/rdoc/RubyXL/CustomProperties.html +1 -1
- data/rdoc/RubyXL/CustomProperty.html +1 -1
- data/rdoc/RubyXL/CustomSheetView.html +1 -1
- data/rdoc/RubyXL/CustomSheetViews.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
- data/rdoc/RubyXL/DXF.html +1 -1
- data/rdoc/RubyXL/DXFs.html +1 -1
- data/rdoc/RubyXL/DataBar.html +1 -1
- data/rdoc/RubyXL/DataConsolidate.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
- data/rdoc/RubyXL/DataValidation.html +1 -1
- data/rdoc/RubyXL/DataValidations.html +1 -1
- data/rdoc/RubyXL/DateGroupItem.html +1 -1
- data/rdoc/RubyXL/DefinedName.html +1 -1
- data/rdoc/RubyXL/DefinedNames.html +1 -1
- data/rdoc/RubyXL/DocumentProperties.html +41 -6
- data/rdoc/RubyXL/DynamicFilter.html +1 -1
- data/rdoc/RubyXL/EmbeddedControl.html +1 -1
- data/rdoc/RubyXL/EmbeddedControls.html +1 -1
- data/rdoc/RubyXL/Extension.html +1 -121
- data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/Extents.html +105 -0
- data/rdoc/RubyXL/ExternalReference.html +1 -1
- data/rdoc/RubyXL/ExternalReferences.html +1 -1
- data/rdoc/RubyXL/ExtraColorScheme.html +105 -0
- data/rdoc/RubyXL/ExtraColorSchemeList.html +105 -0
- data/rdoc/RubyXL/FieldItem.html +1 -1
- data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
- data/rdoc/RubyXL/FileSharing.html +1 -1
- data/rdoc/RubyXL/FileVersion.html +1 -1
- data/rdoc/RubyXL/Fill.html +1 -1
- data/rdoc/RubyXL/Fills.html +1 -1
- data/rdoc/RubyXL/FilterContainer.html +1 -1
- data/rdoc/RubyXL/FloatNode.html +1 -1
- data/rdoc/RubyXL/FloatValue.html +1 -1
- data/rdoc/RubyXL/Font.html +1 -1
- data/rdoc/RubyXL/FontScheme.html +1 -1
- data/rdoc/RubyXL/Fonts.html +1 -1
- data/rdoc/RubyXL/FormatScheme.html +1 -1
- data/rdoc/RubyXL/Formula.html +1 -1
- data/rdoc/RubyXL/FunctionGroup.html +1 -1
- data/rdoc/RubyXL/FunctionGroups.html +1 -1
- data/rdoc/RubyXL/GenericStorage.html +1 -1
- data/rdoc/RubyXL/GradientFill.html +1 -1
- data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
- data/rdoc/RubyXL/Hyperlink.html +1 -1
- data/rdoc/RubyXL/Hyperlinks.html +1 -1
- data/rdoc/RubyXL/IconFilter.html +1 -1
- data/rdoc/RubyXL/IconSet.html +1 -1
- data/rdoc/RubyXL/IgnoredError.html +1 -1
- data/rdoc/RubyXL/IgnoredErrors.html +1 -1
- data/rdoc/RubyXL/IndexedColors.html +1 -1
- data/rdoc/RubyXL/InputCells.html +1 -1
- data/rdoc/RubyXL/IntegerNode.html +1 -1
- data/rdoc/RubyXL/IntegerValue.html +1 -1
- data/rdoc/RubyXL/LegacyCell.html +1 -1
- data/rdoc/RubyXL/LegacyWorkbook.html +33 -55
- data/rdoc/RubyXL/LegacyWorksheet.html +1 -1
- data/rdoc/RubyXL/MRUColors.html +1 -1
- data/rdoc/RubyXL/MergedCell.html +1 -1
- data/rdoc/RubyXL/MergedCells.html +1 -1
- data/rdoc/RubyXL/NumFmt.html +1 -1
- data/rdoc/RubyXL/NumberFormat.html +1 -1
- data/rdoc/RubyXL/NumberFormats.html +1 -1
- data/rdoc/RubyXL/OLEObject.html +1 -1
- data/rdoc/RubyXL/OLEObjects.html +1 -1
- data/rdoc/RubyXL/OLESize.html +1 -1
- data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +1 -1
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +36 -1
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
- data/rdoc/RubyXL/ObjectDefaults.html +105 -0
- data/rdoc/RubyXL/Offset.html +105 -0
- data/rdoc/RubyXL/OutlineProperties.html +1 -1
- data/rdoc/RubyXL/PageMargins.html +1 -1
- data/rdoc/RubyXL/PageSetup.html +1 -1
- data/rdoc/RubyXL/PageSetupProperties.html +1 -1
- data/rdoc/RubyXL/Pane.html +1 -1
- data/rdoc/RubyXL/Parser.html +9 -14
- data/rdoc/RubyXL/PatternFill.html +1 -1
- data/rdoc/RubyXL/PhoneticProperties.html +1 -1
- data/rdoc/RubyXL/PhoneticRun.html +1 -1
- data/rdoc/RubyXL/PivotArea.html +1 -1
- data/rdoc/RubyXL/PivotCache.html +1 -1
- data/rdoc/RubyXL/PivotCaches.html +1 -1
- data/rdoc/RubyXL/PivotReference.html +1 -1
- data/rdoc/RubyXL/PivotReferences.html +1 -1
- data/rdoc/RubyXL/PivotTableSelection.html +1 -1
- data/rdoc/RubyXL/PresetGeometry.html +105 -0
- data/rdoc/RubyXL/PrintOptions.html +1 -1
- data/rdoc/RubyXL/ProtectedRange.html +1 -1
- data/rdoc/RubyXL/ProtectedRanges.html +1 -1
- data/rdoc/RubyXL/Protection.html +1 -1
- data/rdoc/RubyXL/RID.html +1 -1
- data/rdoc/RubyXL/RawOOXML.html +1 -1
- data/rdoc/RubyXL/Reference.html +1 -1
- data/rdoc/RubyXL/Relationship.html +1 -1
- data/rdoc/RubyXL/RichText.html +1 -1
- data/rdoc/RubyXL/RichTextRun.html +1 -1
- data/rdoc/RubyXL/RootRelationships.html +1 -1
- data/rdoc/RubyXL/Row.html +1 -1
- data/rdoc/RubyXL/RunProperties.html +1 -1
- data/rdoc/RubyXL/Scenario.html +1 -1
- data/rdoc/RubyXL/Scenarios.html +1 -1
- data/rdoc/RubyXL/Selection.html +1 -1
- data/rdoc/RubyXL/ShapeDefault.html +105 -0
- data/rdoc/RubyXL/SharedStringsTable.html +43 -8
- data/rdoc/RubyXL/Sheet.html +1 -1
- data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
- data/rdoc/RubyXL/SheetData.html +1 -1
- data/rdoc/RubyXL/Sheets.html +1 -1
- data/rdoc/RubyXL/SmartTagProperties.html +1 -1
- data/rdoc/RubyXL/SmartTagType.html +1 -1
- data/rdoc/RubyXL/SmartTagTypes.html +1 -1
- data/rdoc/RubyXL/SmartTags.html +1 -1
- data/rdoc/RubyXL/SortCondition.html +1 -1
- data/rdoc/RubyXL/SortState.html +1 -1
- data/rdoc/RubyXL/Sqref.html +1 -1
- data/rdoc/RubyXL/Stop.html +1 -1
- data/rdoc/RubyXL/StringNode.html +1 -1
- data/rdoc/RubyXL/{Writer.html → StringNodeW3C.html} +13 -6
- data/rdoc/RubyXL/StringValue.html +1 -1
- data/rdoc/RubyXL/Stylesheet.html +1 -1
- data/rdoc/RubyXL/TableParts.html +1 -1
- data/rdoc/RubyXL/TableStyle.html +1 -1
- data/rdoc/RubyXL/TableStyles.html +1 -1
- data/rdoc/RubyXL/Text.html +1 -1
- data/rdoc/RubyXL/Theme.html +2 -2
- data/rdoc/RubyXL/ThemeElements.html +1 -1
- data/rdoc/RubyXL/Top10.html +1 -1
- data/rdoc/RubyXL/TwoDTransform.html +105 -0
- data/rdoc/RubyXL/Variant.html +1 -1
- data/rdoc/RubyXL/Vector.html +1 -1
- data/rdoc/RubyXL/VectorValue.html +1 -1
- data/rdoc/RubyXL/VisualProperties.html +105 -0
- data/rdoc/RubyXL/WebPublishObject.html +1 -1
- data/rdoc/RubyXL/WebPublishObjects.html +1 -1
- data/rdoc/RubyXL/WebPublishingItem.html +1 -1
- data/rdoc/RubyXL/WebPublishingItems.html +1 -1
- data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
- data/rdoc/RubyXL/Workbook.html +1 -1
- data/rdoc/RubyXL/WorkbookProperties.html +1 -1
- data/rdoc/RubyXL/WorkbookProtection.html +1 -1
- data/rdoc/RubyXL/WorkbookRelationships.html +1 -1
- data/rdoc/RubyXL/WorkbookView.html +1 -1
- data/rdoc/RubyXL/WorkbookViews.html +1 -1
- data/rdoc/RubyXL/Worksheet.html +1 -1
- data/rdoc/RubyXL/WorksheetDimensions.html +1 -1
- data/rdoc/RubyXL/WorksheetFormatProperties.html +1 -1
- data/rdoc/RubyXL/WorksheetProperties.html +1 -1
- data/rdoc/RubyXL/WorksheetProtection.html +1 -1
- data/rdoc/RubyXL/WorksheetView.html +1 -1
- data/rdoc/RubyXL/WorksheetViews.html +1 -1
- data/rdoc/RubyXL/XF.html +1 -1
- data/rdoc/created.rid +19 -24
- data/rdoc/index.html +12 -16
- data/rdoc/js/search_index.js +1 -1
- data/rdoc/table_of_contents.html +102 -153
- data/rubyXL.gemspec +22 -16
- data/spec/lib/parser_spec.rb +16 -2
- metadata +21 -15
- data/lib/rubyXL/writer/content_types_writer.rb +0 -113
- data/lib/rubyXL/writer/core_writer.rb +0 -34
- data/lib/rubyXL/writer/generic_writer.rb +0 -43
- data/lib/rubyXL/writer/styles_writer.rb +0 -15
- data/lib/rubyXL/writer/theme_writer.rb +0 -337
- data/lib/rubyXL/writer/workbook_writer.rb +0 -73
- data/rdoc/RubyXL/Writer/ContentTypesWriter.html +0 -289
- data/rdoc/RubyXL/Writer/CoreWriter.html +0 -210
- data/rdoc/RubyXL/Writer/GenericWriter.html +0 -348
- data/rdoc/RubyXL/Writer/StylesWriter.html +0 -191
- data/rdoc/RubyXL/Writer/ThemeWriter.html +0 -511
- data/rdoc/RubyXL/Writer/WorkbookWriter.html +0 -249
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7eb72c2b30df89f942b111f761a1abbaec3248a
|
4
|
+
data.tar.gz: b9594666aa329bccd62afdeb67fc42a30fd2072a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6de5fe2a07e6f5983196af5834de60b11144cdc1bf3b15917fa3cb9d0f5cc9be2501bea17ac10117f23a0dfdecb6f5478c7c90313ad28ed261d19819ab58d46e
|
7
|
+
data.tar.gz: 3f09a471e147982249df6c658ca34f27bcb49737ecaa1d8e81047251e1536efaa2c14f51ca54069142f3a42f3e1b0326af318351e9802f4b4470def54f9fcf05
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
data/lib/rubyXL.rb
CHANGED
@@ -8,6 +8,8 @@ require 'rubyXL/objects/shared_strings'
|
|
8
8
|
require 'rubyXL/objects/worksheet'
|
9
9
|
require 'rubyXL/objects/chartsheet'
|
10
10
|
require 'rubyXL/objects/calculation_chain'
|
11
|
+
require 'rubyXL/objects/content_types'
|
12
|
+
require 'rubyXL/objects/theme'
|
11
13
|
require 'rubyXL/objects/workbook'
|
12
14
|
require 'rubyXL/objects/document_properties'
|
13
15
|
require 'rubyXL/objects/relationships'
|
@@ -21,8 +21,13 @@ module RubyXL
|
|
21
21
|
define_element_name 'calcChain'
|
22
22
|
set_namespaces('xmlns' => 'http://schemas.openxmlformats.org/spreadsheetml/2006/main')
|
23
23
|
|
24
|
-
def self.
|
24
|
+
def self.xlsx_path
|
25
25
|
File.join('xl', 'calcChain.xml')
|
26
26
|
end
|
27
|
+
|
28
|
+
def self.content_type
|
29
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml'
|
30
|
+
end
|
31
|
+
|
27
32
|
end
|
28
33
|
end
|
@@ -74,11 +74,13 @@ module RubyXL
|
|
74
74
|
set_namespaces('xmlns' => 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
|
75
75
|
'xmlns:r' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships')
|
76
76
|
|
77
|
+
attr_accessor :state
|
78
|
+
|
77
79
|
def sheet_index
|
78
80
|
@workbook.worksheets.select{ |sheet| sheet.is_a?(self.class) }.index{ |sheet| sheet.equal?(self) }
|
79
81
|
end
|
80
82
|
|
81
|
-
def
|
83
|
+
def xlsx_path
|
82
84
|
File.join('xl', 'chartsheets', "sheet#{sheet_index + 1}.xml")
|
83
85
|
end
|
84
86
|
|
@@ -86,6 +88,10 @@ module RubyXL
|
|
86
88
|
'chartsheet'
|
87
89
|
end
|
88
90
|
|
91
|
+
def self.content_type
|
92
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml'
|
93
|
+
end
|
94
|
+
|
89
95
|
attr_accessor :workbook, :sheet_name, :sheet_id
|
90
96
|
|
91
97
|
end
|
@@ -35,6 +35,11 @@ module RubyXL
|
|
35
35
|
define_attribute(:_, :float, :accessor => :value)
|
36
36
|
end
|
37
37
|
|
38
|
+
class StringNodeW3C < OOXMLObject
|
39
|
+
define_attribute(:_, :string, :accessor => :value)
|
40
|
+
define_attribute('xsi:type', :string, :required => true, :default => 'dcterms:W3CDTF')
|
41
|
+
end
|
42
|
+
|
38
43
|
# http://www.schemacentral.com/sc/ooxml/e-docPropsVTypes_variant.html
|
39
44
|
class Variant < OOXMLObject
|
40
45
|
define_child_node(RubyXL::Variant, :node_name => 'vt:variant')
|
@@ -118,4 +123,4 @@ module RubyXL
|
|
118
123
|
define_child_node(RubyXL::Vector)
|
119
124
|
end
|
120
125
|
|
121
|
-
end
|
126
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'rubyXL/objects/ooxml_object'
|
2
|
+
|
3
|
+
module RubyXL
|
4
|
+
|
5
|
+
class ContentTypeDefault < OOXMLObject
|
6
|
+
define_attribute(:Extension, :string)
|
7
|
+
define_attribute(:ContentType, :string)
|
8
|
+
define_element_name 'Default'
|
9
|
+
end
|
10
|
+
|
11
|
+
class ContentTypeOverride < OOXMLObject
|
12
|
+
define_attribute(:PartName, :string)
|
13
|
+
define_attribute(:ContentType, :string)
|
14
|
+
define_element_name 'Override'
|
15
|
+
end
|
16
|
+
|
17
|
+
class ContentTypes < OOXMLTopLevelObject
|
18
|
+
attr_accessor :workbook
|
19
|
+
|
20
|
+
define_child_node(RubyXL::ContentTypeDefault, :collection => true, :accessor => :defaults)
|
21
|
+
define_child_node(RubyXL::ContentTypeOverride, :collection => true, :accessor => :overrides)
|
22
|
+
|
23
|
+
set_namespaces(:xmlns => 'http://schemas.openxmlformats.org/package/2006/content-types')
|
24
|
+
define_element_name 'Types'
|
25
|
+
|
26
|
+
def self.xlsx_path
|
27
|
+
'[Content_Types].xml'
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_override(obj)
|
31
|
+
RubyXL::ContentTypeOverride.new(:part_name => "/#{obj.xlsx_path}", :content_type => obj.class.content_type)
|
32
|
+
end
|
33
|
+
|
34
|
+
def before_write_xml
|
35
|
+
self.defaults = []
|
36
|
+
unless @workbook.printer_settings.empty?
|
37
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'bin',
|
38
|
+
:content_type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings')
|
39
|
+
end
|
40
|
+
|
41
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'rels',
|
42
|
+
:content_type => 'application/vnd.openxmlformats-package.relationships+xml' )
|
43
|
+
|
44
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'xml',
|
45
|
+
:content_type => 'application/xml' )
|
46
|
+
|
47
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'jpeg', :content_type => 'image/jpeg' )
|
48
|
+
|
49
|
+
self.overrides = []
|
50
|
+
overrides << generate_override(workbook)
|
51
|
+
workbook.worksheets.each { |sheet| overrides << generate_override(sheet) }
|
52
|
+
overrides << generate_override(workbook.stylesheet)
|
53
|
+
overrides << generate_override(workbook.document_properties)
|
54
|
+
overrides << generate_override(workbook.core_properties)
|
55
|
+
overrides << generate_override(workbook.shared_strings_container) unless workbook.shared_strings_container.empty?
|
56
|
+
overrides << generate_override(workbook.calculation_chain) unless workbook.calculation_chain.nil?
|
57
|
+
overrides << generate_override(workbook.theme)
|
58
|
+
|
59
|
+
workbook.charts.each_pair { |k, v|
|
60
|
+
case k
|
61
|
+
when /^chart\d*.xml$/ then
|
62
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
63
|
+
:content_type => 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml')
|
64
|
+
when /^style\d*.xml$/ then
|
65
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
66
|
+
:content_type => 'application/vnd.ms-office.chartstyle+xml')
|
67
|
+
when /^colors\d*.xml$/ then
|
68
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
69
|
+
:content_type => 'application/vnd.ms-office.chartcolorstyle+xml')
|
70
|
+
end
|
71
|
+
}
|
72
|
+
|
73
|
+
workbook.drawings.each_pair { |k, v|
|
74
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.drawings.local_dir_path}/#{k}",
|
75
|
+
:content_type => 'application/vnd.openxmlformats-officedocument.drawing+xml')
|
76
|
+
}
|
77
|
+
|
78
|
+
unless workbook.external_links.nil?
|
79
|
+
1.upto(workbook.external_links.size - 1) { |i|
|
80
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/xl/externalLinks/externalLink#{i}.xml",
|
81
|
+
:content_type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml')
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
unless @workbook.macros.empty?
|
86
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => '/xl/vbaProject.bin',
|
87
|
+
:content_type => 'application/vnd.ms-office.vbaProject')
|
88
|
+
end
|
89
|
+
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -67,10 +67,86 @@ module RubyXL
|
|
67
67
|
true
|
68
68
|
end
|
69
69
|
|
70
|
-
def self.
|
70
|
+
def self.xlsx_path
|
71
71
|
File.join('docProps', 'app.xml')
|
72
72
|
end
|
73
73
|
|
74
|
+
def self.content_type
|
75
|
+
'application/vnd.openxmlformats-officedocument.extended-properties+xml'
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
class CoreProperties < OOXMLTopLevelObject
|
82
|
+
attr_accessor :workbook
|
83
|
+
|
84
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:creator')
|
85
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:description')
|
86
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:identifier')
|
87
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:language')
|
88
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:subject')
|
89
|
+
define_child_node(RubyXL::StringNode, :node_name => 'dc:title')
|
90
|
+
define_child_node(RubyXL::StringNodeW3C, :node_name => 'dcterms:created')
|
91
|
+
define_child_node(RubyXL::StringNodeW3C, :node_name => 'dcterms:modified')
|
92
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:lastModifiedBy')
|
93
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:lastPrinted')
|
94
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:category')
|
95
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:contentStatus')
|
96
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:contentType')
|
97
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:keywords')
|
98
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:revision')
|
99
|
+
define_child_node(RubyXL::StringNode, :node_name => 'cp:version')
|
100
|
+
|
101
|
+
set_namespaces('xmlns:cp' => 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
|
102
|
+
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
|
103
|
+
'xmlns:dcterms' => 'http://purl.org/dc/terms/',
|
104
|
+
'xmlns:dcmitype' => 'http://purl.org/dc/dcmitype/',
|
105
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance')
|
106
|
+
define_element_name 'cp:coreProperties'
|
107
|
+
|
108
|
+
def self.xlsx_path
|
109
|
+
File.join('docProps', 'core.xml')
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.content_type
|
113
|
+
'application/vnd.openxmlformats-package.core-properties+xml'
|
114
|
+
end
|
115
|
+
|
116
|
+
def creator
|
117
|
+
dc_creator && dc_creator.value
|
118
|
+
end
|
119
|
+
|
120
|
+
def creator=(v)
|
121
|
+
self.dc_creator = RubyXL::StringNodeW3C.new(:value => v)
|
122
|
+
end
|
123
|
+
|
124
|
+
def modifier
|
125
|
+
cp_last_modified_by && cp_last_modified_by.value
|
126
|
+
end
|
127
|
+
|
128
|
+
def modifier=(v)
|
129
|
+
self.cp_last_modified_by = RubyXL::StringNodeW3C.new(:value => v)
|
130
|
+
end
|
131
|
+
|
132
|
+
def created_at
|
133
|
+
val = dcterms_created && dcterms_created.value
|
134
|
+
val && (val.strip.empty? ? nil : Time.parse(val))
|
135
|
+
end
|
136
|
+
|
137
|
+
def created_at=(v)
|
138
|
+
self.dcterms_created = RubyXL::StringNodeW3C.new(:value => v.iso8601)
|
139
|
+
end
|
140
|
+
|
141
|
+
def modified_at
|
142
|
+
val = dcterms_modified && dcterms_modified.value
|
143
|
+
val && (val.strip.empty? ? nil : Time.parse(val))
|
144
|
+
end
|
145
|
+
|
146
|
+
def modified_at=(v)
|
147
|
+
self.dcterms_modified = RubyXL::StringNodeW3C.new(:value => v.iso8601)
|
148
|
+
end
|
149
|
+
|
74
150
|
end
|
75
151
|
|
76
152
|
end
|
@@ -236,8 +236,12 @@ module RubyXL
|
|
236
236
|
# * +xml+ - Base Nokogiri::XML object used for building. If omitted, a blank document will be generated.
|
237
237
|
# * +node_name_override+ - if present, is used instead of the default element name for this object provided by +define_element_name+
|
238
238
|
# ==== Examples
|
239
|
-
# obj.write_xml
|
240
|
-
# Creates a new
|
239
|
+
# obj.write_xml()
|
240
|
+
# Creates a new empty +Nokogiri::XML+, populates it with the OOXML structure as described in the respective definition, and returns the resulting +Nokogiri::XML+ object.
|
241
|
+
# obj.write_xml(seed_xml)
|
242
|
+
# Using the passed-in +Nokogiri+ +xml+ object, creates a new element corresponding to +obj+ according to its definition, along with all its properties and children, and returns the newly created element.
|
243
|
+
# obj.write_xml(seed_xml, 'overriden_element_name')
|
244
|
+
# Same as above, but uses the passed-in +node_name_override+ as the new element name, instead of its default name set by +define_element_name+.
|
241
245
|
def write_xml(xml = nil, node_name_override = nil)
|
242
246
|
if xml.nil? then
|
243
247
|
seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
|
@@ -384,11 +388,11 @@ module RubyXL
|
|
384
388
|
class OOXMLTopLevelObject < OOXMLObject
|
385
389
|
# Prototype method. For top-level OOXML object, returns the path at which the current object's XML file
|
386
390
|
# is located within the <tt>.xslx</tt> zip container.
|
387
|
-
def
|
388
|
-
self.class.
|
391
|
+
def xlsx_path
|
392
|
+
self.class.xlsx_path
|
389
393
|
end
|
390
394
|
|
391
|
-
def self.
|
395
|
+
def self.xlsx_path
|
392
396
|
raise 'Subclass responsebility'
|
393
397
|
end
|
394
398
|
|
@@ -407,7 +411,7 @@ module RubyXL
|
|
407
411
|
# === Parameters
|
408
412
|
# * +dirpath+ - path to the directory with the unzipped <tt>.xslx</tt> contents.
|
409
413
|
def self.parse_file(dirpath)
|
410
|
-
full_path = File.join(dirpath,
|
414
|
+
full_path = File.join(dirpath, xlsx_path)
|
411
415
|
return nil unless File.exist?(full_path)
|
412
416
|
parse(File.open(full_path, 'r'))
|
413
417
|
end
|
@@ -418,7 +422,7 @@ module RubyXL
|
|
418
422
|
def add_to_zip(zipfile)
|
419
423
|
xml_string = write_xml
|
420
424
|
return if xml_string.empty?
|
421
|
-
zipfile.get_output_stream(self.
|
425
|
+
zipfile.get_output_stream(self.xlsx_path) { |f| f << xml_string }
|
422
426
|
end
|
423
427
|
|
424
428
|
end
|
@@ -35,6 +35,10 @@ module RubyXL
|
|
35
35
|
def find_by_rid(r_id)
|
36
36
|
relationships.find { |r| r.id == r_id }
|
37
37
|
end
|
38
|
+
|
39
|
+
def find_by_target(target)
|
40
|
+
relationships.find { |r| r.target == target }
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
|
@@ -46,7 +50,7 @@ module RubyXL
|
|
46
50
|
self.relationships = []
|
47
51
|
|
48
52
|
@workbook.worksheets.each_with_index { |sheet, i|
|
49
|
-
relationships << document_relationship(sheet.
|
53
|
+
relationships << document_relationship(sheet.xlsx_path.gsub(/^xl\//, ''), sheet.rel_type)
|
50
54
|
}
|
51
55
|
|
52
56
|
@workbook.external_links.each_key { |k|
|
@@ -67,7 +71,7 @@ module RubyXL
|
|
67
71
|
true
|
68
72
|
end
|
69
73
|
|
70
|
-
def self.
|
74
|
+
def self.xlsx_path
|
71
75
|
File.join('xl', '_rels', 'workbook.xml.rels')
|
72
76
|
end
|
73
77
|
|
@@ -80,14 +84,14 @@ module RubyXL
|
|
80
84
|
def before_write_xml
|
81
85
|
self.relationships = []
|
82
86
|
|
83
|
-
relationships << document_relationship('xl/workbook.xml',
|
87
|
+
relationships << document_relationship('xl/workbook.xml', 'officeDocument')
|
84
88
|
relationships << metadata_relationship('docProps/core.xml', 'core-properties')
|
85
|
-
relationships << document_relationship('docProps/app.xml',
|
89
|
+
relationships << document_relationship('docProps/app.xml', 'extended-properties')
|
86
90
|
|
87
91
|
true
|
88
92
|
end
|
89
93
|
|
90
|
-
def self.
|
94
|
+
def self.xlsx_path
|
91
95
|
File.join('_rels', '.rels')
|
92
96
|
end
|
93
97
|
end
|
@@ -48,10 +48,14 @@ module RubyXL
|
|
48
48
|
index
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.
|
51
|
+
def self.xlsx_path
|
52
52
|
File.join('xl', 'sharedStrings.xml')
|
53
53
|
end
|
54
54
|
|
55
|
+
def self.content_type
|
56
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
|
57
|
+
end
|
58
|
+
|
55
59
|
end
|
56
60
|
|
57
61
|
end
|
@@ -74,5 +74,39 @@ module RubyXL
|
|
74
74
|
|
75
75
|
ST_ConditionalFormattingOperator = %w{ lessThan lessThanOrEqual equal notEqual greaterThanOrEqual greaterThan
|
76
76
|
between notBetween containsText notContains beginsWith endsWith }
|
77
|
-
|
77
|
+
ST_BlackWhiteMode = %w{ clr auto gray ltGray invGray grayWhite blackGray blackWhite black white hidden }
|
78
|
+
ST_ShapeType = %w{ line lineInv triangle rtTriangle rect diamond parallelogram trapezoid
|
79
|
+
nonIsoscelesTrapezoid pentagon hexagon heptagon octagon decagon dodecagon
|
80
|
+
star4 star5 star6 star7 star8 star10 star12 star16 star24 star32
|
81
|
+
roundRect round1Rect round2SameRect round2DiagRect snipRoundRect
|
82
|
+
snip1Rect snip2SameRect snip2DiagRect plaque ellipse teardrop homePlate chevron
|
83
|
+
pieWedge pie blockArc donut noSmoking rightArrow leftArrow upArrow downArrow
|
84
|
+
stripedRightArrow notchedRightArrow bentUpArrow
|
85
|
+
leftRightArrow upDownArrow leftUpArrow leftRightUpArrow quadArrow
|
86
|
+
leftArrowCallout rightArrowCallout upArrowCallout downArrowCallout
|
87
|
+
leftRightArrowCallout upDownArrowCallout quadArrowCallout bentArrow uturnArrow circularArrow
|
88
|
+
leftCircularArrow leftRightCircularArrow curvedRightArrow
|
89
|
+
curvedLeftArrow curvedUpArrow curvedDownArrow swooshArrow
|
90
|
+
cube can lightningBolt heart sun moon smileyFace irregularSeal1 irregularSeal2 foldedCorner
|
91
|
+
bevel frame halfFrame corner diagStripe chord arc leftBracket rightBracket leftBrace rightBrace
|
92
|
+
bracketPair bracePair straightConnector1 bentConnector2
|
93
|
+
bentConnector3 bentConnector4 bentConnector5 curvedConnector2 curvedConnector3
|
94
|
+
curvedConnector4 curvedConnector5 callout1 callout2 callout3
|
95
|
+
accentCallout1 accentCallout2 accentCallout3 borderCallout1 borderCallout2 borderCallout3
|
96
|
+
accentBorderCallout1 accentBorderCallout2 accentBorderCallout3
|
97
|
+
wedgeRectCallout wedgeRoundRectCallout wedgeEllipseCallout cloudCallout
|
98
|
+
cloud ribbon ribbon2 ellipseRibbon ellipseRibbon2 leftRightRibbon
|
99
|
+
verticalScroll horizontalScroll wave doubleWave plus
|
100
|
+
flowChartProcess flowChartDecision flowChartInputOutput flowChartPredefinedProcess
|
101
|
+
flowChartInternalStorage flowChartDocument flowChartMultidocument flowChartTerminator
|
102
|
+
flowChartPreparation flowChartManualInput flowChartManualOperation flowChartConnector
|
103
|
+
flowChartPunchedCard flowChartPunchedTape flowChartSummingJunction flowChartOr flowChartCollate
|
104
|
+
flowChartSort flowChartExtract flowChartMerge flowChartOfflineStorage flowChartOnlineStorage
|
105
|
+
flowChartMagneticTape flowChartMagneticDisk flowChartMagneticDrum flowChartDisplay
|
106
|
+
flowChartDelay flowChartAlternateProcess flowChartOffpageConnector actionButtonBlank
|
107
|
+
actionButtonHome actionButtonHelp actionButtonInformation actionButtonForwardNext
|
108
|
+
actionButtonBackPrevious actionButtonEnd actionButtonBeginning actionButtonReturn
|
109
|
+
actionButtonDocument actionButtonSound actionButtonMovie gear6 gear9 funnel
|
110
|
+
mathPlus mathMinus mathMultiply mathDivide mathEqual mathNotEqual
|
111
|
+
cornerTabs squareTabs plaqueTabs chartX chartStar chartPlus }
|
78
112
|
end
|
@@ -183,10 +183,14 @@ module RubyXL
|
|
183
183
|
@format_hash = nil
|
184
184
|
end
|
185
185
|
|
186
|
-
def self.
|
186
|
+
def self.xlsx_path
|
187
187
|
File.join('xl', 'styles.xml')
|
188
188
|
end
|
189
189
|
|
190
|
+
def self.content_type
|
191
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
|
192
|
+
end
|
193
|
+
|
190
194
|
def self.default
|
191
195
|
self.new(:fonts => RubyXL::Fonts.defaults,
|
192
196
|
:fills => RubyXL::Fills.defaults,
|
data/lib/rubyXL/objects/theme.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rubyXL/objects/extensions'
|
|
4
4
|
module RubyXL
|
5
5
|
|
6
6
|
# http://www.schemacentral.com/sc/ooxml/e-a_ext-1.html
|
7
|
-
class
|
7
|
+
class AExtension < OOXMLObject
|
8
8
|
define_attribute(:uri, :string)
|
9
9
|
define_element_name 'a:ext'
|
10
10
|
attr_accessor :raw_xml
|
@@ -22,19 +22,23 @@ module RubyXL
|
|
22
22
|
end
|
23
23
|
|
24
24
|
class AExtensionStorageArea < OOXMLObject
|
25
|
+
#FIXME#
|
25
26
|
define_child_node(RubyXL::AExtension, :collection => true)
|
26
27
|
define_element_name 'a:extLst'
|
27
28
|
end
|
28
29
|
|
29
30
|
class ColorScheme < OOXMLObject
|
31
|
+
#FIXME#
|
30
32
|
define_element_name 'a:clrScheme'
|
31
33
|
end
|
32
34
|
|
33
35
|
class FontScheme < OOXMLObject
|
36
|
+
#FIXME#
|
34
37
|
define_element_name 'a:fontScheme'
|
35
38
|
end
|
36
39
|
|
37
40
|
class FormatScheme < OOXMLObject
|
41
|
+
#FIXME#
|
38
42
|
define_element_name 'a:fmtScheme'
|
39
43
|
end
|
40
44
|
|
@@ -47,18 +51,479 @@ module RubyXL
|
|
47
51
|
define_element_name 'a:themeElements'
|
48
52
|
end
|
49
53
|
|
54
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_off-1.html
|
55
|
+
class Offset < OOXMLObject
|
56
|
+
define_attribute(:x, :int, :required => true)
|
57
|
+
define_attribute(:y, :int, :required => true)
|
58
|
+
define_element_name 'a:off'
|
59
|
+
end
|
60
|
+
|
61
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_ext-2.html
|
62
|
+
class Extents < OOXMLObject
|
63
|
+
define_attribute(:cx, :int, :required => true)
|
64
|
+
define_attribute(:cy, :int, :required => true)
|
65
|
+
define_element_name 'a:ext'
|
66
|
+
end
|
67
|
+
|
68
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_xfrm-4.html
|
69
|
+
class TwoDTransform < OOXMLObject
|
70
|
+
define_attribute(:rot, :int, :default => 0)
|
71
|
+
define_attribute(:flipH, :bool, :default => false)
|
72
|
+
define_attribute(:flipV, :bool, :default => false)
|
73
|
+
define_child_node(RubyXL::Offset)
|
74
|
+
define_child_node(RubyXL::Extents)
|
75
|
+
define_element_name 'a:xfrm'
|
76
|
+
end
|
77
|
+
|
78
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_custGeom-1.html
|
79
|
+
class CustomGeometry < OOXMLObject
|
80
|
+
# a:avLst [0..1] Adjust Value List
|
81
|
+
# a:gdLst [0..1] List of Shape Guides
|
82
|
+
# a:ahLst [0..1] List of Shape Adjust Handles
|
83
|
+
# a:cxnLst [0..1] List of Shape Connection Sites
|
84
|
+
# a:rect [0..1] Shape Text Rectangle
|
85
|
+
# a:pathLst [1..1] List of Shape Paths
|
86
|
+
define_element_name 'a:custGeom'
|
87
|
+
end
|
88
|
+
|
89
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_prstGeom-1.html
|
90
|
+
class PresetGeometry < OOXMLObject
|
91
|
+
# a:avLst [0..1] Adjust Value List
|
92
|
+
define_attribute(:prst, RubyXL::ST_ShapeType, :required => true)
|
93
|
+
define_element_name 'a:prstGeom'
|
94
|
+
end
|
95
|
+
|
96
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_spPr-1.html
|
97
|
+
class VisualProperties < OOXMLObject
|
98
|
+
define_child_node(RubyXL::TwoDTransform)
|
99
|
+
define_child_node(RubyXL::CustomGeometry)
|
100
|
+
define_child_node(RubyXL::PresetGeometry)
|
101
|
+
# a:noFill No Fill
|
102
|
+
# a:solidFill Solid Fill
|
103
|
+
# a:gradFill Gradient Fill
|
104
|
+
# a:blipFill Picture Fill
|
105
|
+
# a:pattFill Pattern Fill
|
106
|
+
# a:grpFill Group Fill
|
107
|
+
# a:ln [0..1]
|
108
|
+
# a:effectLst Effect Container
|
109
|
+
# a:effectDag Effect Container
|
110
|
+
# a:scene3d [0..1] 3-D Scene
|
111
|
+
# a:sp3d [0..1] 3-D Shape Properties
|
112
|
+
# a:extLst [0..1] Extension List
|
113
|
+
define_attribute(:bwMode, RubyXL::ST_BlackWhiteMode)
|
114
|
+
|
115
|
+
define_child_node(RubyXL::AExtensionStorageArea)
|
116
|
+
define_element_name 'a:spPr'
|
117
|
+
end
|
118
|
+
|
119
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_spDef-1.html
|
120
|
+
class ShapeDefault < OOXMLObject
|
121
|
+
define_child_node(RubyXL::VisualProperties)
|
122
|
+
# a:bodyPr [1..1] BodyProperties
|
123
|
+
# a:lstStyle [1..1] TextListStyles
|
124
|
+
# a:style [0..1] Shape Style
|
125
|
+
define_child_node(RubyXL::AExtensionStorageArea)
|
126
|
+
define_element_name 'a:spDef'
|
127
|
+
end
|
128
|
+
|
129
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_objectDefaults-1.html
|
130
|
+
class ObjectDefaults < OOXMLObject
|
131
|
+
define_child_node(RubyXL::ShapeDefault)
|
132
|
+
# a:spDef [0..1]
|
133
|
+
# a:lnDef [0..1] LineDefault
|
134
|
+
# a:txDef [0..1] TextDefault
|
135
|
+
define_child_node(RubyXL::AExtensionStorageArea)
|
136
|
+
define_element_name 'a:objectDefaults'
|
137
|
+
end
|
138
|
+
|
139
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_extraClrScheme-1.html
|
140
|
+
class ExtraColorScheme < OOXMLObject
|
141
|
+
# a:clrScheme [1..1] ColorScheme
|
142
|
+
# a:clrMap [0..1] ColorMap
|
143
|
+
define_element_name 'a:extraClrScheme'
|
144
|
+
end
|
145
|
+
|
146
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_extraClrSchemeLst-1.html
|
147
|
+
class ExtraColorSchemeList < OOXMLContainerObject
|
148
|
+
define_child_node(RubyXL::ExtraColorScheme, :collection => true)
|
149
|
+
define_element_name 'a:extraClrSchemeLst'
|
150
|
+
end
|
151
|
+
|
152
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_custClr-1.html
|
153
|
+
class CustomColor < OOXMLObject
|
154
|
+
# a:scrgbClr RGB Color Model - Percentage Variant
|
155
|
+
# a:srgbClr RGB Color Model - Hex Variant
|
156
|
+
# a:hslClr Hue, Saturation, Luminance Color Model
|
157
|
+
# a:sysClr System Color
|
158
|
+
# a:schemeClr Scheme Color
|
159
|
+
# a:prstClr Preset Color
|
160
|
+
define_attribute(:name, :string, :default => '')
|
161
|
+
define_element_name 'a:custClr'
|
162
|
+
end
|
163
|
+
|
164
|
+
# http://www.schemacentral.com/sc/ooxml/e-a_custClrLst-1.html
|
165
|
+
class CustomColorList < OOXMLContainerObject
|
166
|
+
define_child_node(RubyXL::CustomColor, :collection => true)
|
167
|
+
define_element_name 'a:custClrLst'
|
168
|
+
end
|
169
|
+
|
50
170
|
# http://www.schemacentral.com/sc/ooxml/e-a_theme.html
|
51
|
-
class Theme <
|
171
|
+
class Theme < OOXMLTopLevelObject
|
52
172
|
define_attribute(:name, :string, :default => '')
|
53
173
|
define_child_node(RubyXL::ThemeElements)
|
54
174
|
define_child_node(RubyXL::ObjectDefaults)
|
55
|
-
|
56
|
-
|
175
|
+
define_child_node(RubyXL::ExtraColorSchemeList)
|
176
|
+
define_child_node(RubyXL::CustomColorList)
|
57
177
|
define_child_node(RubyXL::AExtensionStorageArea)
|
58
178
|
|
59
179
|
define_element_name 'a:theme'
|
60
180
|
|
61
181
|
set_namespaces('xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main')
|
62
|
-
end
|
63
182
|
|
64
|
-
|
183
|
+
def self.xlsx_path
|
184
|
+
File.join('xl', 'theme', 'theme1.xml')
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.content_type
|
188
|
+
'application/vnd.openxmlformats-officedocument.theme+xml'
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
###### Temporary storage of the theme until I'm done with fully implementing
|
193
|
+
###### all of its intricacies
|
194
|
+
attr_accessor :raw_xml
|
195
|
+
|
196
|
+
def self.parse_file(dirpath)
|
197
|
+
full_path = File.join(dirpath, xlsx_path)
|
198
|
+
return nil unless File.exist?(full_path)
|
199
|
+
obj = self.new
|
200
|
+
|
201
|
+
obj.raw_xml = File.open(full_path, 'r').read
|
202
|
+
obj
|
203
|
+
end
|
204
|
+
|
205
|
+
def write_xml
|
206
|
+
raw_xml || # Use fallback theme.
|
207
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
208
|
+
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
|
209
|
+
<a:themeElements>
|
210
|
+
<a:clrScheme name="Office">
|
211
|
+
<a:dk1>
|
212
|
+
<a:sysClr val="windowText" lastClr="000000"/>
|
213
|
+
</a:dk1>
|
214
|
+
<a:lt1>
|
215
|
+
<a:sysClr val="window" lastClr="FFFFFF"/>
|
216
|
+
</a:lt1>
|
217
|
+
<a:dk2>
|
218
|
+
<a:srgbClr val="1F497D"/>
|
219
|
+
</a:dk2>
|
220
|
+
<a:lt2>
|
221
|
+
<a:srgbClr val="EEECE1"/>
|
222
|
+
</a:lt2>
|
223
|
+
<a:accent1>
|
224
|
+
<a:srgbClr val="4F81BD"/>
|
225
|
+
</a:accent1>
|
226
|
+
<a:accent2>
|
227
|
+
<a:srgbClr val="C0504D"/>
|
228
|
+
</a:accent2>
|
229
|
+
<a:accent3>
|
230
|
+
<a:srgbClr val="9BBB59"/>
|
231
|
+
</a:accent3>
|
232
|
+
<a:accent4>
|
233
|
+
<a:srgbClr val="8064A2"/>
|
234
|
+
</a:accent4>
|
235
|
+
<a:accent5>
|
236
|
+
<a:srgbClr val="4BACC6"/>
|
237
|
+
</a:accent5>
|
238
|
+
<a:accent6>
|
239
|
+
<a:srgbClr val="F79646"/>
|
240
|
+
</a:accent6>
|
241
|
+
<a:hlink>
|
242
|
+
<a:srgbClr val="0000FF"/>
|
243
|
+
</a:hlink>
|
244
|
+
<a:folHlink>
|
245
|
+
<a:srgbClr val="800080"/>
|
246
|
+
</a:folHlink>
|
247
|
+
</a:clrScheme>
|
248
|
+
<a:fontScheme name="Office">
|
249
|
+
<a:majorFont>
|
250
|
+
<a:latin typeface="Cambria"/>
|
251
|
+
<a:ea typeface=""/>
|
252
|
+
<a:cs typeface=""/>
|
253
|
+
<a:font script="Jpan" typeface="MS Pゴシック"/>
|
254
|
+
<a:font script="Hang" typeface="맑은 고딕"/>
|
255
|
+
<a:font script="Hans" typeface="宋体"/>
|
256
|
+
<a:font script="Hant" typeface="新細明體"/>
|
257
|
+
<a:font script="Arab" typeface="Times New Roman"/>
|
258
|
+
<a:font script="Hebr" typeface="Times New Roman"/>
|
259
|
+
<a:font script="Thai" typeface="Tahoma"/>
|
260
|
+
<a:font script="Ethi" typeface="Nyala"/>
|
261
|
+
<a:font script="Beng" typeface="Vrinda"/>
|
262
|
+
<a:font script="Gujr" typeface="Shruti"/>
|
263
|
+
<a:font script="Khmr" typeface="MoolBoran"/>
|
264
|
+
<a:font script="Knda" typeface="Tunga"/>
|
265
|
+
<a:font script="Guru" typeface="Raavi"/>
|
266
|
+
<a:font script="Cans" typeface="Euphemia"/>
|
267
|
+
<a:font script="Cher" typeface="Plantagenet Cherokee"/>
|
268
|
+
<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
|
269
|
+
<a:font script="Tibt" typeface="Microsoft Himalaya"/>
|
270
|
+
<a:font script="Thaa" typeface="MV Boli"/>
|
271
|
+
<a:font script="Deva" typeface="Mangal"/>
|
272
|
+
<a:font script="Telu" typeface="Gautami"/>
|
273
|
+
<a:font script="Taml" typeface="Latha"/>
|
274
|
+
<a:font script="Syrc" typeface="Estrangelo Edessa"/>
|
275
|
+
<a:font script="Orya" typeface="Kalinga"/>
|
276
|
+
<a:font script="Mlym" typeface="Kartika"/>
|
277
|
+
<a:font script="Laoo" typeface="DokChampa"/>
|
278
|
+
<a:font script="Sinh" typeface="Iskoola Pota"/>
|
279
|
+
<a:font script="Mong" typeface="Mongolian Baiti"/>
|
280
|
+
<a:font script="Viet" typeface="Times New Roman"/>
|
281
|
+
<a:font script="Uigh" typeface="Microsoft Uighur"/>
|
282
|
+
</a:majorFont>
|
283
|
+
<a:minorFont>
|
284
|
+
<a:latin typeface="Calibri"/>
|
285
|
+
<a:ea typeface=""/>
|
286
|
+
<a:cs typeface=""/>
|
287
|
+
<a:font script="Jpan" typeface="MS Pゴシック"/>
|
288
|
+
<a:font script="Hang" typeface="맑은 고딕"/>
|
289
|
+
<a:font script="Hans" typeface="宋体"/>
|
290
|
+
<a:font script="Hant" typeface="新細明體"/>
|
291
|
+
<a:font script="Arab" typeface="Arial"/>
|
292
|
+
<a:font script="Hebr" typeface="Arial"/>
|
293
|
+
<a:font script="Thai" typeface="Tahoma"/>
|
294
|
+
<a:font script="Ethi" typeface="Nyala"/>
|
295
|
+
<a:font script="Beng" typeface="Vrinda"/>
|
296
|
+
<a:font script="Gujr" typeface="Shruti"/>
|
297
|
+
<a:font script="Khmr" typeface="DaunPenh"/>
|
298
|
+
<a:font script="Knda" typeface="Tunga"/>
|
299
|
+
<a:font script="Guru" typeface="Raavi"/>
|
300
|
+
<a:font script="Cans" typeface="Euphemia"/>
|
301
|
+
<a:font script="Cher" typeface="Plantagenet Cherokee"/>
|
302
|
+
<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
|
303
|
+
<a:font script="Tibt" typeface="Microsoft Himalaya"/>
|
304
|
+
<a:font script="Thaa" typeface="MV Boli"/>
|
305
|
+
<a:font script="Deva" typeface="Mangal"/>
|
306
|
+
<a:font script="Telu" typeface="Gautami"/>
|
307
|
+
<a:font script="Taml" typeface="Latha"/>
|
308
|
+
<a:font script="Syrc" typeface="Estrangelo Edessa"/>
|
309
|
+
<a:font script="Orya" typeface="Kalinga"/>
|
310
|
+
<a:font script="Mlym" typeface="Kartika"/>
|
311
|
+
<a:font script="Laoo" typeface="DokChampa"/>
|
312
|
+
<a:font script="Sinh" typeface="Iskoola Pota"/>
|
313
|
+
<a:font script="Mong" typeface="Mongolian Baiti"/>
|
314
|
+
<a:font script="Viet" typeface="Arial"/>
|
315
|
+
<a:font script="Uigh" typeface="Microsoft Uighur"/>
|
316
|
+
</a:minorFont>
|
317
|
+
</a:fontScheme>
|
318
|
+
<a:fmtScheme name="Office">
|
319
|
+
<a:fillStyleLst>
|
320
|
+
<a:solidFill>
|
321
|
+
<a:schemeClr val="phClr"/>
|
322
|
+
</a:solidFill>
|
323
|
+
<a:gradFill rotWithShape="1">
|
324
|
+
<a:gsLst>
|
325
|
+
<a:gs pos="0">
|
326
|
+
<a:schemeClr val="phClr">
|
327
|
+
<a:tint val="50000"/>
|
328
|
+
<a:satMod val="300000"/>
|
329
|
+
</a:schemeClr>
|
330
|
+
</a:gs>
|
331
|
+
<a:gs pos="35000">
|
332
|
+
<a:schemeClr val="phClr">
|
333
|
+
<a:tint val="37000"/>
|
334
|
+
<a:satMod val="300000"/>
|
335
|
+
</a:schemeClr>
|
336
|
+
</a:gs>
|
337
|
+
<a:gs pos="100000">
|
338
|
+
<a:schemeClr val="phClr">
|
339
|
+
<a:tint val="15000"/>
|
340
|
+
<a:satMod val="350000"/>
|
341
|
+
</a:schemeClr>
|
342
|
+
</a:gs>
|
343
|
+
</a:gsLst>
|
344
|
+
<a:lin ang="16200000" scaled="1"/>
|
345
|
+
</a:gradFill>
|
346
|
+
<a:gradFill rotWithShape="1">
|
347
|
+
<a:gsLst>
|
348
|
+
<a:gs pos="0">
|
349
|
+
<a:schemeClr val="phClr">
|
350
|
+
<a:tint val="100000"/>
|
351
|
+
<a:shade val="100000"/>
|
352
|
+
<a:satMod val="130000"/>
|
353
|
+
</a:schemeClr>
|
354
|
+
</a:gs>
|
355
|
+
<a:gs pos="100000">
|
356
|
+
<a:schemeClr val="phClr">
|
357
|
+
<a:tint val="50000"/>
|
358
|
+
<a:shade val="100000"/>
|
359
|
+
<a:satMod val="350000"/>
|
360
|
+
</a:schemeClr>
|
361
|
+
</a:gs>
|
362
|
+
</a:gsLst>
|
363
|
+
<a:lin ang="16200000" scaled="0"/>
|
364
|
+
</a:gradFill>
|
365
|
+
</a:fillStyleLst>
|
366
|
+
<a:lnStyleLst>
|
367
|
+
<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr">
|
368
|
+
<a:solidFill>
|
369
|
+
<a:schemeClr val="phClr">
|
370
|
+
<a:shade val="95000"/>
|
371
|
+
<a:satMod val="105000"/>
|
372
|
+
</a:schemeClr>
|
373
|
+
</a:solidFill>
|
374
|
+
<a:prstDash val="solid"/>
|
375
|
+
</a:ln>
|
376
|
+
<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr">
|
377
|
+
<a:solidFill>
|
378
|
+
<a:schemeClr val="phClr"/>
|
379
|
+
</a:solidFill>
|
380
|
+
<a:prstDash val="solid"/>
|
381
|
+
</a:ln>
|
382
|
+
<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr">
|
383
|
+
<a:solidFill>
|
384
|
+
<a:schemeClr val="phClr"/>
|
385
|
+
</a:solidFill>
|
386
|
+
<a:prstDash val="solid"/>
|
387
|
+
</a:ln>
|
388
|
+
</a:lnStyleLst>
|
389
|
+
<a:effectStyleLst>
|
390
|
+
<a:effectStyle>
|
391
|
+
<a:effectLst>
|
392
|
+
<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0">
|
393
|
+
<a:srgbClr val="000000">
|
394
|
+
<a:alpha val="38000"/>
|
395
|
+
</a:srgbClr>
|
396
|
+
</a:outerShdw>
|
397
|
+
</a:effectLst>
|
398
|
+
</a:effectStyle>
|
399
|
+
<a:effectStyle>
|
400
|
+
<a:effectLst>
|
401
|
+
<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
|
402
|
+
<a:srgbClr val="000000">
|
403
|
+
<a:alpha val="35000"/>
|
404
|
+
</a:srgbClr>
|
405
|
+
</a:outerShdw>
|
406
|
+
</a:effectLst>
|
407
|
+
</a:effectStyle>
|
408
|
+
<a:effectStyle>
|
409
|
+
<a:effectLst>
|
410
|
+
<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
|
411
|
+
<a:srgbClr val="000000">
|
412
|
+
<a:alpha val="35000"/>
|
413
|
+
</a:srgbClr>
|
414
|
+
</a:outerShdw>
|
415
|
+
</a:effectLst>
|
416
|
+
<a:scene3d>
|
417
|
+
<a:camera prst="orthographicFront">
|
418
|
+
<a:rot lat="0" lon="0" rev="0"/>
|
419
|
+
</a:camera>
|
420
|
+
<a:lightRig rig="threePt" dir="t">
|
421
|
+
<a:rot lat="0" lon="0" rev="1200000"/>
|
422
|
+
</a:lightRig>
|
423
|
+
</a:scene3d>
|
424
|
+
<a:sp3d>
|
425
|
+
<a:bevelT w="63500" h="25400"/>
|
426
|
+
</a:sp3d>
|
427
|
+
</a:effectStyle>
|
428
|
+
</a:effectStyleLst>
|
429
|
+
<a:bgFillStyleLst>
|
430
|
+
<a:solidFill>
|
431
|
+
<a:schemeClr val="phClr"/>
|
432
|
+
</a:solidFill>
|
433
|
+
<a:gradFill rotWithShape="1">
|
434
|
+
<a:gsLst>
|
435
|
+
<a:gs pos="0">
|
436
|
+
<a:schemeClr val="phClr">
|
437
|
+
<a:tint val="40000"/>
|
438
|
+
<a:satMod val="350000"/>
|
439
|
+
</a:schemeClr>
|
440
|
+
</a:gs>
|
441
|
+
<a:gs pos="40000">
|
442
|
+
<a:schemeClr val="phClr">
|
443
|
+
<a:tint val="45000"/>
|
444
|
+
<a:shade val="99000"/>
|
445
|
+
<a:satMod val="350000"/>
|
446
|
+
</a:schemeClr>
|
447
|
+
</a:gs>
|
448
|
+
<a:gs pos="100000">
|
449
|
+
<a:schemeClr val="phClr">
|
450
|
+
<a:shade val="20000"/>
|
451
|
+
<a:satMod val="255000"/>
|
452
|
+
</a:schemeClr>
|
453
|
+
</a:gs>
|
454
|
+
</a:gsLst>
|
455
|
+
<a:path path="circle">
|
456
|
+
<a:fillToRect l="50000" t="-80000" r="50000" b="180000"/>
|
457
|
+
</a:path>
|
458
|
+
</a:gradFill>
|
459
|
+
<a:gradFill rotWithShape="1">
|
460
|
+
<a:gsLst>
|
461
|
+
<a:gs pos="0">
|
462
|
+
<a:schemeClr val="phClr">
|
463
|
+
<a:tint val="80000"/>
|
464
|
+
<a:satMod val="300000"/>
|
465
|
+
</a:schemeClr>
|
466
|
+
</a:gs>
|
467
|
+
<a:gs pos="100000">
|
468
|
+
<a:schemeClr val="phClr">
|
469
|
+
<a:shade val="30000"/>
|
470
|
+
<a:satMod val="200000"/>
|
471
|
+
</a:schemeClr>
|
472
|
+
</a:gs>
|
473
|
+
</a:gsLst>
|
474
|
+
<a:path path="circle">
|
475
|
+
<a:fillToRect l="50000" t="50000" r="50000" b="50000"/>
|
476
|
+
</a:path>
|
477
|
+
</a:gradFill>
|
478
|
+
</a:bgFillStyleLst>
|
479
|
+
</a:fmtScheme>
|
480
|
+
</a:themeElements>
|
481
|
+
<a:objectDefaults>
|
482
|
+
<a:spDef>
|
483
|
+
<a:spPr/>
|
484
|
+
<a:bodyPr/>
|
485
|
+
<a:lstStyle/>
|
486
|
+
<a:style>
|
487
|
+
<a:lnRef idx="1">
|
488
|
+
<a:schemeClr val="accent1"/>
|
489
|
+
</a:lnRef>
|
490
|
+
<a:fillRef idx="3">
|
491
|
+
<a:schemeClr val="accent1"/>
|
492
|
+
</a:fillRef>
|
493
|
+
<a:effectRef idx="2">
|
494
|
+
<a:schemeClr val="accent1"/>
|
495
|
+
</a:effectRef>
|
496
|
+
<a:fontRef idx="minor">
|
497
|
+
<a:schemeClr val="lt1"/>
|
498
|
+
</a:fontRef>
|
499
|
+
</a:style>
|
500
|
+
</a:spDef>
|
501
|
+
<a:lnDef>
|
502
|
+
<a:spPr/>
|
503
|
+
<a:bodyPr/>
|
504
|
+
<a:lstStyle/>
|
505
|
+
<a:style>
|
506
|
+
<a:lnRef idx="2">
|
507
|
+
<a:schemeClr val="accent1"/>
|
508
|
+
</a:lnRef>
|
509
|
+
<a:fillRef idx="0">
|
510
|
+
<a:schemeClr val="accent1"/>
|
511
|
+
</a:fillRef>
|
512
|
+
<a:effectRef idx="1">
|
513
|
+
<a:schemeClr val="accent1"/>
|
514
|
+
</a:effectRef>
|
515
|
+
<a:fontRef idx="minor">
|
516
|
+
<a:schemeClr val="tx1"/>
|
517
|
+
</a:fontRef>
|
518
|
+
</a:style>
|
519
|
+
</a:lnDef>
|
520
|
+
</a:objectDefaults>
|
521
|
+
<a:extraClrSchemeLst/>
|
522
|
+
</a:theme>'
|
523
|
+
|
524
|
+
end
|
525
|
+
######
|
526
|
+
|
527
|
+
end
|
528
|
+
|
529
|
+
end
|