rubyXL 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. data/VERSION +1 -1
  2. data/lib/rubyXL.rb +1 -0
  3. data/lib/rubyXL/objects/border.rb +3 -4
  4. data/lib/rubyXL/objects/calculation_chain.rb +1 -1
  5. data/lib/rubyXL/objects/cell_style.rb +3 -4
  6. data/lib/rubyXL/objects/chartsheet.rb +78 -0
  7. data/lib/rubyXL/objects/container_nodes.rb +2 -3
  8. data/lib/rubyXL/objects/data_validation.rb +5 -10
  9. data/lib/rubyXL/objects/document_properties.rb +1 -1
  10. data/lib/rubyXL/objects/fill.rb +3 -6
  11. data/lib/rubyXL/objects/filters.rb +120 -0
  12. data/lib/rubyXL/objects/formula.rb +2 -2
  13. data/lib/rubyXL/objects/ooxml_object.rb +116 -56
  14. data/lib/rubyXL/objects/relationships.rb +5 -1
  15. data/lib/rubyXL/objects/shared_strings.rb +1 -1
  16. data/lib/rubyXL/objects/sheet_common.rb +50 -0
  17. data/lib/rubyXL/objects/sheet_data.rb +6 -1
  18. data/lib/rubyXL/objects/simple_types.rb +78 -0
  19. data/lib/rubyXL/objects/stylesheet.rb +15 -3
  20. data/lib/rubyXL/objects/text.rb +4 -5
  21. data/lib/rubyXL/objects/workbook.rb +151 -26
  22. data/lib/rubyXL/objects/worksheet.rb +329 -107
  23. data/lib/rubyXL/parser.rb +12 -11
  24. data/lib/rubyXL/workbook.rb +3 -2
  25. data/rdoc/README_rdoc.html +404 -0
  26. data/rdoc/RubyXL.html +337 -0
  27. data/rdoc/RubyXL/AExtensionStorageArea.html +105 -0
  28. data/rdoc/RubyXL/Alignment.html +108 -0
  29. data/rdoc/RubyXL/AlternateContent.html +105 -0
  30. data/rdoc/RubyXL/AutoFilter.html +105 -0
  31. data/rdoc/RubyXL/AutoFilterColumn.html +105 -0
  32. data/rdoc/RubyXL/BooleanNode.html +105 -0
  33. data/rdoc/RubyXL/BooleanValue.html +105 -0
  34. data/rdoc/RubyXL/Border.html +105 -0
  35. data/rdoc/RubyXL/BorderContainer.html +105 -0
  36. data/rdoc/RubyXL/BorderEdge.html +156 -0
  37. data/rdoc/RubyXL/Break.html +105 -0
  38. data/rdoc/RubyXL/BreakList.html +105 -0
  39. data/rdoc/RubyXL/CalculationChain.html +159 -0
  40. data/rdoc/RubyXL/CalculationChainCell.html +108 -0
  41. data/rdoc/RubyXL/CalculationProperties.html +105 -0
  42. data/rdoc/RubyXL/Cell.html +428 -0
  43. data/rdoc/RubyXL/CellSmartTag.html +105 -0
  44. data/rdoc/RubyXL/CellSmartTagContainer.html +105 -0
  45. data/rdoc/RubyXL/CellSmartTagProperty.html +105 -0
  46. data/rdoc/RubyXL/CellStyle.html +108 -0
  47. data/rdoc/RubyXL/CellStyleContainer.html +105 -0
  48. data/rdoc/RubyXL/CellStyleXFContainer.html +105 -0
  49. data/rdoc/RubyXL/CellValue.html +108 -0
  50. data/rdoc/RubyXL/CellWatch.html +105 -0
  51. data/rdoc/RubyXL/CellWatchContainer.html +105 -0
  52. data/rdoc/RubyXL/CellXFContainer.html +105 -0
  53. data/rdoc/RubyXL/Chartsheet.html +105 -0
  54. data/rdoc/RubyXL/ChartsheetPageSetup.html +105 -0
  55. data/rdoc/RubyXL/ChartsheetProperties.html +108 -0
  56. data/rdoc/RubyXL/ChartsheetProtection.html +108 -0
  57. data/rdoc/RubyXL/ChartsheetView.html +105 -0
  58. data/rdoc/RubyXL/ChartsheetViewContainer.html +105 -0
  59. data/rdoc/RubyXL/Color.html +163 -0
  60. data/rdoc/RubyXL/ColorFilter.html +105 -0
  61. data/rdoc/RubyXL/ColorScale.html +105 -0
  62. data/rdoc/RubyXL/ColorScheme.html +105 -0
  63. data/rdoc/RubyXL/ColorSet.html +105 -0
  64. data/rdoc/RubyXL/Colors.html +105 -0
  65. data/rdoc/RubyXL/ColumnRange.html +233 -0
  66. data/rdoc/RubyXL/ColumnRanges.html +275 -0
  67. data/rdoc/RubyXL/ConditionalFormatValue.html +105 -0
  68. data/rdoc/RubyXL/ConditionalFormatting.html +105 -0
  69. data/rdoc/RubyXL/ConditionalFormattingRule.html +105 -0
  70. data/rdoc/RubyXL/CustomFilter.html +105 -0
  71. data/rdoc/RubyXL/CustomFilterContainer.html +105 -0
  72. data/rdoc/RubyXL/CustomProperty.html +105 -0
  73. data/rdoc/RubyXL/CustomPropertyContainer.html +105 -0
  74. data/rdoc/RubyXL/CustomSheetView.html +105 -0
  75. data/rdoc/RubyXL/CustomSheetViews.html +105 -0
  76. data/rdoc/RubyXL/CustomWorkbookView.html +105 -0
  77. data/rdoc/RubyXL/CustomWorkbookViewContainer.html +105 -0
  78. data/rdoc/RubyXL/DXF.html +105 -0
  79. data/rdoc/RubyXL/DXFs.html +105 -0
  80. data/rdoc/RubyXL/DataBar.html +105 -0
  81. data/rdoc/RubyXL/DataConsolidate.html +105 -0
  82. data/rdoc/RubyXL/DataConsolidationReference.html +105 -0
  83. data/rdoc/RubyXL/DataConsolidationReferences.html +105 -0
  84. data/rdoc/RubyXL/DataValidation.html +108 -0
  85. data/rdoc/RubyXL/DataValidations.html +105 -0
  86. data/rdoc/RubyXL/DateGroupItem.html +108 -0
  87. data/rdoc/RubyXL/DefinedName.html +105 -0
  88. data/rdoc/RubyXL/DefinedNames.html +105 -0
  89. data/rdoc/RubyXL/DocumentProperties.html +271 -0
  90. data/rdoc/RubyXL/DynamicFilter.html +105 -0
  91. data/rdoc/RubyXL/EmbeddedControl.html +105 -0
  92. data/rdoc/RubyXL/EmbeddedControlContainer.html +105 -0
  93. data/rdoc/RubyXL/Extension.html +228 -0
  94. data/rdoc/RubyXL/ExtensionStorageArea.html +108 -0
  95. data/rdoc/RubyXL/ExternalReference.html +105 -0
  96. data/rdoc/RubyXL/ExternalReferences.html +105 -0
  97. data/rdoc/RubyXL/FieldItem.html +105 -0
  98. data/rdoc/RubyXL/FileRecoveryProperties.html +105 -0
  99. data/rdoc/RubyXL/FileSharing.html +108 -0
  100. data/rdoc/RubyXL/FileVersion.html +108 -0
  101. data/rdoc/RubyXL/Fill.html +105 -0
  102. data/rdoc/RubyXL/FillContainer.html +105 -0
  103. data/rdoc/RubyXL/FilterContainer.html +105 -0
  104. data/rdoc/RubyXL/FloatNode.html +105 -0
  105. data/rdoc/RubyXL/FloatValue.html +105 -0
  106. data/rdoc/RubyXL/Font.html +655 -0
  107. data/rdoc/RubyXL/FontContainer.html +105 -0
  108. data/rdoc/RubyXL/FontScheme.html +105 -0
  109. data/rdoc/RubyXL/FormatScheme.html +105 -0
  110. data/rdoc/RubyXL/Formula.html +108 -0
  111. data/rdoc/RubyXL/FunctionGroup.html +105 -0
  112. data/rdoc/RubyXL/FunctionGroupContainer.html +105 -0
  113. data/rdoc/RubyXL/GenericStorage.html +344 -0
  114. data/rdoc/RubyXL/GradientFill.html +105 -0
  115. data/rdoc/RubyXL/HeaderFooterSettings.html +105 -0
  116. data/rdoc/RubyXL/Hyperlink.html +105 -0
  117. data/rdoc/RubyXL/HyperlinkContainer.html +105 -0
  118. data/rdoc/RubyXL/IconFilter.html +105 -0
  119. data/rdoc/RubyXL/IconSet.html +105 -0
  120. data/rdoc/RubyXL/IgnoredError.html +105 -0
  121. data/rdoc/RubyXL/IgnoredErrorContainer.html +105 -0
  122. data/rdoc/RubyXL/IndexedColorContainer.html +105 -0
  123. data/rdoc/RubyXL/InputCells.html +105 -0
  124. data/rdoc/RubyXL/IntegerNode.html +105 -0
  125. data/rdoc/RubyXL/IntegerValue.html +105 -0
  126. data/rdoc/RubyXL/LegacyCell.html +1498 -0
  127. data/rdoc/RubyXL/LegacyWorkbook.html +1283 -0
  128. data/rdoc/RubyXL/LegacyWorksheet.html +3291 -0
  129. data/rdoc/RubyXL/MRUColorContainer.html +105 -0
  130. data/rdoc/RubyXL/MergedCell.html +105 -0
  131. data/rdoc/RubyXL/MergedCells.html +105 -0
  132. data/rdoc/RubyXL/NumFmt.html +105 -0
  133. data/rdoc/RubyXL/NumberFormat.html +160 -0
  134. data/rdoc/RubyXL/NumberFormatContainer.html +173 -0
  135. data/rdoc/RubyXL/OLEObject.html +105 -0
  136. data/rdoc/RubyXL/OLEObjects.html +105 -0
  137. data/rdoc/RubyXL/OLESize.html +105 -0
  138. data/rdoc/RubyXL/OOXMLObject.html +862 -0
  139. data/rdoc/RubyXL/OOXMLTopLevelObject.html +105 -0
  140. data/rdoc/RubyXL/OutlineProperties.html +108 -0
  141. data/rdoc/RubyXL/PageMargins.html +105 -0
  142. data/rdoc/RubyXL/PageSetup.html +105 -0
  143. data/rdoc/RubyXL/PageSetupProperties.html +108 -0
  144. data/rdoc/RubyXL/Pane.html +105 -0
  145. data/rdoc/RubyXL/Parser.html +348 -0
  146. data/rdoc/RubyXL/PatternFill.html +105 -0
  147. data/rdoc/RubyXL/PhoneticProperties.html +105 -0
  148. data/rdoc/RubyXL/PhoneticRun.html +105 -0
  149. data/rdoc/RubyXL/PivotArea.html +105 -0
  150. data/rdoc/RubyXL/PivotCache.html +105 -0
  151. data/rdoc/RubyXL/PivotCaches.html +105 -0
  152. data/rdoc/RubyXL/PivotReference.html +105 -0
  153. data/rdoc/RubyXL/PivotReferenceContainer.html +105 -0
  154. data/rdoc/RubyXL/PivotTableSelection.html +105 -0
  155. data/rdoc/RubyXL/PrintOptions.html +105 -0
  156. data/rdoc/RubyXL/ProtectedRange.html +105 -0
  157. data/rdoc/RubyXL/ProtectedRanges.html +105 -0
  158. data/rdoc/RubyXL/Protection.html +105 -0
  159. data/rdoc/RubyXL/RID.html +105 -0
  160. data/rdoc/RubyXL/RawOOXML.html +225 -0
  161. data/rdoc/RubyXL/Reference.html +642 -0
  162. data/rdoc/RubyXL/Relationship.html +105 -0
  163. data/rdoc/RubyXL/RichText.html +105 -0
  164. data/rdoc/RubyXL/RichTextRun.html +105 -0
  165. data/rdoc/RubyXL/Row.html +105 -0
  166. data/rdoc/RubyXL/RunProperties.html +108 -0
  167. data/rdoc/RubyXL/Scenario.html +105 -0
  168. data/rdoc/RubyXL/ScenarioContainer.html +105 -0
  169. data/rdoc/RubyXL/Selection.html +105 -0
  170. data/rdoc/RubyXL/SharedStringsTable.html +397 -0
  171. data/rdoc/RubyXL/Sheet.html +105 -0
  172. data/rdoc/RubyXL/SheetCalculationProperties.html +105 -0
  173. data/rdoc/RubyXL/SheetData.html +105 -0
  174. data/rdoc/RubyXL/Sheets.html +105 -0
  175. data/rdoc/RubyXL/SmartTagContainer.html +105 -0
  176. data/rdoc/RubyXL/SmartTagProperties.html +105 -0
  177. data/rdoc/RubyXL/SmartTagType.html +105 -0
  178. data/rdoc/RubyXL/SmartTagTypeContainer.html +105 -0
  179. data/rdoc/RubyXL/SortCondition.html +105 -0
  180. data/rdoc/RubyXL/SortState.html +105 -0
  181. data/rdoc/RubyXL/Sqref.html +199 -0
  182. data/rdoc/RubyXL/Stop.html +108 -0
  183. data/rdoc/RubyXL/StringNode.html +105 -0
  184. data/rdoc/RubyXL/StringValue.html +105 -0
  185. data/rdoc/RubyXL/Stylesheet.html +105 -0
  186. data/rdoc/RubyXL/TableParts.html +105 -0
  187. data/rdoc/RubyXL/TableStyle.html +105 -0
  188. data/rdoc/RubyXL/TableStyles.html +105 -0
  189. data/rdoc/RubyXL/Text.html +195 -0
  190. data/rdoc/RubyXL/Theme.html +105 -0
  191. data/rdoc/RubyXL/ThemeElements.html +105 -0
  192. data/rdoc/RubyXL/Top10.html +105 -0
  193. data/rdoc/RubyXL/Variant.html +108 -0
  194. data/rdoc/RubyXL/Vector.html +105 -0
  195. data/rdoc/RubyXL/VectorValue.html +105 -0
  196. data/rdoc/RubyXL/WebPublishObject.html +105 -0
  197. data/rdoc/RubyXL/WebPublishObjectContainer.html +105 -0
  198. data/rdoc/RubyXL/WebPublishingItem.html +108 -0
  199. data/rdoc/RubyXL/WebPublishingItemContainer.html +105 -0
  200. data/rdoc/RubyXL/WebPublishingProperties.html +105 -0
  201. data/rdoc/RubyXL/Workbook.html +105 -0
  202. data/rdoc/RubyXL/WorkbookProperties.html +108 -0
  203. data/rdoc/RubyXL/WorkbookProtection.html +105 -0
  204. data/rdoc/RubyXL/WorkbookRelationships.html +316 -0
  205. data/rdoc/RubyXL/WorkbookView.html +105 -0
  206. data/rdoc/RubyXL/WorkbookViews.html +105 -0
  207. data/rdoc/RubyXL/Worksheet.html +105 -0
  208. data/rdoc/RubyXL/WorksheetDimensions.html +105 -0
  209. data/rdoc/RubyXL/WorksheetFormatProperties.html +105 -0
  210. data/rdoc/RubyXL/WorksheetProperties.html +108 -0
  211. data/rdoc/RubyXL/WorksheetProtection.html +105 -0
  212. data/rdoc/RubyXL/WorksheetView.html +105 -0
  213. data/rdoc/RubyXL/WorksheetViews.html +105 -0
  214. data/rdoc/RubyXL/Writer.html +98 -0
  215. data/rdoc/RubyXL/Writer/ContentTypesWriter.html +289 -0
  216. data/rdoc/RubyXL/Writer/CoreWriter.html +210 -0
  217. data/rdoc/RubyXL/Writer/GenericWriter.html +348 -0
  218. data/rdoc/RubyXL/Writer/RootRelsWriter.html +193 -0
  219. data/rdoc/RubyXL/Writer/StylesWriter.html +191 -0
  220. data/rdoc/RubyXL/Writer/ThemeWriter.html +511 -0
  221. data/rdoc/RubyXL/Writer/WorkbookWriter.html +249 -0
  222. data/rdoc/RubyXL/Writer/WorksheetWriter.html +236 -0
  223. data/rdoc/RubyXL/XF.html +105 -0
  224. data/rdoc/created.rid +24 -21
  225. data/rdoc/index.html +216 -0
  226. data/rdoc/js/search_index.js +1 -1
  227. data/rdoc/table_of_contents.html +1496 -0
  228. data/rubyXL.gemspec +211 -4
  229. data/spec/lib/parser_spec.rb +18 -6
  230. data/test/input/.gitkeep +0 -0
  231. data/test/output/.gitkeep +0 -0
  232. data/test/test_parse_write.rb +15 -0
  233. metadata +211 -4
  234. data/lib/rubyXL/objects/sheet_view.rb +0 -71
@@ -1,9 +1,12 @@
1
1
  require 'rubyXL/objects/ooxml_object'
2
+ require 'rubyXL/objects/simple_types'
2
3
  require 'rubyXL/objects/extensions'
4
+ require 'rubyXL/objects/relationships'
5
+ require 'rubyXL/objects/sheet_common'
3
6
  require 'rubyXL/objects/text'
4
7
  require 'rubyXL/objects/formula'
5
- require 'rubyXL/objects/sheet_view'
6
8
  require 'rubyXL/objects/sheet_data'
9
+ require 'rubyXL/objects/filters'
7
10
  require 'rubyXL/objects/data_validation'
8
11
 
9
12
  module RubyXL
@@ -62,17 +65,6 @@ module RubyXL
62
65
  define_element_name 'sheetFormatPr'
63
66
  end
64
67
 
65
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pageMargins-1.html
66
- class PageMargins < OOXMLObject
67
- define_attribute(:left, :float, :required => true)
68
- define_attribute(:right, :float, :required => true)
69
- define_attribute(:top, :float, :required => true)
70
- define_attribute(:bottom, :float, :required => true)
71
- define_attribute(:header, :float, :required => true)
72
- define_attribute(:footer, :float, :required => true)
73
- define_element_name 'pageMargins'
74
- end
75
-
76
68
  # http://www.schemacentral.com/sc/ooxml/e-ssml_pageSetup-1.html
77
69
  class PageSetup < OOXMLObject
78
70
  define_attribute(:paperSize, :int, :default => 1)
@@ -80,30 +72,21 @@ module RubyXL
80
72
  define_attribute(:firstPageNumber, :int, :default => 1)
81
73
  define_attribute(:fitToWidth, :int, :default => 1)
82
74
  define_attribute(:fitToHeight, :int, :default => 1)
83
- define_attribute(:pageOrder, :string, :default => 'downThenOver',
84
- :values => %w{ downThenOver overThenDown })
85
- define_attribute(:orientation, :string, :default => 'default',
86
- :values => %w{ default portrait landscape })
75
+ define_attribute(:pageOrder, RubyXL::ST_PageOrder, :default => 'downThenOver')
76
+ define_attribute(:orientation, RubyXL::ST_Orientation, :default => 'default')
87
77
  define_attribute(:usePrinterDefaults, :bool, :default => true)
88
78
  define_attribute(:blackAndWhite, :bool, :default => false)
89
79
  define_attribute(:draft, :bool, :default => false)
90
- define_attribute(:cellComments, :string, :default => 'none',
91
- :values => %w{ none asDisplayed atEnd })
80
+ define_attribute(:cellComments, RubyXL::ST_CellComments, :default => 'none')
92
81
  define_attribute(:useFirstPageNumber, :bool, :default => false)
93
- define_attribute(:errors, :string, :default => 'displayed',
94
- :values => %w{ displayed blank dash NA })
82
+ define_attribute(:errors, RubyXL::ST_PrintError, :default => 'displayed')
95
83
  define_attribute(:horizontalDpi, :int, :default => 600)
96
84
  define_attribute(:verticalDpi, :int, :default => 600)
97
85
  define_attribute(:copies, :int, :default => 1)
98
-
99
86
  define_attribute(:'r:id', :string)
100
87
  define_element_name 'pageSetup'
101
88
  end
102
89
 
103
- class RID < OOXMLObject
104
- define_attribute(:'r:id', :string, :required => true)
105
- end
106
-
107
90
  class TableParts < OOXMLObject
108
91
  define_child_node(RubyXL::RID, :collection => :with_count, :node_name => :table_part)
109
92
  define_element_name 'tableParts'
@@ -131,21 +114,6 @@ module RubyXL
131
114
  define_element_name 'printOptions'
132
115
  end
133
116
 
134
- # http://www.schemacentral.com/sc/ooxml/e-ssml_headerFooter-1.html
135
- class HeaderFooterSettings < OOXMLObject
136
- define_attribute(:differentOddEven, :bool, :default => false)
137
- define_attribute(:differentFirst, :bool, :default => false)
138
- define_attribute(:scaleWithDoc, :bool, :default => true)
139
- define_attribute(:alignWithMargins, :bool, :default => true)
140
- define_child_node(RubyXL::StringValue, :node_name => :oddHeader)
141
- define_child_node(RubyXL::StringValue, :node_name => :oddFooter)
142
- define_child_node(RubyXL::StringValue, :node_name => :evenHeader)
143
- define_child_node(RubyXL::StringValue, :node_name => :evenFooter)
144
- define_child_node(RubyXL::StringValue, :node_name => :firstHeader)
145
- define_child_node(RubyXL::StringValue, :node_name => :firstFooter)
146
- define_element_name 'headerFooter'
147
- end
148
-
149
117
  # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetCalcPr-1.html
150
118
  class SheetCalculationProperties < OOXMLObject
151
119
  define_attribute(:fullCalcOnLoad, :bool, :default => false)
@@ -168,7 +136,7 @@ module RubyXL
168
136
  end
169
137
 
170
138
  # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetProtection-1.html
171
- class SheetProtection < OOXMLObject
139
+ class WorksheetProtection < OOXMLObject
172
140
  define_attribute(:password, :string)
173
141
  define_attribute(:sheet, :bool, :default => false)
174
142
  define_attribute(:objects, :bool, :default => false)
@@ -191,8 +159,7 @@ module RubyXL
191
159
 
192
160
  # http://www.schemacentral.com/sc/ooxml/e-ssml_cfvo-1.html
193
161
  class ConditionalFormatValue < OOXMLObject
194
- define_attribute(:type, :string, :required => true, :values =>
195
- %w{ num percent max min formula percentile })
162
+ define_attribute(:type, RubyXL::ST_CfvoType, :required => true)
196
163
  define_attribute(:val, :string)
197
164
  define_attribute(:gte, :bool, :default => true)
198
165
  define_child_node(RubyXL::ExtensionStorageArea)
@@ -218,10 +185,7 @@ module RubyXL
218
185
 
219
186
  # http://www.schemacentral.com/sc/ooxml/e-ssml_iconSet-1.html
220
187
  class IconSet < OOXMLObject
221
- define_attribute(:type, :string, :required => true, :default => '3TrafficLights1', :values =>
222
- %w{ 3Arrows 3ArrowsGray 3Flags 3TrafficLights1 3TrafficLights2
223
- 3Signs 3Symbols 3Symbols2 4Arrows 4ArrowsGray 4RedToBlack
224
- 4Rating 4TrafficLights 5Arrows 5ArrowsGray 5Rating 5Quarters })
188
+ define_attribute(:type, RubyXL::ST_IconSetType, :required => true, :default => '3TrafficLights1')
225
189
  define_attribute(:showValue, :bool, :default => true)
226
190
  define_attribute(:percent, :bool, :default => true)
227
191
  define_attribute(:reverse, :bool, :default => false)
@@ -231,24 +195,16 @@ module RubyXL
231
195
 
232
196
  # http://www.schemacentral.com/sc/ooxml/e-ssml_cfRule-1.html
233
197
  class ConditionalFormattingRule < OOXMLObject
234
- define_attribute(:type, :string, :values =>
235
- %w{ expression cellIs colorScale dataBar iconSet top10 uniqueValues
236
- duplicateValues containsText notContainsText beginsWith
237
- endsWith containsBlanks notContainsBlanks containsErrors
238
- notContainsErrors timePeriod aboveAverage })
198
+ define_attribute(:type, RubyXL::ST_CfType)
239
199
  define_attribute(:dxfId, :int)
240
200
  define_attribute(:priority, :int, :required => 1)
241
201
  define_attribute(:stopIfTrue, :bool, :default => false)
242
202
  define_attribute(:aboveAverage, :bool, :default => true)
243
203
  define_attribute(:percent, :bool, :default => false)
244
204
  define_attribute(:bottom, :bool, :default => false)
245
- define_attribute(:operator, :string, :values =>
246
- %w{ lessThan lessThanOrEqual equal notEqual greaterThanOrEqual greaterThan
247
- between notBetween containsText notContains beginsWith endsWith })
205
+ define_attribute(:operator, RubyXL::ST_ConditionalFormattingOperator)
248
206
  define_attribute(:text, :string)
249
- define_attribute(:timePeriod, :string, :values =>
250
- %w{ today yesterday tomorrow last7Days thisMonth
251
- lastMonth nextMonth thisWeek lastWeek nextWeek })
207
+ define_attribute(:timePeriod, RubyXL::ST_TimePeriod)
252
208
  define_attribute(:rank, :int)
253
209
  define_attribute(:stdDev, :int)
254
210
  define_attribute(:equalAverage, :bool, :default => false)
@@ -333,39 +289,11 @@ module RubyXL
333
289
 
334
290
  # http://www.schemacentral.com/sc/ooxml/e-ssml_ignoredErrors-1.html
335
291
  class IgnoredErrorContainer < OOXMLObject
336
- define_child_node(RubyXL::IgnoredError, :collection => true, :accessor => :scenarios)
292
+ define_child_node(RubyXL::IgnoredError, :collection => true, :accessor => :ignored_errors)
337
293
  define_child_node(RubyXL::ExtensionStorageArea)
338
294
  define_element_name 'ignoredErrors'
339
295
  end
340
296
 
341
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sortCondition-1.html
342
- class SortCondition < OOXMLObject
343
- define_attribute(:descending, :bool, :default => false)
344
- define_attribute(:sortBy, :string, :default => 'value',
345
- :values => %w{ value cellColor fontColor icon })
346
- define_attribute(:ref, :ref, :required => true)
347
- define_attribute(:customList, :string)
348
- define_attribute(:dxfId, :int)
349
- define_attribute(:iconSet, :string, :required => true, :default => '3Arrows', :values =>
350
- %w{ 3Arrows 3ArrowsGray 3Flags 3TrafficLights1 3TrafficLights2
351
- 3Signs 3Symbols 3Symbols2 4Arrows 4ArrowsGray 4RedToBlack
352
- 4Rating 4TrafficLights 5Arrows 5ArrowsGray 5Rating 5Quarters })
353
- define_attribute(:iconId, :int)
354
- define_element_name 'sortCondition'
355
- end
356
-
357
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sortState-2.html
358
- class SortState < OOXMLObject
359
- define_attribute(:columnSort, :bool, :default => false)
360
- define_attribute(:caseSensitive, :bool, :default => false)
361
- define_attribute(:sortMethod, :string, :default => 'none',
362
- :values => %w{ stroke pinYin none })
363
- define_attribute(:ref, :ref, :required => true)
364
- define_child_node(RubyXL::SortCondition, :colection => true)
365
- define_child_node(RubyXL::ExtensionStorageArea)
366
- define_element_name 'sortState'
367
- end
368
-
369
297
  # http://www.schemacentral.com/sc/ooxml/e-ssml_hyperlink-1.html
370
298
  class Hyperlink < OOXMLObject
371
299
  define_attribute(:ref, :ref, :required => true)
@@ -382,24 +310,318 @@ module RubyXL
382
310
  define_element_name 'hyperlinks'
383
311
  end
384
312
 
313
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_oleObject-1.html
314
+ class OLEObject < OOXMLObject
315
+ define_attribute(:progId, :string)
316
+ define_attribute(:dvAspect, RubyXL::ST_DvAspect, :default => 'DVASPECT_CONTENT')
317
+ define_attribute(:link, :string)
318
+ define_attribute(:oleUpdate, RubyXL::ST_OleUpdate)
319
+ define_attribute(:autoLoad, :bool, :default => false)
320
+ define_attribute(:shapeId, :int, :required => true)
321
+ define_attribute(:'r:id', :string)
322
+ define_element_name 'oleObject'
323
+ end
324
+
325
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_oleObjects-1.html
326
+ class OLEObjects < OOXMLObject
327
+ define_child_node(RubyXL::OLEObject, :colection => true, :accessor => :ole_objects)
328
+ define_element_name 'oleObjects'
329
+ end
330
+
331
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_dataRef-1.html
332
+ class DataConsolidationReference < OOXMLObject
333
+ define_attribute(:ref, :ref)
334
+ define_attribute(:name, :string)
335
+ define_attribute(:sheet, :string)
336
+ define_attribute(:'r:id', :string)
337
+ define_element_name 'dataRef'
338
+ end
339
+
340
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_dataRefs-1.html
341
+ class DataConsolidationReferences < OOXMLObject
342
+ define_child_node(RubyXL::DataConsolidationReference, :collection => :with_count, :accessor => :data_cons_ref)
343
+ define_element_name 'dataRefs'
344
+ end
345
+
346
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_dataConsolidate-1.html
347
+ class DataConsolidate < OOXMLObject
348
+ define_attribute(:function, RubyXL::ST_DataConsolidateFunction, :default => 'sum')
349
+ define_attribute(:leftLabels, :bool, :default => false)
350
+ define_attribute(:topLabels, :bool, :default => false)
351
+ define_attribute(:link, :bool, :default => false)
352
+ define_child_node(RubyXL::DataConsolidationReferences, :accessor => :data_cons_ref_container)
353
+ define_element_name 'dataConsolidate'
354
+ end
355
+
356
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pane-1.html
357
+ class Pane < OOXMLObject
358
+ define_attribute(:xSplit, :int)
359
+ define_attribute(:ySplit, :int)
360
+ define_attribute(:topLeftCell, :string)
361
+ define_attribute(:activePane, RubyXL::ST_Pane, :default => 'topLeft', )
362
+ define_attribute(:state, RubyXL::ST_PaneState, :default=> 'split')
363
+ define_element_name 'pane'
364
+ end
365
+
366
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_selection-1.html
367
+ class Selection < OOXMLObject
368
+ define_attribute(:pane, RubyXL::ST_Pane)
369
+ define_attribute(:activeCell, :ref)
370
+ define_attribute(:activeCellId, :int) # 0-based index of @active_cell in @sqref
371
+ define_attribute(:sqref, :sqref) # Array of references to the selected cells.
372
+ define_element_name 'selection'
373
+
374
+ def before_write_xml
375
+ # Normally, rindex of activeCellId in sqref:
376
+ # <selection activeCell="E12" activeCellId="9" sqref="A4 B6 C8 D10 E12 A4 B6 C8 D10 E12"/>
377
+ if @active_cell_id.nil? && !@active_cell.nil? && @sqref.size > 1 then
378
+ # But, things can be more complex:
379
+ # <selection activeCell="E8" activeCellId="2" sqref="A4:B4 C6:D6 E8:F8"/>
380
+ # Not using .reverse.each here to avoid memory reallocation.
381
+ @sqref.each_with_index { |ref, ind| @active_cell_id = ind if ref.cover?(@active_cell) }
382
+ end
383
+ true
384
+ end
385
+ end
386
+
387
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customSheetView-1.html
388
+ class CustomSheetView < OOXMLObject
389
+ define_attribute(:guid, :string, :required => true)
390
+ define_attribute(:scale, :int, :default => 100)
391
+ define_attribute(:colorId, :int, :default => 64)
392
+ define_attribute(:showPageBreaks, :bool, :default => false)
393
+ define_attribute(:showFormulas, :bool, :default => false)
394
+ define_attribute(:showGridLines, :bool, :default => true)
395
+ define_attribute(:showRowCol, :bool, :default => true)
396
+ define_attribute(:outlineSymbols, :bool, :default => true)
397
+ define_attribute(:zeroValues, :bool, :default => true)
398
+ define_attribute(:fitToPage, :bool, :default => false)
399
+ define_attribute(:printArea, :bool, :default => false)
400
+ define_attribute(:filter, :bool, :default => false)
401
+ define_attribute(:showAutoFilter, :bool, :default => false)
402
+ define_attribute(:hiddenRows, :bool, :default => false)
403
+ define_attribute(:hiddenColumns, :bool, :default => false)
404
+ define_attribute(:state, RubyXL::ST_Visibility, :default => 'visible')
405
+ define_attribute(:filterUnique, :bool, :default => false)
406
+ define_attribute(:view, RubyXL::ST_SheetViewType, :default => 'normal')
407
+ define_attribute(:showRuler, :bool, :default => true)
408
+ define_attribute(:topLeftCell, :ref)
409
+ define_child_node(RubyXL::Pane)
410
+ define_child_node(RubyXL::Selection)
411
+ define_child_node(RubyXL::BreakList, :node_name => :rowBreaks)
412
+ define_child_node(RubyXL::BreakList, :node_name => :colBreaks)
413
+ define_child_node(RubyXL::PageMargins)
414
+ define_child_node(RubyXL::PrintOptions)
415
+ define_child_node(RubyXL::PageSetup)
416
+ define_child_node(RubyXL::HeaderFooterSettings)
417
+ define_child_node(RubyXL::AutoFilter)
418
+ define_child_node(RubyXL::ExtensionStorageArea)
419
+ define_element_name 'customSheetView'
420
+ end
421
+
422
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customSheetViews-1.html
423
+ class CustomSheetViews < OOXMLObject
424
+ define_child_node(RubyXL::CustomSheetView, :collection => true, :accessor => :custom_sheet_view)
425
+ define_element_name 'customSheetViews'
426
+ end
427
+
428
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_control-1.html
429
+ class EmbeddedControl < OOXMLObject
430
+ define_attribute(:shapeId, :int, :required => :true)
431
+ define_attribute(:'r:id', :string, :required => :true)
432
+ define_attribute(:name, :string)
433
+ define_element_name 'control'
434
+ end
435
+
436
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_controls-1.html
437
+ class EmbeddedControlContainer < OOXMLObject
438
+ define_child_node(RubyXL::EmbeddedControl, :collection => true, :accessor => :controls)
439
+ define_element_name 'controls'
440
+ end
441
+
442
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_cellWatch-1.html
443
+ class CellWatch < OOXMLObject
444
+ define_attribute(:r, :ref)
445
+ define_element_name 'cellWatch'
446
+ end
447
+
448
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_cellWatches-1.html
449
+ class CellWatchContainer < OOXMLObject
450
+ define_child_node(RubyXL::CellWatch, :collection => true, :accessor => :cell_watches)
451
+ define_element_name 'cellWatches'
452
+ end
453
+
454
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTagPr-1.html
455
+ class CellSmartTagProperty < OOXMLObject
456
+ define_attribute(:key, :string, :required => :true)
457
+ define_attribute(:val, :string, :required => :true)
458
+ define_element_name 'cellSmartTagPr'
459
+ end
460
+
461
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTag-1.html
462
+ class CellSmartTag < OOXMLObject
463
+ define_attribute(:type, :int, :required => :true)
464
+ define_attribute(:deleted, :bool, :default => false)
465
+ define_attribute(:xmlBased, :bool, :default => false)
466
+ define_child_node(RubyXL::CellSmartTagProperty, :collection => :true, :accessor => :smart_tag_props)
467
+ define_element_name 'cellSmartTag'
468
+ end
469
+
470
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTags-1.html
471
+ class CellSmartTagContainer < OOXMLObject
472
+ define_attribute(:r, :ref, :accessor => :ref)
473
+ define_child_node(RubyXL::CellSmartTag, :collection => :true, :accessor => :cell_smart_tags)
474
+ define_element_name 'cellSmartTags'
475
+ end
476
+
477
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTags-1.html
478
+ class SmartTagContainer < OOXMLObject
479
+ define_child_node(RubyXL::CellSmartTagContainer, :collection => :true, :accessor => :smart_tags)
480
+ define_element_name 'smartTags'
481
+ end
482
+
483
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customPr-1.html
484
+ class CustomProperty < OOXMLObject
485
+ define_attribute(:name, :string, :required => :true)
486
+ define_attribute(:'r:id', :string, :required => :true)
487
+ define_element_name 'customPr'
488
+ end
489
+
490
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customProperties-1.html
491
+ class CustomPropertyContainer < OOXMLObject
492
+ define_child_node(RubyXL::CustomProperty, :collection => :true, :accessor => :custom_props)
493
+ define_element_name 'customProperties'
494
+ end
495
+
496
+ class FieldItem < OOXMLObject
497
+ define_attribute(:v, :int, :required => true)
498
+ define_element_name 'x'
499
+ end
500
+
501
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_references-1.html
502
+ class PivotReference < OOXMLObject
503
+ define_attribute(:field, :int)
504
+ define_attribute(:selected, :bool, :default => true)
505
+ define_attribute(:byPosition, :bool, :default => false)
506
+ define_attribute(:relative, :bool, :default => false)
507
+ define_attribute(:defaultSubtotal, :bool, :default => false)
508
+ define_attribute(:sumSubtotal, :bool, :default => false)
509
+ define_attribute(:countASubtotal, :bool, :default => false)
510
+ define_attribute(:avgSubtotal, :bool, :default => false)
511
+ define_attribute(:maxSubtotal, :bool, :default => false)
512
+ define_attribute(:minSubtotal, :bool, :default => false)
513
+ define_attribute(:productSubtotal, :bool, :default => false)
514
+ define_attribute(:countSubtotal, :bool, :default => false)
515
+ define_attribute(:stdDevSubtotal, :bool, :default => false)
516
+ define_attribute(:stdDevPSubtotal, :bool, :default => false)
517
+ define_attribute(:varSubtotal, :bool, :default => false)
518
+ define_attribute(:varPSubtotal, :bool, :default => false)
519
+ define_child_node(RubyXL::FieldItem, :collection => :with_count, :accessor => :field_items)
520
+ define_child_node(RubyXL::ExtensionStorageArea)
521
+ define_element_name 'references'
522
+ end
523
+
524
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_references-1.html
525
+ class PivotReferenceContainer < OOXMLObject
526
+ define_child_node(RubyXL::PivotReference, :collection => :with_count, :accessor => :pivot_references)
527
+ define_element_name 'references'
528
+ end
529
+
530
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotArea-4.html
531
+ class PivotArea < OOXMLObject
532
+ define_attribute(:field, :int)
533
+ define_attribute(:type, RubyXL::ST_PivotAreaType, :default => 'normal')
534
+ define_attribute(:dataOnly, :bool, :default => true)
535
+ define_attribute(:labelOnly, :bool, :default => false)
536
+ define_attribute(:grandRow, :bool, :default => false)
537
+ define_attribute(:grandCol, :bool, :default => false)
538
+ define_attribute(:cacheIndex, :bool, :default => false)
539
+ define_attribute(:outline, :bool, :default => true)
540
+ define_attribute(:offset, :ref)
541
+ define_attribute(:collapsedLevelsAreSubtotals, :bool, :default => false)
542
+ define_attribute(:axis, RubyXL::ST_Axis)
543
+ define_attribute(:fieldPosition, :int, :default => 0)
544
+ define_child_node(RubyXL::PivotReferenceContainer, :accessor => :pivot_reference_container)
545
+ define_child_node(RubyXL::ExtensionStorageArea)
546
+ define_element_name 'pivotArea'
547
+ end
548
+
549
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotSelection-1.html
550
+ class PivotTableSelection < OOXMLObject
551
+ define_attribute(:pane, RubyXL::ST_Pane, :default => 'topLeft')
552
+ define_attribute(:showHeader, :bool, :default => false)
553
+ define_attribute(:label, :bool, :default => false)
554
+ define_attribute(:data, :bool, :default => false)
555
+ define_attribute(:extendable, :bool, :default => false)
556
+ define_attribute(:count, :int, :default => 0)
557
+ define_attribute(:axis, RubyXL::ST_Axis)
558
+ define_attribute(:dimension, :int, :default => 0)
559
+ define_attribute(:start, :int, :default => 0)
560
+ define_attribute(:min, :int, :default => 0)
561
+ define_attribute(:max, :int, :default => 0)
562
+ define_attribute(:activeRow, :int, :default => 0)
563
+ define_attribute(:activeCol, :int, :default => 0)
564
+ define_attribute(:previousRow, :int, :default => 0)
565
+ define_attribute(:previousCol, :int, :default => 0)
566
+ define_attribute(:click, :int, :default => 0)
567
+ define_attribute(:'r:id', :string)
568
+ define_child_node(RubyXL::PivotArea)
569
+ define_element_name 'pivotSelection'
570
+ end
571
+
572
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetView-1.html
573
+ class WorksheetView < OOXMLObject
574
+ define_attribute(:windowProtection, :bool, :default => false)
575
+ define_attribute(:showFormulas, :bool, :default => false)
576
+ define_attribute(:showGridLines, :bool, :default => true)
577
+ define_attribute(:showRowColHeaders, :bool, :default => true)
578
+ define_attribute(:showZeros, :bool, :default => true)
579
+ define_attribute(:rightToLeft, :bool, :default => false)
580
+ define_attribute(:tabSelected, :bool, :default => false)
581
+ define_attribute(:showRuler, :bool, :default => true)
582
+ define_attribute(:showOutlineSymbols, :bool, :default => true)
583
+ define_attribute(:defaultGridColor, :bool, :default => true)
584
+ define_attribute(:showWhiteSpace, :bool, :default => true)
585
+ define_attribute(:view, RubyXL::ST_SheetViewType, :default => 'normal')
586
+ define_attribute(:topLeftCell, :ref)
587
+ define_attribute(:colorId, :int, :default => 64)
588
+ define_attribute(:zoomScale, :int, :default => 100)
589
+ define_attribute(:zoomScaleNormal, :int, :default => 0)
590
+ define_attribute(:zoomScaleSheetLayoutView, :bool, :default => 0)
591
+ define_attribute(:zoomScalePageLayoutView, :bool, :default => 0)
592
+ define_attribute(:workbookViewId, :int, :required => true, :default => 0 )
593
+ define_child_node(RubyXL::Pane)
594
+ define_child_node(RubyXL::Selection, :collection => true, :accessor => :selections )
595
+ define_child_node(RubyXL::PivotTableSelection, :collection => true, :accessor => :pivot_table_selections )
596
+ define_child_node(RubyXL::ExtensionStorageArea)
597
+ define_element_name 'sheetView'
598
+ end
599
+
600
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetViews-3.html
601
+ class WorksheetViews < OOXMLObject
602
+ define_child_node(RubyXL::WorksheetView, :collection => true, :accessor => :sheet_views)
603
+ define_child_node(RubyXL::ExtensionStorageArea)
604
+ define_element_name 'sheetViews'
605
+ end
606
+
385
607
  # http://www.schemacentral.com/sc/ooxml/s-sml-sheet.xsd.html
386
- class Worksheet < OOXMLObject
608
+ class Worksheet < OOXMLTopLevelObject
387
609
  define_child_node(RubyXL::WorksheetProperties)
388
610
  define_child_node(RubyXL::WorksheetDimensions)
389
- define_child_node(RubyXL::SheetViews)
611
+ define_child_node(RubyXL::WorksheetViews, :accessor => :sheet_view_container)
390
612
  define_child_node(RubyXL::WorksheetFormatProperties)
391
613
  define_child_node(RubyXL::ColumnRanges)
392
614
  define_child_node(RubyXL::SheetData)
393
615
  define_child_node(RubyXL::SheetCalculationProperties)
394
- define_child_node(RubyXL::SheetProtection)
616
+ define_child_node(RubyXL::WorksheetProtection)
395
617
  define_child_node(RubyXL::ProtectedRanges)
396
618
  define_child_node(RubyXL::ScenarioContainer)
397
- # ssml:autoFilter [0..1] AutoFilter
619
+ define_child_node(RubyXL::AutoFilter)
398
620
  define_child_node(RubyXL::SortState)
399
- # ssml:dataConsolidate [0..1] Data Consolidate
400
- # ssml:customSheetViews [0..1] Custom Sheet Views
401
- define_child_node(RubyXL::MergedCells, :accessor => :merged_cells_list)
402
- define_child_node(RubyXL::PhoneticProperties)
621
+ define_child_node(RubyXL::DataConsolidate)
622
+ define_child_node(RubyXL::CustomSheetViews, :accessor => :custom_sheet_view_container)
623
+ define_child_node(RubyXL::MergedCells, :accessor => :merged_cells_list)
624
+ define_child_node(RubyXL::PhoneticProperties, :accessor => :custom_props_container)
403
625
  define_child_node(RubyXL::ConditionalFormatting)
404
626
  define_child_node(RubyXL::DataValidations)
405
627
  define_child_node(RubyXL::HyperlinkContainer)
@@ -407,19 +629,19 @@ module RubyXL
407
629
  define_child_node(RubyXL::PageMargins)
408
630
  define_child_node(RubyXL::PageSetup)
409
631
  define_child_node(RubyXL::HeaderFooterSettings)
410
- define_child_node(RubyXL::BreakList, :node_name => :rowBreaks)
411
- define_child_node(RubyXL::BreakList, :node_name => :colBreaks)
412
- # ssml:customProperties [0..1] Custom Properties
413
- # ssml:cellWatches [0..1] Cell Watch Items
632
+ define_child_node(RubyXL::BreakList, :node_name => :rowBreaks)
633
+ define_child_node(RubyXL::BreakList, :node_name => :colBreaks)
634
+ define_child_node(RubyXL::CustomPropertyContainer)
635
+ define_child_node(RubyXL::CellWatchContainer, :accessor => :cell_watch_container)
414
636
  define_child_node(RubyXL::IgnoredErrorContainer)
415
- # ssml:smartTags [0..1] Smart Tags
416
- define_child_node(RubyXL::RID, :node_name => :drawing)
417
- define_child_node(RubyXL::RID, :node_name => :legacyDrawing)
418
- define_child_node(RubyXL::RID, :node_name => :legacyDrawingHF)
419
- define_child_node(RubyXL::RID, :node_name => :picture)
420
- # ssml:oleObjects [0..1] OLE Objects
421
- # ssml:controls [0..1] Embedded Controls
422
- # ssml:webPublishItems [0..1] Web Publishing Items
637
+ define_child_node(RubyXL::SmartTagContainer, :accessor => :smart_tag_container)
638
+ define_child_node(RubyXL::RID, :node_name => :drawing)
639
+ define_child_node(RubyXL::RID, :node_name => :legacyDrawing)
640
+ define_child_node(RubyXL::RID, :node_name => :legacyDrawingHF)
641
+ define_child_node(RubyXL::RID, :node_name => :picture)
642
+ define_child_node(RubyXL::OLEObjects, :accessor => :ole_object_container)
643
+ define_child_node(RubyXL::EmbeddedControlContainer, :accessor => :controls_container)
644
+ define_child_node(RubyXL::WebPublishingItemContainer, :accessor => :web_items_container)
423
645
  define_child_node(RubyXL::TableParts)
424
646
  define_child_node(RubyXL::ExtensionStorageArea)
425
647
  define_element_name 'worksheet'