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
@@ -2,6 +2,10 @@ require 'rubyXL/objects/ooxml_object'
2
2
 
3
3
  module RubyXL
4
4
 
5
+ class RID < OOXMLObject
6
+ define_attribute(:'r:id', :string, :required => true)
7
+ end
8
+
5
9
  class Relationship < OOXMLObject
6
10
  define_attribute(:Id, :string)
7
11
  define_attribute(:Type, :string)
@@ -10,7 +14,7 @@ module RubyXL
10
14
  end
11
15
 
12
16
  # http://www.schemacentral.com/sc/ooxml/e-ssml_calcChain.html
13
- class WorkbookRelationships < OOXMLObject
17
+ class WorkbookRelationships < OOXMLTopLevelObject
14
18
  define_child_node(RubyXL::Relationship, :collection => true, :accessor => :relationships)
15
19
  define_element_name 'Relationships'
16
20
  set_namespaces('xmlns' => 'http://schemas.openxmlformats.org/package/2006/relationships')
@@ -5,7 +5,7 @@ require 'rubyXL/objects/extensions'
5
5
  module RubyXL
6
6
 
7
7
  # http://www.schemacentral.com/sc/ooxml/e-ssml_sst.html
8
- class SharedStringsTable < OOXMLObject
8
+ class SharedStringsTable < OOXMLTopLevelObject
9
9
  # According to http://msdn.microsoft.com/en-us/library/office/gg278314.aspx,
10
10
  # +count+ and +uniqueCount+ may be either both missing, or both present. Need to validate.
11
11
  define_attribute(:uniqueCount, :int)
@@ -0,0 +1,50 @@
1
+ require 'rubyXL/objects/ooxml_object'
2
+
3
+ module RubyXL
4
+
5
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishItem-1.html
6
+ class WebPublishingItem < OOXMLObject
7
+ define_attribute(:id, :int, :required => :true)
8
+ define_attribute(:divId, :int, :required => :true)
9
+ define_attribute(:sourceType, RubyXL::ST_WebSourceType, :required => :true)
10
+ define_attribute(:sourceRef, :ref)
11
+ define_attribute(:sourceObject, :string)
12
+ define_attribute(:destinationFile, :string, :required => :true)
13
+ define_attribute(:title, :string)
14
+ define_attribute(:autoRepublish, :bool, :default => false)
15
+ define_element_name 'webPublishItem'
16
+ end
17
+
18
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishItems-1.html
19
+ class WebPublishingItemContainer < OOXMLObject
20
+ define_child_node(RubyXL::WebPublishingItem, :collection => :with_count, :accessor => :web_items)
21
+ define_element_name 'webPublishItems'
22
+ end
23
+
24
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pageMargins-1.html
25
+ class PageMargins < OOXMLObject
26
+ define_attribute(:left, :float, :required => true)
27
+ define_attribute(:right, :float, :required => true)
28
+ define_attribute(:top, :float, :required => true)
29
+ define_attribute(:bottom, :float, :required => true)
30
+ define_attribute(:header, :float, :required => true)
31
+ define_attribute(:footer, :float, :required => true)
32
+ define_element_name 'pageMargins'
33
+ end
34
+
35
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_headerFooter-1.html
36
+ class HeaderFooterSettings < OOXMLObject
37
+ define_attribute(:differentOddEven, :bool, :default => false)
38
+ define_attribute(:differentFirst, :bool, :default => false)
39
+ define_attribute(:scaleWithDoc, :bool, :default => true)
40
+ define_attribute(:alignWithMargins, :bool, :default => true)
41
+ define_child_node(RubyXL::StringValue, :node_name => :oddHeader)
42
+ define_child_node(RubyXL::StringValue, :node_name => :oddFooter)
43
+ define_child_node(RubyXL::StringValue, :node_name => :evenHeader)
44
+ define_child_node(RubyXL::StringValue, :node_name => :evenFooter)
45
+ define_child_node(RubyXL::StringValue, :node_name => :firstHeader)
46
+ define_child_node(RubyXL::StringValue, :node_name => :firstFooter)
47
+ define_element_name 'headerFooter'
48
+ end
49
+
50
+ end
@@ -1,4 +1,5 @@
1
1
  require 'rubyXL/objects/ooxml_object'
2
+ require 'rubyXL/objects/simple_types'
2
3
  require 'rubyXL/objects/text'
3
4
  require 'rubyXL/objects/formula'
4
5
 
@@ -14,7 +15,7 @@ module RubyXL
14
15
  class Cell < OOXMLObject
15
16
  define_attribute(:r, :ref)
16
17
  define_attribute(:s, :int, :accessor => :style_index)
17
- define_attribute(:t, :string, :accessor => :datatype, :default => 'n', :values => %w{ b n e s str inlineStr })
18
+ define_attribute(:t, RubyXL::ST_CellType, :accessor => :datatype, :default => 'n', )
18
19
  define_attribute(:cm, :int)
19
20
  define_attribute(:vm, :int)
20
21
  define_attribute(:ph, :bool)
@@ -59,6 +60,10 @@ module RubyXL
59
60
  workbook.shared_strings_container[raw_value.to_i]
60
61
  else
61
62
  if is_date? then workbook.num_to_date(raw_value.to_i)
63
+ elsif raw_value.is_a?(String) && (raw_value =~ /^-?\d+(\.\d+(?:e[+-]\d+)?)?$/i) # Numeric
64
+ if $1 then raw_value.to_f
65
+ else raw_value.to_i
66
+ end
62
67
  else raw_value
63
68
  end
64
69
  end
@@ -0,0 +1,78 @@
1
+ module RubyXL
2
+ ST_PageOrder = %w{ downThenOver overThenDown }
3
+ ST_Orientation = %w{ default portrait landscape }
4
+ ST_CellComments = %w{ none asDisplayed atEnd }
5
+ ST_PrintError = %w{ displayed blank dash NA }
6
+ ST_CfvoType = %w{ num percent max min formula percentile }
7
+ ST_SheetViewType = %w{ normal pageBreakPreview pageLayout }
8
+ ST_PivotAreaType = %w{ none normal data all origin button topRight }
9
+ ST_Axis = %w{ axisRow axisCol axisPage axisValues }
10
+ ST_BorderStyle = %w{ none thin medium dashed dotted thick double hair
11
+ mediumDashed dashDot mediumDashDot dashDotDot slantDashDot }
12
+ ST_HorizontalAlignment = %w{ general left center right fill justify centerContinuous distributed }
13
+ ST_VerticalAlignment = %w{ top center bottom justify distributed }
14
+ ST_VectorBaseType = %w{ variant i1 i2 i4 i8 ui1 ui2 ui4 ui8 r4 r8
15
+ lpstr lpwstr bstr date filetime bool cy error clsid cf }
16
+ ST_PhoneticType = %w{ halfwidthKatakana fullwidthKatakana Hiragana noConversion }
17
+ ST_PhoneticAlignment = %w{ noControl left center distributed }
18
+ ST_WebSourceType = %w{ sheet printArea autoFilter range chart pivotTable query label }
19
+ ST_CellType = %w{ b n e s str inlineStr }
20
+ ST_GradientType = %w{ linear path }
21
+ ST_PatternType = %w{ none solid mediumGray darkGray lightGray
22
+ darkHorizontal darkVertical darkDown darkUp darkGrid darkTrellis
23
+ lightHorizontal lightVertical lightDown lightUp lightGrid lightTrellis
24
+ gray125 gray0625 }
25
+ ST_Objects = %w{ all placeholders none }
26
+ ST_UpdateLinks = %w{ userSet never always }
27
+ ST_Visibility = %w{ visible hidden veryHidden }
28
+
29
+ ST_DateTimeGrouping = %w{ year month day hour minute second }
30
+ ST_CalendarType = %w{ none gregorian gregorianUs japan taiwan korea hijri thai hebrew
31
+ gregorianMeFrench gregorianArabic gregorianXlitEnglish gregorianXlitFrench }
32
+ ST_FilterOperator = %w{ equal lessThan lessThanOrEqual notEqual greaterThanOrEqual greaterThan }
33
+ ST_DynamicFilterType = %w{ null aboveAverage belowAverage tomorrow today yesterday
34
+ nextWeek thisWeek lastWeek nextMonth thisMonth lastMonth
35
+ nextQuarter thisQuarter lastQuarter nextYear thisYear lastYear
36
+ yearToDate Q1 Q2 Q3 Q4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 }
37
+ ST_IconSetType = %w{ 3Arrows 3ArrowsGray 3Flags 3TrafficLights1 3TrafficLights2
38
+ 3Signs 3Symbols 3Symbols2 4Arrows 4ArrowsGray 4RedToBlack
39
+ 4Rating 4TrafficLights 5Arrows 5ArrowsGray 5Rating 5Quarters }
40
+ ST_SortMethod = %w{ stroke pinYin none }
41
+ ST_SortBy = %w{ value cellColor fontColor icon }
42
+
43
+ ST_CellFormulaType = %w{ normal array dataTable shared }
44
+ ST_TargetScreenSize = %w{ 544x376 640x480 720x512 800x600 1024x768 1152x882
45
+ 1152x900 1280x1024 1600x1200 1800x1440 1920x1200 }
46
+ ST_SmartTagShow = %w{ all none noIndicator }
47
+
48
+ ST_CfType = %w{ expression cellIs colorScale dataBar iconSet top10 uniqueValues
49
+ duplicateValues containsText notContainsText beginsWith
50
+ endsWith containsBlanks notContainsBlanks containsErrors
51
+ notContainsErrors timePeriod aboveAverage }
52
+ ST_TimePeriod = %w{ today yesterday tomorrow last7Days thisMonth
53
+ lastMonth nextMonth thisWeek lastWeek nextWeek }
54
+ ST_CalcMode = %w{ manual auto autoNoTable }
55
+ ST_RefMode = %w{ A1 R1C1 }
56
+
57
+ ST_DvAspect = %w{ DVASPECT_CONTENT DVASPECT_ICON }
58
+ ST_OleUpdate = %w{ OLEUPDATE_ALWAYS OLEUPDATE_ONCALL }
59
+
60
+ ST_Pane = %w{ bottomRight topRight bottomLeft topLeft }
61
+ ST_PaneState = %w{ split frozen frozenSplit }
62
+
63
+ ST_Comments = %w{ commNone commIndicator commIndAndComment }
64
+
65
+ ST_DataValidationType = %w{ none whole decimal list date time textLength custom }
66
+ ST_DataValidationErrorStyle = %w{ stop warning information }
67
+ ST_DataValidationImeMode = %w{ noControl off on disabled hiragana fullKatakana halfKatakana
68
+ fullAlpha halfAlpha fullHangul halfHangul }
69
+ ST_DataValidationOperator = %w{ between notBetween equal notEqual lessThan lessThanOrEqual
70
+ greaterThan greaterThanOrEqual }
71
+
72
+ ST_DataConsolidateFunction = %w{ average count countNums max min
73
+ product stdDev stdDevp sum var varp }
74
+
75
+ ST_ConditionalFormattingOperator = %w{ lessThan lessThanOrEqual equal notEqual greaterThanOrEqual greaterThan
76
+ between notBetween containsText notContains beginsWith endsWith }
77
+
78
+ end
@@ -139,15 +139,27 @@ module RubyXL
139
139
  define_child_node(RubyXL::Color, :collection => :true)
140
140
  end
141
141
 
142
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_colors-1.html
143
+ class IndexedColorContainer < OOXMLObject
144
+ define_child_node(RubyXL::Color, :collection => :true, :accessor => :indexed_colors, :node_name => :rgbColor)
145
+ define_element_name 'indexedColors'
146
+ end
147
+
148
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_mruColors-1.html
149
+ class MRUColorContainer < OOXMLObject
150
+ define_child_node(RubyXL::Color, :collection => :true, :accessor => :mru_colors)
151
+ define_element_name 'mruColors'
152
+ end
153
+
142
154
  # http://www.schemacentral.com/sc/ooxml/e-ssml_colors-1.html
143
155
  class Colors < OOXMLObject
144
- define_child_node(RubyXL::ColorSet, :node_name => 'indexedColors')
145
- define_child_node(RubyXL::ColorSet, :node_name => 'mruColors')
156
+ define_child_node(RubyXL::IndexedColorContainer, :accessor => :indexed_color_container)
157
+ define_child_node(RubyXL::MRUColorContainer)
146
158
  define_element_name 'colors'
147
159
  end
148
160
 
149
161
  # http://www.schemacentral.com/sc/ooxml/e-ssml_styleSheet.html
150
- class Stylesheet < OOXMLObject
162
+ class Stylesheet < OOXMLTopLevelObject
151
163
  define_child_node(RubyXL::NumberFormatContainer, :accessor => :number_format_container)
152
164
  define_child_node(RubyXL::FontContainer, :accessor => :font_container)
153
165
  define_child_node(RubyXL::FillContainer, :accessor => :fill_container)
@@ -1,4 +1,5 @@
1
1
  require 'rubyXL/objects/ooxml_object'
2
+ require 'rubyXL/objects/simple_types'
2
3
  require 'rubyXL/objects/container_nodes'
3
4
 
4
5
  module RubyXL
@@ -10,7 +11,7 @@ module RubyXL
10
11
  define_element_name 't'
11
12
 
12
13
  def before_write_xml
13
- self.xml_space = (value && (/^\s+/.match(value) || /\s+$/.match(value))) ? 'preserve' : nil
14
+ self.xml_space = (value && ((value =~ /^\s/) || (value =~ /\s$/)) || value.include?("\n")) ? 'preserve' : nil
14
15
  true
15
16
  end
16
17
 
@@ -62,10 +63,8 @@ module RubyXL
62
63
  # http://www.schemacentral.com/sc/ooxml/e-ssml_phoneticPr-1.html
63
64
  class PhoneticProperties < OOXMLObject
64
65
  define_attribute(:fontId, :int, :required => true)
65
- define_attribute(:type, :string, :default => 'fullwidthKatakana',
66
- :values => %w{ halfwidthKatakana fullwidthKatakana Hiragana noConversion })
67
- define_attribute(:alignment, :string, :default => 'left',
68
- :values => %w{ noControl left center distributed })
66
+ define_attribute(:type, RubyXL::ST_PhoneticType, :default => 'fullwidthKatakana')
67
+ define_attribute(:alignment, RubyXL::ST_PhoneticAlignment, :default => 'left')
69
68
  define_element_name 'phoneticPr'
70
69
  end
71
70
 
@@ -1,4 +1,5 @@
1
1
  require 'rubyXL/objects/ooxml_object'
2
+ require 'rubyXL/objects/simple_types'
2
3
  require 'rubyXL/objects/extensions'
3
4
 
4
5
  module RubyXL
@@ -26,16 +27,14 @@ module RubyXL
26
27
  # http://www.schemacentral.com/sc/ooxml/e-ssml_workbookPr-1.html
27
28
  class WorkbookProperties < OOXMLObject
28
29
  define_attribute(:date1904, :bool, :default => false)
29
- define_attribute(:showObjects, :string, :default => 'all', :values =>
30
- %w{ all placeholders none } )
30
+ define_attribute(:showObjects, RubyXL::ST_Objects, :default => 'all')
31
31
  define_attribute(:showBorderUnselectedTables, :bool, :default => true)
32
32
  define_attribute(:filterPrivacy, :bool, :default => false)
33
33
  define_attribute(:promptedSolutions, :bool, :default => false)
34
34
  define_attribute(:showInkAnnotation, :bool, :default => true)
35
35
  define_attribute(:backupFile, :bool, :default => false)
36
36
  define_attribute(:saveExternalLinkValues, :bool, :default => true)
37
- define_attribute(:updateLinks, :string, :default => 'userSet', :values =>
38
- %w{ userSet never always } )
37
+ define_attribute(:updateLinks, RubyXL::ST_UpdateLinks, :default => 'userSet')
39
38
  define_attribute(:hidePivotFieldList, :bool, :default => false)
40
39
  define_attribute(:showPivotChartFilter, :bool, :default => false)
41
40
  define_attribute(:allowRefreshQuery, :bool, :default => false)
@@ -58,10 +57,9 @@ module RubyXL
58
57
  define_element_name 'workbookProtection'
59
58
  end
60
59
 
61
-
60
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_workbookView-1.html
62
61
  class WorkbookView < OOXMLObject
63
- define_attribute(:visibility, :string, :default => 'visible', :values =>
64
- %w{ visible hidden veryHidden } )
62
+ define_attribute(:visibility, RubyXL::ST_Visibility, :default => 'visible')
65
63
  define_attribute(:minimized, :bool, :default => false)
66
64
  define_attribute(:showHorizontalScroll, :bool, :default => true)
67
65
  define_attribute(:showVerticalScroll, :bool, :default => true)
@@ -87,10 +85,9 @@ module RubyXL
87
85
  # http://www.schemacentral.com/sc/ooxml/e-ssml_sheet-1.html
88
86
  class Sheet < OOXMLObject
89
87
  define_attribute(:name, :string, :required => true)
90
- define_attribute(:sheetId, :int, :required => true)
91
- define_attribute(:state, :string, :default => 'visible', :values =>
92
- %w{ visible hidden veryHidden } )
93
- define_attribute(:'r:id', :string, :required => true)
88
+ define_attribute(:sheetId, :int, :required => true)
89
+ define_attribute(:state, RubyXL::ST_Visibility, :default => 'visible')
90
+ define_attribute(:'r:id', :string, :required => true)
94
91
  define_element_name 'sheet'
95
92
  end
96
93
 
@@ -142,13 +139,53 @@ module RubyXL
142
139
  define_element_name 'definedNames'
143
140
  end
144
141
 
142
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotCache-1.html
143
+ class PivotCache < OOXMLObject
144
+ define_attribute(:cacheId, :int, :required => true)
145
+ define_attribute(:'r:id', :string, :required => true)
146
+ define_element_name 'pivotCache'
147
+ end
148
+
149
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotCaches-1.html
150
+ class PivotCaches < OOXMLObject
151
+ define_child_node(RubyXL::PivotCache, :collection => true, :accessor => :pivot_caches)
152
+ define_element_name 'pivotCaches'
153
+ end
154
+
155
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_oleSize-1.html
156
+ class OLESize < OOXMLObject
157
+ define_attribute(:ref, :ref, :required => true)
158
+ define_element_name 'oleSize'
159
+ end
160
+
161
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_fileRecoveryPr-1.html
162
+ class FileRecoveryProperties < OOXMLObject
163
+ define_attribute(:autoRecover, :bool, :default => true)
164
+ define_attribute(:crashSave, :bool, :default => false)
165
+ define_attribute(:dataExtractLoad, :bool, :default => false)
166
+ define_attribute(:repairLoad, :bool, :default => false)
167
+ define_element_name 'fileRecoveryPr'
168
+ end
169
+
170
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishing-1.html
171
+ class WebPublishingProperties < OOXMLObject
172
+ define_attribute(:css, :bool, :default => true)
173
+ define_attribute(:thicket, :bool, :default => true)
174
+ define_attribute(:longFileNames, :bool, :default => true)
175
+ define_attribute(:vml, :bool, :default => false)
176
+ define_attribute(:allowPng, :bool, :default => false)
177
+ define_attribute(:targetScreenSize, RubyXL::ST_TargetScreenSize, :default => '800x600')
178
+ define_attribute(:dpi, :int, :default => 96)
179
+ define_attribute(:codePage, :int)
180
+ define_element_name 'webPublishing'
181
+ end
182
+
183
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_calcPr-1.html
145
184
  class CalculationProperties < OOXMLObject
146
- define_attribute(:calcId, :int)
147
- define_attribute(:calcMode, :string, :default => 'auto', :values =>
148
- %w{ manual auto autoNoTable } )
185
+ define_attribute(:calcId, :int)
186
+ define_attribute(:calcMode, RubyXL::ST_CalcMode, :default => 'auto')
149
187
  define_attribute(:fullCalcOnLoad, :bool, :default => false)
150
- define_attribute(:refMode, :string, :default => 'A1', :values =>
151
- %w{ A1 R1C1 } )
188
+ define_attribute(:refMode, RubyXL::ST_RefMode, :default => 'A1')
152
189
  define_attribute(:iterate, :bool, :default => false)
153
190
  define_attribute(:iterateCount, :int, :default => 100)
154
191
  define_attribute(:iterateDelta, :float, :default => 0.001)
@@ -161,26 +198,114 @@ module RubyXL
161
198
  define_element_name 'calcPr'
162
199
  end
163
200
 
201
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishObject-1.html
202
+ class WebPublishObject < OOXMLObject
203
+ define_attribute(:id, :int, :required => true)
204
+ define_attribute(:divId, :string, :required => true)
205
+ define_attribute(:sourceObject, :string)
206
+ define_attribute(:destinationFile, :string, :required => true)
207
+ define_attribute(:title, :string)
208
+ define_attribute(:autoRepublish, :bool, :default => false)
209
+ define_element_name 'webPublishObject'
210
+ end
211
+
212
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishObjects-1.html
213
+ class WebPublishObjectContainer < OOXMLObject
214
+ define_child_node(RubyXL::WebPublishObject, :collection => :with_count, :node_name => :web_publish_objects)
215
+ define_element_name 'webPublishObjects'
216
+ end
217
+
218
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagPr-1.html
219
+ class SmartTagProperties < OOXMLObject
220
+ define_attribute(:embed, :bool, :default => false)
221
+ define_attribute(:show, RubyXL::ST_SmartTagShow, :default => 'all')
222
+ define_element_name 'smartTagPr'
223
+ end
224
+
225
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagType-1.html
226
+ class SmartTagType < OOXMLObject
227
+ define_attribute(:namespaceUri, :string)
228
+ define_attribute(:name, :string)
229
+ define_attribute(:url, :string)
230
+ define_element_name 'smartTagType'
231
+ end
232
+
233
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagTypes-1.html
234
+ class SmartTagTypeContainer < OOXMLObject
235
+ define_child_node(RubyXL::SmartTagType, :collection => :true, :node_name => :smart_tag_types)
236
+ define_element_name 'smartTagTypes'
237
+ end
238
+
239
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_functionGroup-1.html
240
+ class FunctionGroup < OOXMLObject
241
+ define_attribute(:name, :string)
242
+ define_element_name 'functionGroup'
243
+ end
244
+
245
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_functionGroups-1.html
246
+ class FunctionGroupContainer < OOXMLObject
247
+ define_attribute(:builtInGroupCountpi, :int, :default => 16)
248
+ define_child_node(RubyXL::FunctionGroup, :collection => :true, :node_name => :function_group)
249
+ define_element_name 'functionGroups'
250
+ end
251
+
252
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customWorkbookView-1.html
253
+ class CustomWorkbookView < OOXMLObject
254
+ define_attribute(:name, :string, :required => true)
255
+ define_attribute(:guid, :string, :required => true)
256
+ define_attribute(:autoUpdate, :bool, :default => false)
257
+ define_attribute(:mergeInterval, :int)
258
+ define_attribute(:changesSavedWin, :bool, :default => false)
259
+ define_attribute(:onlySync, :bool, :default => false)
260
+ define_attribute(:personalView, :bool, :default => false)
261
+ define_attribute(:includePrintSettings, :bool, :default => true)
262
+ define_attribute(:includeHiddenRowCol, :bool, :default => true)
263
+ define_attribute(:maximized, :bool, :default => false)
264
+ define_attribute(:minimized, :bool, :default => false)
265
+ define_attribute(:showHorizontalScroll, :bool, :default => true)
266
+ define_attribute(:showVerticalScroll, :bool, :default => true)
267
+ define_attribute(:showSheetTabs, :bool, :default => true)
268
+ define_attribute(:xWindow, :int, :default => 0)
269
+ define_attribute(:yWindow, :int, :default => 0)
270
+ define_attribute(:windowWidth, :int)
271
+ define_attribute(:windowHeight, :int)
272
+ define_attribute(:tabRatio, :int, :default => 600)
273
+ define_attribute(:activeSheetId, :int)
274
+ define_attribute(:showFormulaBar, :bool, :default => true)
275
+ define_attribute(:showStatusbar, :bool, :default => true)
276
+ define_attribute(:showComments, RubyXL::ST_Comments, :default => 'commIndicator')
277
+ define_attribute(:showObjects, RubyXL::ST_Objects, :default => 'all')
278
+ define_child_node(RubyXL::ExtensionStorageArea)
279
+ define_element_name 'customWorkbookView'
280
+ end
281
+
282
+ # http://www.schemacentral.com/sc/ooxml/e-ssml_customWorkbookViews-1.html
283
+ class CustomWorkbookViewContainer < OOXMLObject
284
+ define_child_node(RubyXL::CustomWorkbookView, :collection => true, :accessor => :custom_views)
285
+ define_element_name 'customWorkbookView'
286
+ end
287
+
288
+
164
289
  # http://www.schemacentral.com/sc/ooxml/e-ssml_workbook.html
165
- class Workbook < OOXMLObject
290
+ class Workbook < OOXMLTopLevelObject
166
291
  define_child_node(RubyXL::FileVersion)
167
292
  define_child_node(RubyXL::FileSharing)
168
293
  define_child_node(RubyXL::WorkbookProperties, :accessor => :workbook_properties)
169
294
  define_child_node(RubyXL::WorkbookProtection)
170
295
  define_child_node(RubyXL::WorkbookViews)
171
296
  define_child_node(RubyXL::Sheets, :accessor => :worksheet_container)
172
- # ssml:functionGroups [0..1] Function Groups
297
+ define_child_node(RubyXL::FunctionGroupContainer, :accessor => :function_group_container)
173
298
  define_child_node(RubyXL::ExternalReferences, :accessor => :ext_ref_container)
174
299
  define_child_node(RubyXL::DefinedNames, :accessor => :defined_name_container)
175
300
  define_child_node(RubyXL::CalculationProperties)
176
- # ssml:oleSize [0..1] OLE Size
177
- # ssml:customWorkbookViews [0..1] Custom Workbook Views
178
- # ssml:pivotCaches [0..1] PivotCaches
179
- # ssml:smartTagPr [0..1] Smart Tag Properties
180
- # ssml:smartTagTypes [0..1] Smart Tag Types
181
- # ssml:webPublishing [0..1] Web Publishing Properties
182
- # ssml:fileRecoveryPr [0..*] File Recovery Properties
183
- # ssml:webPublishObjects [0..1] Web Publish Objects
301
+ define_child_node(RubyXL::OLESize)
302
+ define_child_node(RubyXL::CustomWorkbookViewContainer, :accessor => :custom_view_container)
303
+ define_child_node(RubyXL::PivotCaches, :accessor => :pivot_cache_container)
304
+ define_child_node(RubyXL::SmartTagProperties)
305
+ define_child_node(RubyXL::SmartTagTypeContainer)
306
+ define_child_node(RubyXL::WebPublishingProperties)
307
+ define_child_node(RubyXL::FileRecoveryProperties)
308
+ define_child_node(RubyXL::WebPublishObjectContainer)
184
309
  define_child_node(RubyXL::ExtensionStorageArea)
185
310
  define_child_node(RubyXL::AlternateContent)
186
311