rubyXL 3.3.21 → 3.4.17

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 (456) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +60 -0
  3. data/.codeclimate.yml +3 -0
  4. data/Gemfile +3 -2
  5. data/Gemfile.lock +96 -0
  6. data/LICENSE.txt +1 -1
  7. data/README.rdoc +47 -16
  8. data/Rakefile +3 -2
  9. data/VERSION +1 -1
  10. data/lib/rubyXL.rb +1 -0
  11. data/lib/rubyXL/cell.rb +1 -26
  12. data/lib/rubyXL/convenience_methods.rb +5 -982
  13. data/lib/rubyXL/convenience_methods/cell.rb +272 -0
  14. data/lib/rubyXL/convenience_methods/color.rb +160 -0
  15. data/lib/rubyXL/convenience_methods/font.rb +63 -0
  16. data/lib/rubyXL/convenience_methods/workbook.rb +136 -0
  17. data/lib/rubyXL/convenience_methods/worksheet.rb +710 -0
  18. data/lib/rubyXL/objects/border.rb +31 -3
  19. data/lib/rubyXL/objects/calculation_chain.rb +2 -2
  20. data/lib/rubyXL/objects/cell_style.rb +8 -8
  21. data/lib/rubyXL/objects/chartsheet.rb +10 -10
  22. data/lib/rubyXL/objects/color.rb +6 -4
  23. data/lib/rubyXL/objects/column_range.rb +10 -10
  24. data/lib/rubyXL/objects/comments.rb +6 -6
  25. data/lib/rubyXL/objects/connection.rb +175 -0
  26. data/lib/rubyXL/objects/container_nodes.rb +2 -2
  27. data/lib/rubyXL/objects/content_types.rb +2 -2
  28. data/lib/rubyXL/objects/data_validation.rb +4 -2
  29. data/lib/rubyXL/objects/document_properties.rb +3 -3
  30. data/lib/rubyXL/objects/extensions.rb +20 -3
  31. data/lib/rubyXL/objects/external_links.rb +26 -2
  32. data/lib/rubyXL/objects/fill.rb +4 -4
  33. data/lib/rubyXL/objects/filters.rb +12 -12
  34. data/lib/rubyXL/objects/font.rb +2 -60
  35. data/lib/rubyXL/objects/formula.rb +1 -1
  36. data/lib/rubyXL/objects/ooxml_object.rb +15 -3
  37. data/lib/rubyXL/objects/query_table.rb +104 -0
  38. data/lib/rubyXL/objects/relationships.rb +8 -3
  39. data/lib/rubyXL/objects/shared_strings.rb +1 -1
  40. data/lib/rubyXL/objects/sheet_common.rb +4 -4
  41. data/lib/rubyXL/objects/sheet_data.rb +48 -11
  42. data/lib/rubyXL/objects/simple_types.rb +18 -0
  43. data/lib/rubyXL/objects/storage.rb +25 -1
  44. data/lib/rubyXL/objects/stylesheet.rb +14 -14
  45. data/lib/rubyXL/objects/text.rb +8 -8
  46. data/lib/rubyXL/objects/theme.rb +138 -119
  47. data/lib/rubyXL/objects/workbook.rb +153 -43
  48. data/lib/rubyXL/objects/worksheet.rb +118 -107
  49. data/lib/rubyXL/worksheet.rb +19 -13
  50. data/rdoc/README_rdoc.html +109 -103
  51. data/rdoc/RubyXL.html +39 -296
  52. data/rdoc/RubyXL/AExtension.html +21 -60
  53. data/rdoc/RubyXL/AExtensionStorageArea.html +12 -17
  54. data/rdoc/RubyXL/ActiveX.html +154 -0
  55. data/rdoc/RubyXL/ActiveXBinary.html +106 -0
  56. data/rdoc/RubyXL/AdjustHandleList.html +13 -19
  57. data/rdoc/RubyXL/Alignment.html +13 -19
  58. data/rdoc/RubyXL/AlternateContent.html +12 -17
  59. data/rdoc/RubyXL/Authors.html +13 -19
  60. data/rdoc/RubyXL/AutoFilter.html +13 -19
  61. data/rdoc/RubyXL/AutoFilterColumn.html +13 -19
  62. data/rdoc/RubyXL/BinaryImageFile.html +12 -25
  63. data/rdoc/RubyXL/BodyProperties.html +13 -19
  64. data/rdoc/RubyXL/BooleanNode.html +12 -17
  65. data/rdoc/RubyXL/BooleanValue.html +12 -17
  66. data/rdoc/RubyXL/Border.html +76 -53
  67. data/rdoc/RubyXL/BorderEdge.html +71 -17
  68. data/rdoc/RubyXL/Borders.html +19 -39
  69. data/rdoc/RubyXL/Break.html +13 -19
  70. data/rdoc/RubyXL/BreakList.html +13 -19
  71. data/rdoc/RubyXL/CT_AdjPoint2D.html +13 -19
  72. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +13 -19
  73. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +13 -19
  74. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +13 -19
  75. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +13 -19
  76. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +13 -19
  77. data/rdoc/RubyXL/CT_Backdrop.html +13 -19
  78. data/rdoc/RubyXL/CT_Bevel.html +13 -19
  79. data/rdoc/RubyXL/CT_BiLevelEffect.html +13 -19
  80. data/rdoc/RubyXL/CT_BlendEffect.html +13 -19
  81. data/rdoc/RubyXL/CT_Blip.html +13 -19
  82. data/rdoc/RubyXL/CT_BlipFillProperties.html +13 -19
  83. data/rdoc/RubyXL/CT_BlurEffect.html +13 -19
  84. data/rdoc/RubyXL/CT_Camera.html +13 -19
  85. data/rdoc/RubyXL/CT_Color.html +13 -19
  86. data/rdoc/RubyXL/CT_ColorChangeEffect.html +13 -19
  87. data/rdoc/RubyXL/CT_ColorMapping.html +13 -19
  88. data/rdoc/RubyXL/CT_ColorScheme.html +13 -19
  89. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +13 -19
  90. data/rdoc/RubyXL/CT_ConnectionSite.html +13 -19
  91. data/rdoc/RubyXL/CT_ConnectionSiteList.html +13 -19
  92. data/rdoc/RubyXL/CT_DashStop.html +13 -19
  93. data/rdoc/RubyXL/CT_DashStopList.html +13 -19
  94. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +13 -19
  95. data/rdoc/RubyXL/CT_DuotoneEffect.html +13 -19
  96. data/rdoc/RubyXL/CT_EffectContainer.html +13 -19
  97. data/rdoc/RubyXL/CT_EffectList.html +13 -19
  98. data/rdoc/RubyXL/CT_EffectReference.html +13 -19
  99. data/rdoc/RubyXL/CT_EffectStyleItem.html +13 -19
  100. data/rdoc/RubyXL/CT_EffectStyleList.html +13 -19
  101. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +13 -19
  102. data/rdoc/RubyXL/CT_FillEffect.html +13 -19
  103. data/rdoc/RubyXL/CT_FillOverlayEffect.html +13 -19
  104. data/rdoc/RubyXL/CT_FillStyleList.html +13 -19
  105. data/rdoc/RubyXL/CT_FlatText.html +13 -19
  106. data/rdoc/RubyXL/CT_FontCollection.html +13 -19
  107. data/rdoc/RubyXL/CT_FontReference.html +13 -19
  108. data/rdoc/RubyXL/CT_GeomGuideList.html +13 -19
  109. data/rdoc/RubyXL/CT_GlowEffect.html +13 -19
  110. data/rdoc/RubyXL/CT_GradientFillProperties.html +13 -19
  111. data/rdoc/RubyXL/CT_GradientStop.html +13 -19
  112. data/rdoc/RubyXL/CT_GradientStopList.html +13 -19
  113. data/rdoc/RubyXL/CT_HSLEffect.html +13 -19
  114. data/rdoc/RubyXL/CT_HslColor.html +13 -19
  115. data/rdoc/RubyXL/CT_Hyperlink.html +13 -19
  116. data/rdoc/RubyXL/CT_InnerShadowEffect.html +13 -19
  117. data/rdoc/RubyXL/CT_LightRig.html +13 -19
  118. data/rdoc/RubyXL/CT_LineEndProperties.html +13 -19
  119. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +13 -19
  120. data/rdoc/RubyXL/CT_LineProperties.html +13 -19
  121. data/rdoc/RubyXL/CT_LineStyleList.html +13 -19
  122. data/rdoc/RubyXL/CT_LinearShadeProperties.html +13 -19
  123. data/rdoc/RubyXL/CT_LuminanceEffect.html +13 -19
  124. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +13 -19
  125. data/rdoc/RubyXL/CT_OuterShadowEffect.html +13 -19
  126. data/rdoc/RubyXL/CT_Path2D.html +13 -19
  127. data/rdoc/RubyXL/CT_Path2DArcTo.html +13 -19
  128. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +13 -19
  129. data/rdoc/RubyXL/CT_Path2DList.html +13 -19
  130. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +13 -19
  131. data/rdoc/RubyXL/CT_Path2DTo.html +13 -19
  132. data/rdoc/RubyXL/CT_PathShadeProperties.html +13 -19
  133. data/rdoc/RubyXL/CT_PatternFillProperties.html +13 -19
  134. data/rdoc/RubyXL/CT_Point3D.html +13 -19
  135. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +13 -19
  136. data/rdoc/RubyXL/CT_PresetColor.html +13 -19
  137. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +13 -19
  138. data/rdoc/RubyXL/CT_PresetShadowEffect.html +13 -19
  139. data/rdoc/RubyXL/CT_PresetTextShape.html +13 -19
  140. data/rdoc/RubyXL/CT_ReflectionEffect.html +13 -19
  141. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +13 -19
  142. data/rdoc/RubyXL/CT_RelativeRect.html +13 -19
  143. data/rdoc/RubyXL/CT_SRgbColor.html +13 -19
  144. data/rdoc/RubyXL/CT_ScRgbColor.html +13 -19
  145. data/rdoc/RubyXL/CT_Scene3D.html +13 -19
  146. data/rdoc/RubyXL/CT_SchemeColor.html +13 -19
  147. data/rdoc/RubyXL/CT_Shape3D.html +13 -19
  148. data/rdoc/RubyXL/CT_ShapeStyle.html +13 -19
  149. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +13 -19
  150. data/rdoc/RubyXL/CT_SphereCoords.html +13 -19
  151. data/rdoc/RubyXL/CT_StretchInfoProperties.html +13 -19
  152. data/rdoc/RubyXL/CT_StyleMatrix.html +13 -19
  153. data/rdoc/RubyXL/CT_StyleMatrixReference.html +13 -19
  154. data/rdoc/RubyXL/CT_SupplementalFont.html +13 -19
  155. data/rdoc/RubyXL/CT_SystemColor.html +13 -19
  156. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +13 -19
  157. data/rdoc/RubyXL/CT_TextBlipBullet.html +13 -19
  158. data/rdoc/RubyXL/CT_TextCharBullet.html +13 -19
  159. data/rdoc/RubyXL/CT_TextCharacterProperties.html +13 -19
  160. data/rdoc/RubyXL/CT_TextFont.html +13 -19
  161. data/rdoc/RubyXL/CT_TextListStyle.html +13 -19
  162. data/rdoc/RubyXL/CT_TextNormalAutofit.html +13 -19
  163. data/rdoc/RubyXL/CT_TextParagraphProperties.html +13 -19
  164. data/rdoc/RubyXL/CT_TextSpacing.html +13 -19
  165. data/rdoc/RubyXL/CT_TextTabStop.html +13 -19
  166. data/rdoc/RubyXL/CT_TextTabStopList.html +13 -19
  167. data/rdoc/RubyXL/CT_TileInfoProperties.html +13 -19
  168. data/rdoc/RubyXL/CT_TintEffect.html +13 -19
  169. data/rdoc/RubyXL/CT_Transform2D.html +13 -19
  170. data/rdoc/RubyXL/CT_TransformEffect.html +13 -19
  171. data/rdoc/RubyXL/CT_Vector3D.html +13 -19
  172. data/rdoc/RubyXL/CT_XYAdjustHandle.html +13 -19
  173. data/rdoc/RubyXL/CalculationChain.html +17 -45
  174. data/rdoc/RubyXL/CalculationChainCell.html +13 -19
  175. data/rdoc/RubyXL/CalculationProperties.html +13 -19
  176. data/rdoc/RubyXL/Cell.html +144 -204
  177. data/rdoc/RubyXL/CellConvenienceMethods.html +240 -426
  178. data/rdoc/RubyXL/CellExt.html +13 -19
  179. data/rdoc/RubyXL/CellSmartTag.html +13 -19
  180. data/rdoc/RubyXL/CellSmartTagProperty.html +13 -19
  181. data/rdoc/RubyXL/CellSmartTags.html +13 -19
  182. data/rdoc/RubyXL/CellStyle.html +13 -19
  183. data/rdoc/RubyXL/CellStyleXFs.html +18 -38
  184. data/rdoc/RubyXL/CellStyles.html +18 -38
  185. data/rdoc/RubyXL/CellValue.html +18 -38
  186. data/rdoc/RubyXL/CellWatch.html +13 -19
  187. data/rdoc/RubyXL/CellWatches.html +13 -19
  188. data/rdoc/RubyXL/CellXFs.html +19 -39
  189. data/rdoc/RubyXL/ChartColorsFile.html +12 -25
  190. data/rdoc/RubyXL/ChartFile.html +19 -49
  191. data/rdoc/RubyXL/ChartStyleFile.html +12 -25
  192. data/rdoc/RubyXL/ChartUserShapesFile.html +12 -25
  193. data/rdoc/RubyXL/Chartsheet.html +19 -67
  194. data/rdoc/RubyXL/ChartsheetPageSetup.html +13 -19
  195. data/rdoc/RubyXL/ChartsheetProperties.html +13 -19
  196. data/rdoc/RubyXL/ChartsheetProtection.html +13 -19
  197. data/rdoc/RubyXL/ChartsheetView.html +13 -19
  198. data/rdoc/RubyXL/ChartsheetViews.html +13 -19
  199. data/rdoc/RubyXL/Color.html +28 -39
  200. data/rdoc/RubyXL/ColorConvenienceClasses.html +91 -0
  201. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +242 -0
  202. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +279 -0
  203. data/rdoc/RubyXL/ColorConvenienceMethods.html +137 -0
  204. data/rdoc/RubyXL/ColorFilter.html +13 -19
  205. data/rdoc/RubyXL/ColorScale.html +13 -19
  206. data/rdoc/RubyXL/ColorSet.html +13 -19
  207. data/rdoc/RubyXL/Colors.html +13 -19
  208. data/rdoc/RubyXL/ColumnRange.html +20 -71
  209. data/rdoc/RubyXL/ColumnRanges.html +20 -79
  210. data/rdoc/RubyXL/Comment.html +13 -19
  211. data/rdoc/RubyXL/CommentList.html +13 -19
  212. data/rdoc/RubyXL/CommentsFile.html +17 -50
  213. data/rdoc/RubyXL/ConditionalFormatValue.html +13 -19
  214. data/rdoc/RubyXL/ConditionalFormatting.html +13 -19
  215. data/rdoc/RubyXL/ConditionalFormattingRule.html +13 -19
  216. data/rdoc/RubyXL/Connection.html +99 -0
  217. data/rdoc/RubyXL/ConnectionTable.html +99 -0
  218. data/rdoc/RubyXL/ConnectionTables.html +99 -0
  219. data/rdoc/RubyXL/ConnectionTextField.html +99 -0
  220. data/rdoc/RubyXL/ConnectionTextFields.html +99 -0
  221. data/rdoc/RubyXL/Connections.html +147 -0
  222. data/rdoc/RubyXL/ContentTypeDefault.html +12 -17
  223. data/rdoc/RubyXL/ContentTypeOverride.html +12 -17
  224. data/rdoc/RubyXL/ContentTypes.html +23 -63
  225. data/rdoc/RubyXL/ControlPropertiesFile.html +14 -22
  226. data/rdoc/RubyXL/CorePropertiesFile.html +26 -162
  227. data/rdoc/RubyXL/CustomColor.html +13 -19
  228. data/rdoc/RubyXL/CustomColorList.html +13 -19
  229. data/rdoc/RubyXL/CustomFilter.html +13 -19
  230. data/rdoc/RubyXL/CustomFilters.html +13 -19
  231. data/rdoc/RubyXL/CustomGeometry.html +13 -19
  232. data/rdoc/RubyXL/CustomProperties.html +13 -19
  233. data/rdoc/RubyXL/CustomPropertiesFile.html +12 -25
  234. data/rdoc/RubyXL/CustomProperty.html +13 -19
  235. data/rdoc/RubyXL/CustomPropertyFile.html +108 -0
  236. data/rdoc/RubyXL/CustomSheetView.html +13 -19
  237. data/rdoc/RubyXL/CustomSheetViews.html +13 -19
  238. data/rdoc/RubyXL/CustomWorkbookView.html +13 -19
  239. data/rdoc/RubyXL/CustomWorkbookViews.html +13 -19
  240. data/rdoc/RubyXL/CustomXMLFile.html +12 -22
  241. data/rdoc/RubyXL/DXF.html +13 -19
  242. data/rdoc/RubyXL/DXFs.html +13 -19
  243. data/rdoc/RubyXL/DataBar.html +13 -19
  244. data/rdoc/RubyXL/DataConsolidate.html +13 -19
  245. data/rdoc/RubyXL/DataConsolidationReference.html +13 -19
  246. data/rdoc/RubyXL/DataConsolidationReferences.html +13 -19
  247. data/rdoc/RubyXL/DataType.html +11 -39
  248. data/rdoc/RubyXL/DataValidation.html +13 -19
  249. data/rdoc/RubyXL/DataValidations.html +13 -19
  250. data/rdoc/RubyXL/DateGroupItem.html +13 -19
  251. data/rdoc/RubyXL/DefinedName.html +13 -19
  252. data/rdoc/RubyXL/DefinedNameExt.html +13 -19
  253. data/rdoc/RubyXL/DefinedNames.html +13 -19
  254. data/rdoc/RubyXL/DefinedNamesExt.html +13 -19
  255. data/rdoc/RubyXL/DocumentPropertiesFile.html +20 -66
  256. data/rdoc/RubyXL/DrawingFile.html +19 -49
  257. data/rdoc/RubyXL/DynamicFilter.html +13 -19
  258. data/rdoc/RubyXL/EmbeddedControl.html +13 -19
  259. data/rdoc/RubyXL/EmbeddedControls.html +13 -19
  260. data/rdoc/RubyXL/Extension.html +13 -19
  261. data/rdoc/RubyXL/ExtensionStorageArea.html +13 -19
  262. data/rdoc/RubyXL/Extents.html +13 -19
  263. data/rdoc/RubyXL/ExternalBook.html +13 -19
  264. data/rdoc/RubyXL/ExternalLinksFile.html +19 -49
  265. data/rdoc/RubyXL/ExternalReference.html +13 -19
  266. data/rdoc/RubyXL/ExternalReferences.html +13 -19
  267. data/rdoc/RubyXL/ExtraColorSchemeList.html +13 -19
  268. data/rdoc/RubyXL/FieldItem.html +13 -19
  269. data/rdoc/RubyXL/FileRecoveryProperties.html +13 -19
  270. data/rdoc/RubyXL/FileSharing.html +13 -19
  271. data/rdoc/RubyXL/FileVersion.html +13 -19
  272. data/rdoc/RubyXL/Fill.html +18 -38
  273. data/rdoc/RubyXL/Fills.html +18 -38
  274. data/rdoc/RubyXL/FilterContainer.html +13 -19
  275. data/rdoc/RubyXL/FloatNode.html +12 -17
  276. data/rdoc/RubyXL/FloatValue.html +12 -17
  277. data/rdoc/RubyXL/Font.html +20 -544
  278. data/rdoc/RubyXL/FontConvenienceMethods.html +414 -0
  279. data/rdoc/RubyXL/FontScheme.html +13 -19
  280. data/rdoc/RubyXL/Fonts.html +19 -39
  281. data/rdoc/RubyXL/Formula.html +13 -19
  282. data/rdoc/RubyXL/FunctionGroup.html +13 -19
  283. data/rdoc/RubyXL/FunctionGroups.html +13 -19
  284. data/rdoc/RubyXL/GenericStorageObject.html +19 -81
  285. data/rdoc/RubyXL/GradientFill.html +13 -19
  286. data/rdoc/RubyXL/HeaderFooterSettings.html +13 -19
  287. data/rdoc/RubyXL/Hyperlink.html +13 -19
  288. data/rdoc/RubyXL/HyperlinkRelFile.html +12 -22
  289. data/rdoc/RubyXL/Hyperlinks.html +13 -19
  290. data/rdoc/RubyXL/IconFilter.html +13 -19
  291. data/rdoc/RubyXL/IconSet.html +13 -19
  292. data/rdoc/RubyXL/IgnoredError.html +13 -19
  293. data/rdoc/RubyXL/IgnoredErrors.html +13 -19
  294. data/rdoc/RubyXL/IndexedColors.html +13 -19
  295. data/rdoc/RubyXL/InputCells.html +13 -19
  296. data/rdoc/RubyXL/IntegerNode.html +12 -17
  297. data/rdoc/RubyXL/IntegerValue.html +12 -17
  298. data/rdoc/RubyXL/LegacyCell.html +14 -66
  299. data/rdoc/RubyXL/LegacyWorksheet.html +40 -100
  300. data/rdoc/RubyXL/MRUColors.html +13 -19
  301. data/rdoc/RubyXL/MacrosFile.html +12 -25
  302. data/rdoc/RubyXL/MergedCell.html +13 -19
  303. data/rdoc/RubyXL/MergedCells.html +13 -19
  304. data/rdoc/RubyXL/NumFmt.html +13 -19
  305. data/rdoc/RubyXL/NumberFormat.html +18 -38
  306. data/rdoc/RubyXL/NumberFormats.html +18 -44
  307. data/rdoc/RubyXL/OLEObject.html +13 -19
  308. data/rdoc/RubyXL/OLEObjectFile.html +12 -25
  309. data/rdoc/RubyXL/OLEObjects.html +13 -19
  310. data/rdoc/RubyXL/OLESize.html +13 -19
  311. data/rdoc/RubyXL/OOXMLContainerObject.html +36 -132
  312. data/rdoc/RubyXL/OOXMLIgnored.html +163 -0
  313. data/rdoc/RubyXL/OOXMLObject.html +15 -25
  314. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +88 -179
  315. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +47 -183
  316. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +42 -194
  317. data/rdoc/RubyXL/OOXMLTopLevelObject.html +37 -133
  318. data/rdoc/RubyXL/OdbcOleDbProperties.html +99 -0
  319. data/rdoc/RubyXL/Offset.html +13 -19
  320. data/rdoc/RubyXL/OlapProperties.html +99 -0
  321. data/rdoc/RubyXL/OleItem.html +99 -0
  322. data/rdoc/RubyXL/OleItems.html +99 -0
  323. data/rdoc/RubyXL/OleLink.html +99 -0
  324. data/rdoc/RubyXL/OutlineProperties.html +13 -19
  325. data/rdoc/RubyXL/PageMargins.html +13 -19
  326. data/rdoc/RubyXL/PageSetup.html +13 -19
  327. data/rdoc/RubyXL/PageSetupProperties.html +13 -19
  328. data/rdoc/RubyXL/Pane.html +13 -19
  329. data/rdoc/RubyXL/Parser.html +20 -53
  330. data/rdoc/RubyXL/PatternFill.html +13 -19
  331. data/rdoc/RubyXL/PhoneticProperties.html +13 -19
  332. data/rdoc/RubyXL/PhoneticRun.html +13 -19
  333. data/rdoc/RubyXL/PivotArea.html +13 -19
  334. data/rdoc/RubyXL/PivotCache.html +13 -19
  335. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +14 -30
  336. data/rdoc/RubyXL/PivotCacheRecordsFile.html +12 -25
  337. data/rdoc/RubyXL/PivotCaches.html +13 -19
  338. data/rdoc/RubyXL/PivotReference.html +13 -19
  339. data/rdoc/RubyXL/PivotReferences.html +13 -19
  340. data/rdoc/RubyXL/PivotTableFile.html +14 -30
  341. data/rdoc/RubyXL/PivotTableSelection.html +13 -19
  342. data/rdoc/RubyXL/PresetGeometry.html +13 -19
  343. data/rdoc/RubyXL/PrintOptions.html +13 -19
  344. data/rdoc/RubyXL/PrinterSettingsFile.html +12 -25
  345. data/rdoc/RubyXL/ProtectedRange.html +13 -19
  346. data/rdoc/RubyXL/ProtectedRanges.html +13 -19
  347. data/rdoc/RubyXL/Protection.html +13 -19
  348. data/rdoc/RubyXL/QueryParameter.html +99 -0
  349. data/rdoc/RubyXL/QueryParameters.html +99 -0
  350. data/rdoc/RubyXL/QueryTable.html +155 -0
  351. data/rdoc/RubyXL/QueryTableDeletedField.html +99 -0
  352. data/rdoc/RubyXL/QueryTableDeletedFields.html +99 -0
  353. data/rdoc/RubyXL/QueryTableField.html +99 -0
  354. data/rdoc/RubyXL/QueryTableFields.html +99 -0
  355. data/rdoc/RubyXL/QueryTableRefresh.html +99 -0
  356. data/rdoc/RubyXL/RID.html +12 -17
  357. data/rdoc/RubyXL/RawOOXML.html +19 -58
  358. data/rdoc/RubyXL/Reference.html +31 -215
  359. data/rdoc/RubyXL/Relationship.html +12 -17
  360. data/rdoc/RubyXL/RelationshipSupport.html +32 -126
  361. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +15 -33
  362. data/rdoc/RubyXL/RevisionPointer.html +99 -0
  363. data/rdoc/RubyXL/RichText.html +18 -38
  364. data/rdoc/RubyXL/RichTextRun.html +17 -37
  365. data/rdoc/RubyXL/Row.html +53 -152
  366. data/rdoc/RubyXL/RowExt.html +13 -19
  367. data/rdoc/RubyXL/RunProperties.html +13 -19
  368. data/rdoc/RubyXL/Scenario.html +13 -19
  369. data/rdoc/RubyXL/Scenarios.html +13 -19
  370. data/rdoc/RubyXL/Selection.html +20 -40
  371. data/rdoc/RubyXL/ShapeGuide.html +13 -19
  372. data/rdoc/RubyXL/ShapeTextRectangle.html +13 -19
  373. data/rdoc/RubyXL/SharedStringsTable.html +31 -140
  374. data/rdoc/RubyXL/Sheet.html +13 -19
  375. data/rdoc/RubyXL/SheetCalculationProperties.html +13 -19
  376. data/rdoc/RubyXL/SheetData.html +20 -53
  377. data/rdoc/RubyXL/SheetDataExt.html +13 -19
  378. data/rdoc/RubyXL/SheetDataSet.html +13 -19
  379. data/rdoc/RubyXL/SheetName.html +13 -19
  380. data/rdoc/RubyXL/SheetNames.html +13 -19
  381. data/rdoc/RubyXL/Sheets.html +13 -19
  382. data/rdoc/RubyXL/SlicerCacheFile.html +12 -25
  383. data/rdoc/RubyXL/SlicerFile.html +12 -25
  384. data/rdoc/RubyXL/SmartTagProperties.html +13 -19
  385. data/rdoc/RubyXL/SmartTagType.html +13 -19
  386. data/rdoc/RubyXL/SmartTagTypes.html +13 -19
  387. data/rdoc/RubyXL/SmartTags.html +13 -19
  388. data/rdoc/RubyXL/SortCondition.html +13 -19
  389. data/rdoc/RubyXL/SortState.html +13 -19
  390. data/rdoc/RubyXL/Sqref.html +18 -51
  391. data/rdoc/RubyXL/Stop.html +13 -19
  392. data/rdoc/RubyXL/StringNode.html +12 -17
  393. data/rdoc/RubyXL/StringNodeW3C.html +19 -52
  394. data/rdoc/RubyXL/StringValue.html +12 -17
  395. data/rdoc/RubyXL/Stylesheet.html +30 -112
  396. data/rdoc/RubyXL/TableFile.html +12 -25
  397. data/rdoc/RubyXL/TableParts.html +12 -17
  398. data/rdoc/RubyXL/TableStyle.html +13 -19
  399. data/rdoc/RubyXL/TableStyles.html +13 -19
  400. data/rdoc/RubyXL/Text.html +19 -63
  401. data/rdoc/RubyXL/TextImportSettings.html +99 -0
  402. data/rdoc/RubyXL/Theme.html +58 -63
  403. data/rdoc/RubyXL/ThemeElements.html +13 -19
  404. data/rdoc/RubyXL/ThumbnailFile.html +12 -25
  405. data/rdoc/RubyXL/Top10.html +13 -19
  406. data/rdoc/RubyXL/VMLDrawingFile.html +15 -32
  407. data/rdoc/RubyXL/Variant.html +13 -19
  408. data/rdoc/RubyXL/Vector.html +17 -37
  409. data/rdoc/RubyXL/VectorValue.html +12 -17
  410. data/rdoc/RubyXL/VisualProperties.html +13 -19
  411. data/rdoc/RubyXL/WebPublishObject.html +13 -19
  412. data/rdoc/RubyXL/WebPublishObjects.html +13 -19
  413. data/rdoc/RubyXL/WebPublishingItem.html +13 -19
  414. data/rdoc/RubyXL/WebPublishingItems.html +13 -19
  415. data/rdoc/RubyXL/WebPublishingProperties.html +13 -19
  416. data/rdoc/RubyXL/WebQueryProperties.html +99 -0
  417. data/rdoc/RubyXL/Workbook.html +483 -226
  418. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +149 -857
  419. data/rdoc/RubyXL/WorkbookProperties.html +13 -19
  420. data/rdoc/RubyXL/WorkbookProtection.html +13 -19
  421. data/rdoc/RubyXL/WorkbookRoot.html +23 -109
  422. data/rdoc/RubyXL/WorkbookView.html +13 -19
  423. data/rdoc/RubyXL/WorkbookViews.html +13 -19
  424. data/rdoc/RubyXL/Worksheet.html +70 -122
  425. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +398 -1049
  426. data/rdoc/RubyXL/WorksheetDimensions.html +13 -19
  427. data/rdoc/RubyXL/WorksheetFormatProperties.html +12 -17
  428. data/rdoc/RubyXL/WorksheetProperties.html +13 -19
  429. data/rdoc/RubyXL/WorksheetProtection.html +13 -19
  430. data/rdoc/RubyXL/WorksheetView.html +13 -19
  431. data/rdoc/RubyXL/WorksheetViews.html +13 -19
  432. data/rdoc/RubyXL/XF.html +13 -19
  433. data/rdoc/created.rid +45 -38
  434. data/rdoc/css/fonts.css +6 -6
  435. data/rdoc/css/rdoc.css +35 -6
  436. data/rdoc/index.html +43 -363
  437. data/rdoc/js/darkfish.js +23 -100
  438. data/rdoc/js/navigation.js +4 -41
  439. data/rdoc/js/navigation.js.gz +0 -0
  440. data/rdoc/js/search.js +32 -31
  441. data/rdoc/js/search_index.js +1 -1
  442. data/rdoc/js/search_index.js.gz +0 -0
  443. data/rdoc/js/searcher.js +7 -6
  444. data/rdoc/js/searcher.js.gz +0 -0
  445. data/rdoc/table_of_contents.html +368 -75
  446. data/rubyXL.gemspec +60 -26
  447. data/spec/lib/cell_spec.rb +147 -2
  448. data/spec/lib/color_spec.rb +1 -0
  449. data/spec/lib/parser_spec.rb +1 -1
  450. data/spec/lib/rgb_color_spec.rb +16 -0
  451. data/spec/lib/text_spec.rb +8 -0
  452. data/spec/lib/workbook_spec.rb +12 -1
  453. data/spec/lib/worksheet_spec.rb +353 -37
  454. data/test/test_parse_write.rb +15 -15
  455. metadata +63 -9
  456. data/rdoc/js/jquery.js +0 -4
@@ -7,17 +7,17 @@ require 'rubyXL/objects/theme'
7
7
  require 'rubyXL/objects/calculation_chain'
8
8
  require 'rubyXL/objects/worksheet'
9
9
  require 'rubyXL/objects/chartsheet'
10
+ require 'rubyXL/objects/connection'
10
11
  require 'rubyXL/objects/relationships'
11
12
  require 'rubyXL/objects/simple_types'
12
13
  require 'rubyXL/objects/extensions'
13
14
  require 'rubyXL/objects/external_links'
14
- require 'rubyXL/convenience_methods'
15
15
 
16
16
  module RubyXL
17
17
 
18
18
  # Eventually, the entire code for Workbook will be moved here.
19
19
 
20
- # http://www.schemacentral.com/sc/ooxml/e-ssml_fileVersion-1.html
20
+ # http://www.datypic.com/sc/ooxml/e-ssml_fileVersion-1.html
21
21
  class FileVersion < OOXMLObject
22
22
  define_attribute(:appName, :string)
23
23
  define_attribute(:lastEdited, :string)
@@ -27,15 +27,15 @@ module RubyXL
27
27
  define_element_name 'fileVersion'
28
28
  end
29
29
 
30
- # http://www.schemacentral.com/sc/ooxml/e-ssml_fileSharing-1.html
30
+ # http://www.datypic.com/sc/ooxml/e-ssml_fileSharing-1.html
31
31
  class FileSharing < OOXMLObject
32
32
  define_attribute(:readOnlyRecommended, :bool, :default => false)
33
33
  define_attribute(:userName, :string)
34
- define_attribute(:reservationPassword, :string)
34
+ define_attribute(:reservationPassword, RubyXL::ST_UnsignedShortHex)
35
35
  define_element_name 'fileSharing'
36
36
  end
37
37
 
38
- # http://www.schemacentral.com/sc/ooxml/e-ssml_workbookPr-1.html
38
+ # http://www.datypic.com/sc/ooxml/e-ssml_workbookPr-1.html
39
39
  class WorkbookProperties < OOXMLObject
40
40
  define_attribute(:date1904, :bool, :default => false)
41
41
  define_attribute(:showObjects, RubyXL::ST_Objects, :default => 'all')
@@ -58,17 +58,17 @@ module RubyXL
58
58
  define_element_name 'workbookPr'
59
59
  end
60
60
 
61
- # http://www.schemacentral.com/sc/ooxml/e-ssml_workbookProtection-1.html
61
+ # http://www.datypic.com/sc/ooxml/e-ssml_workbookProtection-1.html
62
62
  class WorkbookProtection < OOXMLObject
63
- define_attribute(:workbookPassword, :string)
64
- define_attribute(:revisionsPassword, :string)
63
+ define_attribute(:workbookPassword, RubyXL::ST_UnsignedShortHex)
64
+ define_attribute(:revisionsPassword, RubyXL::ST_UnsignedShortHex)
65
65
  define_attribute(:lockStructure, :bool, :default => false)
66
66
  define_attribute(:lockWindows, :bool, :default => false)
67
67
  define_attribute(:lockRevision, :bool, :default => false)
68
68
  define_element_name 'workbookProtection'
69
69
  end
70
70
 
71
- # http://www.schemacentral.com/sc/ooxml/e-ssml_workbookView-1.html
71
+ # http://www.datypic.com/sc/ooxml/e-ssml_workbookView-1.html
72
72
  class WorkbookView < OOXMLObject
73
73
  define_attribute(:visibility, RubyXL::ST_Visibility, :default => 'visible')
74
74
  define_attribute(:minimized, :bool, :default => false)
@@ -87,40 +87,40 @@ module RubyXL
87
87
  define_element_name 'workbookView'
88
88
  end
89
89
 
90
- # http://www.schemacentral.com/sc/ooxml/e-ssml_bookViews-1.html
90
+ # http://www.datypic.com/sc/ooxml/e-ssml_bookViews-1.html
91
91
  class WorkbookViews < OOXMLContainerObject
92
92
  define_child_node(RubyXL::WorkbookView, :collection => true)
93
93
  define_element_name 'bookViews'
94
94
  end
95
95
 
96
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheet-1.html
96
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheet-1.html
97
97
  class Sheet < OOXMLObject
98
98
  define_attribute(:name, :string, :required => true)
99
99
  define_attribute(:sheetId, :int, :required => true)
100
100
  define_attribute(:state, RubyXL::ST_Visibility, :default => 'visible')
101
- define_attribute(:'r:id', :string, :required => true)
101
+ define_relationship(:required => true)
102
102
  define_element_name 'sheet'
103
103
  end
104
104
 
105
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheets-1.html
105
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheets-1.html
106
106
  class Sheets < OOXMLContainerObject
107
107
  define_child_node(RubyXL::Sheet, :collection => true)
108
108
  define_element_name 'sheets'
109
109
  end
110
110
 
111
- # http://www.schemacentral.com/sc/ooxml/e-ssml_externalReference-1.html
111
+ # http://www.datypic.com/sc/ooxml/e-ssml_externalReference-1.html
112
112
  class ExternalReference < OOXMLObject
113
- define_attribute(:'r:id', :string, :required => true)
113
+ define_relationship(:required => true)
114
114
  define_element_name 'externalReference'
115
115
  end
116
116
 
117
- # http://www.schemacentral.com/sc/ooxml/e-ssml_externalReferences-1.html
117
+ # http://www.datypic.com/sc/ooxml/e-ssml_externalReferences-1.html
118
118
  class ExternalReferences < OOXMLContainerObject
119
119
  define_child_node(RubyXL::ExternalReference, :collection => true)
120
120
  define_element_name 'externalReferences'
121
121
  end
122
122
 
123
- # http://www.schemacentral.com/sc/ooxml/e-ssml_definedName-2.html
123
+ # http://www.datypic.com/sc/ooxml/e-ssml_definedName-2.html
124
124
  class DefinedName < OOXMLObject
125
125
  define_attribute(:name, :string, :required => true)
126
126
  define_attribute(:comment, :string)
@@ -144,32 +144,32 @@ module RubyXL
144
144
  define_element_name 'definedName'
145
145
  end
146
146
 
147
- # http://www.schemacentral.com/sc/ooxml/e-ssml_definedName-2.html
147
+ # http://www.datypic.com/sc/ooxml/e-ssml_definedName-2.html
148
148
  class DefinedNames < OOXMLContainerObject
149
149
  define_child_node(RubyXL::DefinedName, :collection => true)
150
150
  define_element_name 'definedNames'
151
151
  end
152
152
 
153
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotCache-1.html
153
+ # http://www.datypic.com/sc/ooxml/e-ssml_pivotCache-1.html
154
154
  class PivotCache < OOXMLObject
155
155
  define_attribute(:cacheId, :int, :required => true)
156
- define_attribute(:'r:id', :string, :required => true)
156
+ define_relationship(:required => true)
157
157
  define_element_name 'pivotCache'
158
158
  end
159
159
 
160
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotCaches-1.html
160
+ # http://www.datypic.com/sc/ooxml/e-ssml_pivotCaches-1.html
161
161
  class PivotCaches < OOXMLContainerObject
162
162
  define_child_node(RubyXL::PivotCache, :collection => true)
163
163
  define_element_name 'pivotCaches'
164
164
  end
165
165
 
166
- # http://www.schemacentral.com/sc/ooxml/e-ssml_oleSize-1.html
166
+ # http://www.datypic.com/sc/ooxml/e-ssml_oleSize-1.html
167
167
  class OLESize < OOXMLObject
168
168
  define_attribute(:ref, :ref, :required => true)
169
169
  define_element_name 'oleSize'
170
170
  end
171
171
 
172
- # http://www.schemacentral.com/sc/ooxml/e-ssml_fileRecoveryPr-1.html
172
+ # http://www.datypic.com/sc/ooxml/e-ssml_fileRecoveryPr-1.html
173
173
  class FileRecoveryProperties < OOXMLObject
174
174
  define_attribute(:autoRecover, :bool, :default => true)
175
175
  define_attribute(:crashSave, :bool, :default => false)
@@ -178,7 +178,7 @@ module RubyXL
178
178
  define_element_name 'fileRecoveryPr'
179
179
  end
180
180
 
181
- # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishing-1.html
181
+ # http://www.datypic.com/sc/ooxml/e-ssml_webPublishing-1.html
182
182
  class WebPublishingProperties < OOXMLObject
183
183
  define_attribute(:css, :bool, :default => true)
184
184
  define_attribute(:thicket, :bool, :default => true)
@@ -191,7 +191,7 @@ module RubyXL
191
191
  define_element_name 'webPublishing'
192
192
  end
193
193
 
194
- # http://www.schemacentral.com/sc/ooxml/e-ssml_calcPr-1.html
194
+ # http://www.datypic.com/sc/ooxml/e-ssml_calcPr-1.html
195
195
  class CalculationProperties < OOXMLObject
196
196
  define_attribute(:calcId, :int)
197
197
  define_attribute(:calcMode, RubyXL::ST_CalcMode, :default => 'auto')
@@ -209,7 +209,7 @@ module RubyXL
209
209
  define_element_name 'calcPr'
210
210
  end
211
211
 
212
- # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishObject-1.html
212
+ # http://www.datypic.com/sc/ooxml/e-ssml_webPublishObject-1.html
213
213
  class WebPublishObject < OOXMLObject
214
214
  define_attribute(:id, :int, :required => true)
215
215
  define_attribute(:divId, :string, :required => true)
@@ -220,20 +220,20 @@ module RubyXL
220
220
  define_element_name 'webPublishObject'
221
221
  end
222
222
 
223
- # http://www.schemacentral.com/sc/ooxml/e-ssml_webPublishObjects-1.html
223
+ # http://www.datypic.com/sc/ooxml/e-ssml_webPublishObjects-1.html
224
224
  class WebPublishObjects < OOXMLContainerObject
225
225
  define_child_node(RubyXL::WebPublishObject, :collection => :with_count)
226
226
  define_element_name 'webPublishObjects'
227
227
  end
228
228
 
229
- # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagPr-1.html
229
+ # http://www.datypic.com/sc/ooxml/e-ssml_smartTagPr-1.html
230
230
  class SmartTagProperties < OOXMLObject
231
231
  define_attribute(:embed, :bool, :default => false)
232
232
  define_attribute(:show, RubyXL::ST_SmartTagShow, :default => 'all')
233
233
  define_element_name 'smartTagPr'
234
234
  end
235
235
 
236
- # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagType-1.html
236
+ # http://www.datypic.com/sc/ooxml/e-ssml_smartTagType-1.html
237
237
  class SmartTagType < OOXMLObject
238
238
  define_attribute(:namespaceUri, :string)
239
239
  define_attribute(:name, :string)
@@ -241,26 +241,26 @@ module RubyXL
241
241
  define_element_name 'smartTagType'
242
242
  end
243
243
 
244
- # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTagTypes-1.html
244
+ # http://www.datypic.com/sc/ooxml/e-ssml_smartTagTypes-1.html
245
245
  class SmartTagTypes < OOXMLContainerObject
246
246
  define_child_node(RubyXL::SmartTagType, :collection => true)
247
247
  define_element_name 'smartTagTypes'
248
248
  end
249
249
 
250
- # http://www.schemacentral.com/sc/ooxml/e-ssml_functionGroup-1.html
250
+ # http://www.datypic.com/sc/ooxml/e-ssml_functionGroup-1.html
251
251
  class FunctionGroup < OOXMLObject
252
252
  define_attribute(:name, :string)
253
253
  define_element_name 'functionGroup'
254
254
  end
255
255
 
256
- # http://www.schemacentral.com/sc/ooxml/e-ssml_functionGroups-1.html
256
+ # http://www.datypic.com/sc/ooxml/e-ssml_functionGroups-1.html
257
257
  class FunctionGroups < OOXMLContainerObject
258
258
  define_attribute(:builtInGroupCountpi, :int, :default => 16)
259
259
  define_child_node(RubyXL::FunctionGroup, :collection => true)
260
260
  define_element_name 'functionGroups'
261
261
  end
262
262
 
263
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customWorkbookView-1.html
263
+ # http://www.datypic.com/sc/ooxml/e-ssml_customWorkbookView-1.html
264
264
  class CustomWorkbookView < OOXMLObject
265
265
  define_attribute(:name, :string, :required => true)
266
266
  define_attribute(:guid, :string, :required => true)
@@ -290,15 +290,17 @@ module RubyXL
290
290
  define_element_name 'customWorkbookView'
291
291
  end
292
292
 
293
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customWorkbookViews-1.html
293
+ # http://www.datypic.com/sc/ooxml/e-ssml_customWorkbookViews-1.html
294
294
  class CustomWorkbookViews < OOXMLContainerObject
295
295
  define_child_node(RubyXL::CustomWorkbookView, :collection => true)
296
296
  define_element_name 'customWorkbookViews'
297
297
  end
298
298
 
299
- # http://www.schemacentral.com/sc/ooxml/e-ssml_workbook.html
299
+ # http://www.datypic.com/sc/ooxml/e-ssml_workbook.html
300
300
  class Workbook < OOXMLTopLevelObject
301
301
  CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
302
+ CONTENT_TYPE_TEMPLATE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml'
303
+ CONTENT_TYPE_TEMPLATE_WITH_MACROS = 'application/vnd.ms-excel.template.macroEnabled.main+xml'
302
304
  CONTENT_TYPE_WITH_MACROS = 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'
303
305
  REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'
304
306
 
@@ -309,7 +311,10 @@ module RubyXL
309
311
  include RubyXL::RelationshipSupport
310
312
 
311
313
  def content_type
312
- if macros then CONTENT_TYPE_WITH_MACROS else CONTENT_TYPE end
314
+ content_type_name = 'CONTENT_TYPE'
315
+ content_type_name << '_TEMPLATE' if is_template
316
+ content_type_name << '_WITH_MACROS' if macros
317
+ self.class.const_get(content_type_name)
313
318
  end
314
319
 
315
320
  def related_objects
@@ -322,6 +327,7 @@ module RubyXL
322
327
  define_relationship(RubyXL::CalculationChain, :calculation_chain)
323
328
  define_relationship(RubyXL::Worksheet, false)
324
329
  define_relationship(RubyXL::Chartsheet, false)
330
+ define_relationship(RubyXL::Connections)
325
331
  define_relationship(RubyXL::ExternalLinksFile)
326
332
  define_relationship(RubyXL::PivotCacheDefinitionFile)
327
333
  define_relationship(RubyXL::PivotCacheRecordsFile)
@@ -332,6 +338,7 @@ module RubyXL
332
338
  define_child_node(RubyXL::FileVersion)
333
339
  define_child_node(RubyXL::FileSharing)
334
340
  define_child_node(RubyXL::WorkbookProperties, :accessor => :workbook_properties)
341
+ define_child_node(RubyXL::RevisionPointer)
335
342
  define_child_node(RubyXL::AlternateContent) # Somehow, order matters here
336
343
  define_child_node(RubyXL::WorkbookProtection)
337
344
  define_child_node(RubyXL::WorkbookViews)
@@ -357,6 +364,7 @@ module RubyXL
357
364
  'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main' => 'x15')
358
365
 
359
366
  attr_accessor :worksheets
367
+ attr_accessor :is_template
360
368
 
361
369
  def before_write_xml
362
370
  max_sheet_id = worksheets.collect(&:sheet_id).compact.max || 0
@@ -391,8 +399,8 @@ module RubyXL
391
399
  dst_file_path ||= root.source_file_path
392
400
 
393
401
  extension = File.extname(dst_file_path)
394
- unless %w{.xlsx .xlsm}.include?(extension.downcase)
395
- raise "Unsupported extension: #{extension} (only .xlsx and .xlsm files are supported)."
402
+ unless %w{.xlsx .xlsm .xltx .xltm}.include?(extension.downcase)
403
+ raise "Unsupported extension: #{extension} (only .xlsx, .xlsm, .xltx and .xltm files are supported)."
396
404
  end
397
405
 
398
406
  File.open(dst_file_path, "wb") { |output_file| FileUtils.copy_stream(root.stream, output_file) }
@@ -412,16 +420,22 @@ module RubyXL
412
420
  private :base_date
413
421
 
414
422
  def date_to_num(date)
415
- date && (date.ajd - base_date().ajd).to_f
423
+ case date
424
+ when Date, DateTime then (date.ajd - base_date().ajd).to_f
425
+ when Time then ((date.to_r - base_date().to_time.to_r) / 86400).to_f
426
+ end
416
427
  end
417
428
 
418
429
  def num_to_date(num)
430
+ return nil if num.nil?
431
+
419
432
  # Bug-for-bug Excel compatibility (https://support.microsoft.com/kb/214058/)
420
- if num && num < MARCH_1_1900 then
433
+ if num < MARCH_1_1900 then
421
434
  num += 1 unless workbook_properties && workbook_properties.date1904
422
435
  end
423
436
 
424
- num && (base_date + num)
437
+ dateparts = num.divmod(1)
438
+ base_date + (dateparts[0] + (dateparts[1] * 86400).round(6) / 86400)
425
439
  end
426
440
 
427
441
  include Enumerable
@@ -430,7 +444,8 @@ module RubyXL
430
444
  APPVERSION = '12.0000'
431
445
 
432
446
  def initialize(worksheets = [], src_file_path = nil, creator = nil, modifier = nil, created_at = nil,
433
- company = '', application = APPLICATION, appversion = APPVERSION, date1904 = 0)
447
+ company = '', application = APPLICATION, appversion = APPVERSION, date1904 = 0,
448
+ is_template = false)
434
449
  super()
435
450
 
436
451
  # Order of sheets in the +worksheets+ array corresponds to the order of pages in Excel UI.
@@ -455,9 +470,104 @@ module RubyXL
455
470
  self.creator = creator
456
471
  self.modifier = modifier
457
472
  self.date1904 = date1904 > 0
473
+ self.is_template = is_template
474
+ end
475
+
476
+ SHEET_NAME_TEMPLATE = 'Sheet%d'
477
+
478
+ # Finds worksheet by its name or numerical index
479
+ def [](ind)
480
+ case ind
481
+ when Integer then worksheets[ind]
482
+ when String then worksheets.find { |ws| ws.sheet_name == ind }
483
+ end
484
+ end
485
+
486
+ # Create new simple worksheet and add it to the workbook worksheets
487
+ #
488
+ # @param [String] The name for the new worksheet
489
+ def add_worksheet(name = nil)
490
+ if name.nil? then
491
+ n = 0
492
+
493
+ begin
494
+ name = SHEET_NAME_TEMPLATE % (n += 1)
495
+ end until self[name].nil?
496
+ end
497
+
498
+ new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)
499
+ worksheets << new_worksheet
500
+ new_worksheet
501
+ end
502
+
503
+ def created_at
504
+ root.core_properties.created_at
505
+ end
506
+
507
+ def created_at=(v)
508
+ root.core_properties.created_at = v
509
+ end
510
+
511
+ def modified_at
512
+ root.core_properties.modified_at
513
+ end
514
+
515
+ def modified_at=(v)
516
+ root.core_properties.modified_at = v
517
+ end
518
+
519
+ def company
520
+ root.document_properties.company && root.document_properties.company.value
521
+ end
522
+
523
+ def company=(v)
524
+ root.document_properties.company ||= StringNode.new
525
+ root.document_properties.company.value = v
526
+ end
527
+
528
+ def application
529
+ root.document_properties.application && root.document_properties.application.value
530
+ end
531
+
532
+ def application=(v)
533
+ root.document_properties.application ||= StringNode.new
534
+ root.document_properties.application.value = v
535
+ end
536
+
537
+ def appversion
538
+ root.document_properties.app_version && root.document_properties.app_version.value
539
+ end
540
+
541
+ def appversion=(v)
542
+ root.document_properties.app_version ||= StringNode.new
543
+ root.document_properties.app_version.value = v
544
+ end
545
+
546
+ def creator
547
+ root.core_properties.creator
548
+ end
549
+
550
+ def creator=(v)
551
+ root.core_properties.creator = v
552
+ end
553
+
554
+ def modifier
555
+ root.core_properties.modifier
556
+ end
557
+
558
+ def modifier=(v)
559
+ root.core_properties.modifier = v
560
+ end
561
+
562
+ def date1904
563
+ workbook_properties && workbook_properties.date1904
564
+ end
565
+
566
+ def date1904=(v)
567
+ self.workbook_properties ||= RubyXL::WorkbookProperties.new
568
+ workbook_properties.date1904 = v
458
569
  end
459
570
 
460
- include WorkbookConvenienceMethods
461
571
  end
462
572
 
463
573
  end
@@ -10,14 +10,15 @@ require 'rubyXL/objects/column_range'
10
10
  require 'rubyXL/objects/filters'
11
11
  require 'rubyXL/objects/data_validation'
12
12
  require 'rubyXL/objects/comments'
13
+ require 'rubyXL/objects/connection'
14
+ require 'rubyXL/objects/query_table'
13
15
  require 'rubyXL/worksheet'
14
- require 'rubyXL/convenience_methods'
15
16
 
16
17
  module RubyXL
17
18
 
18
19
  # Eventually, the entire code for Worksheet will be moved here. One small step at a time!
19
20
 
20
- # http://www.schemacentral.com/sc/ooxml/e-ssml_outlinePr-1.html
21
+ # http://www.datypic.com/sc/ooxml/e-ssml_outlinePr-1.html
21
22
  class OutlineProperties < OOXMLObject
22
23
  define_attribute(:applyStyles, :bool, :default => false)
23
24
  define_attribute(:summaryBelow, :bool, :default => true)
@@ -26,14 +27,14 @@ module RubyXL
26
27
  define_element_name 'outlinePr'
27
28
  end
28
29
 
29
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pageSetUpPr-1.html
30
+ # http://www.datypic.com/sc/ooxml/e-ssml_pageSetUpPr-1.html
30
31
  class PageSetupProperties < OOXMLObject
31
32
  define_attribute(:autoPageBreaks, :bool, :default => true)
32
33
  define_attribute(:fitToPage, :bool, :default => false)
33
34
  define_element_name 'pageSetUpPr'
34
35
  end
35
36
 
36
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetPr-3.html
37
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheetPr-3.html
37
38
  class WorksheetProperties < OOXMLObject
38
39
  define_attribute(:syncHorizontal, :bool, :default => false)
39
40
  define_attribute(:syncVertical, :bool, :default => false)
@@ -50,7 +51,7 @@ module RubyXL
50
51
  define_element_name 'sheetPr'
51
52
  end
52
53
 
53
- # http://www.schemacentral.com/sc/ooxml/e-ssml_dimension-3.html
54
+ # http://www.datypic.com/sc/ooxml/e-ssml_dimension-3.html
54
55
  class WorksheetDimensions < OOXMLObject
55
56
  define_attribute(:ref, :ref)
56
57
  define_element_name 'dimension'
@@ -69,7 +70,7 @@ module RubyXL
69
70
  define_element_name 'sheetFormatPr'
70
71
  end
71
72
 
72
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pageSetup-1.html
73
+ # http://www.datypic.com/sc/ooxml/e-ssml_pageSetup-1.html
73
74
  class PageSetup < OOXMLObject
74
75
  define_attribute(:paperSize, :int, :default => 1)
75
76
  define_attribute(:scale, :int, :default => 100)
@@ -87,7 +88,7 @@ module RubyXL
87
88
  define_attribute(:horizontalDpi, :int, :default => 600)
88
89
  define_attribute(:verticalDpi, :int, :default => 600)
89
90
  define_attribute(:copies, :int, :default => 1)
90
- define_attribute(:'r:id', :string)
91
+ define_relationship
91
92
  define_element_name 'pageSetup'
92
93
  end
93
94
 
@@ -96,19 +97,19 @@ module RubyXL
96
97
  define_element_name 'tableParts'
97
98
  end
98
99
 
99
- # http://www.schemacentral.com/sc/ooxml/e-ssml_mergeCell-1.html
100
+ # http://www.datypic.com/sc/ooxml/e-ssml_mergeCell-1.html
100
101
  class MergedCell < OOXMLObject
101
102
  define_attribute(:ref, :ref)
102
103
  define_element_name 'mergeCell'
103
104
  end
104
105
 
105
- # http://www.schemacentral.com/sc/ooxml/e-ssml_mergeCells-1.html
106
+ # http://www.datypic.com/sc/ooxml/e-ssml_mergeCells-1.html
106
107
  class MergedCells < OOXMLContainerObject
107
108
  define_child_node(RubyXL::MergedCell, :collection => :with_count)
108
109
  define_element_name 'mergeCells'
109
110
  end
110
111
 
111
- # http://www.schemacentral.com/sc/ooxml/e-ssml_printOptions-1.html
112
+ # http://www.datypic.com/sc/ooxml/e-ssml_printOptions-1.html
112
113
  class PrintOptions < OOXMLObject
113
114
  define_attribute(:horizontalCentered, :bool, :default => false)
114
115
  define_attribute(:verticalCentered, :bool, :default => false)
@@ -118,30 +119,30 @@ module RubyXL
118
119
  define_element_name 'printOptions'
119
120
  end
120
121
 
121
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetCalcPr-1.html
122
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheetCalcPr-1.html
122
123
  class SheetCalculationProperties < OOXMLObject
123
124
  define_attribute(:fullCalcOnLoad, :bool, :default => false)
124
125
  define_element_name 'sheetCalcPr'
125
126
  end
126
127
 
127
- # http://www.schemacentral.com/sc/ooxml/e-ssml_protectedRange-1.html
128
+ # http://www.datypic.com/sc/ooxml/e-ssml_protectedRange-1.html
128
129
  class ProtectedRange < OOXMLObject
129
- define_attribute(:password, :string)
130
+ define_attribute(:password, RubyXL::ST_UnsignedShortHex)
130
131
  define_attribute(:sqref, :sqref, :required => true)
131
132
  define_attribute(:name, :string, :required => true)
132
133
  define_attribute(:securityDescriptor, :string)
133
134
  define_element_name 'protectedRange'
134
135
  end
135
136
 
136
- # http://www.schemacentral.com/sc/ooxml/e-ssml_protectedRanges-1.html
137
+ # http://www.datypic.com/sc/ooxml/e-ssml_protectedRanges-1.html
137
138
  class ProtectedRanges < OOXMLContainerObject
138
139
  define_child_node(RubyXL::ProtectedRange, :collection => true)
139
140
  define_element_name 'protectedRanges'
140
141
  end
141
142
 
142
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetProtection-1.html
143
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheetProtection-1.html
143
144
  class WorksheetProtection < OOXMLObject
144
- define_attribute(:password, :string)
145
+ define_attribute(:password, RubyXL::ST_UnsignedShortHex)
145
146
  define_attribute(:sheet, :bool, :default => false)
146
147
  define_attribute(:objects, :bool, :default => false)
147
148
  define_attribute(:scenarios, :bool, :default => false)
@@ -161,7 +162,7 @@ module RubyXL
161
162
  define_element_name 'sheetProtection'
162
163
  end
163
164
 
164
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cfvo-1.html
165
+ # http://www.datypic.com/sc/ooxml/e-ssml_cfvo-1.html
165
166
  class ConditionalFormatValue < OOXMLObject
166
167
  define_attribute(:type, RubyXL::ST_CfvoType, :required => true)
167
168
  define_attribute(:val, :string)
@@ -170,14 +171,14 @@ module RubyXL
170
171
  define_element_name 'cfvo'
171
172
  end
172
173
 
173
- # http://www.schemacentral.com/sc/ooxml/e-ssml_colorScale-1.html
174
+ # http://www.datypic.com/sc/ooxml/e-ssml_colorScale-1.html
174
175
  class ColorScale < OOXMLObject
175
176
  define_child_node(RubyXL::ConditionalFormatValue, :collection => true, :accessor => :cfvo)
176
177
  define_child_node(RubyXL::Color)
177
178
  define_element_name 'colorScale'
178
179
  end
179
180
 
180
- # http://www.schemacentral.com/sc/ooxml/e-ssml_dataBar-1.html
181
+ # http://www.datypic.com/sc/ooxml/e-ssml_dataBar-1.html
181
182
  class DataBar < OOXMLObject
182
183
  define_attribute(:minLength, :int, :default => 10)
183
184
  define_attribute(:maxLength, :int, :default => 90)
@@ -187,7 +188,7 @@ module RubyXL
187
188
  define_element_name 'dataBar'
188
189
  end
189
190
 
190
- # http://www.schemacentral.com/sc/ooxml/e-ssml_iconSet-1.html
191
+ # http://www.datypic.com/sc/ooxml/e-ssml_iconSet-1.html
191
192
  class IconSet < OOXMLObject
192
193
  define_attribute(:iconSet, RubyXL::ST_IconSetType, :default => '3TrafficLights1')
193
194
  define_attribute(:showValue, :bool, :default => true)
@@ -197,7 +198,7 @@ module RubyXL
197
198
  define_element_name 'iconSet'
198
199
  end
199
200
 
200
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cfRule-1.html
201
+ # http://www.datypic.com/sc/ooxml/e-ssml_cfRule-1.html
201
202
  class ConditionalFormattingRule < OOXMLObject
202
203
  define_attribute(:type, RubyXL::ST_CfType)
203
204
  define_attribute(:dxfId, :int)
@@ -220,7 +221,7 @@ module RubyXL
220
221
  define_element_name 'cfRule'
221
222
  end
222
223
 
223
- # http://www.schemacentral.com/sc/ooxml/e-ssml_brk-1.html
224
+ # http://www.datypic.com/sc/ooxml/e-ssml_brk-1.html
224
225
  class Break < OOXMLObject
225
226
  define_attribute(:id, :int, :default => 0)
226
227
  define_attribute(:min, :int, :default => 0)
@@ -230,13 +231,13 @@ module RubyXL
230
231
  define_element_name 'brk'
231
232
  end
232
233
 
233
- # http://www.schemacentral.com/sc/ooxml/e-ssml_rowBreaks-1.html
234
+ # http://www.datypic.com/sc/ooxml/e-ssml_rowBreaks-1.html
234
235
  class BreakList < OOXMLContainerObject
235
236
  define_attribute(:manualBreakCount, :int, :default => 0)
236
237
  define_child_node(RubyXL::Break, :collection => :with_count)
237
238
  end
238
239
 
239
- # http://www.schemacentral.com/sc/ooxml/e-ssml_conditionalFormatting-1.html
240
+ # http://www.datypic.com/sc/ooxml/e-ssml_conditionalFormatting-1.html
240
241
  class ConditionalFormatting < OOXMLObject
241
242
  define_attribute(:pivot, :bool, :default => false)
242
243
  define_attribute(:sqref, :sqref)
@@ -245,7 +246,7 @@ module RubyXL
245
246
  define_element_name 'conditionalFormatting'
246
247
  end
247
248
 
248
- # http://www.schemacentral.com/sc/ooxml/e-ssml_inputCells-1.html
249
+ # http://www.datypic.com/sc/ooxml/e-ssml_inputCells-1.html
249
250
  class InputCells < OOXMLObject
250
251
  define_attribute(:r, :ref, :required => true)
251
252
  define_attribute(:deleted, :bool, :default => false)
@@ -255,7 +256,7 @@ module RubyXL
255
256
  define_element_name 'inputCells'
256
257
  end
257
258
 
258
- # http://www.schemacentral.com/sc/ooxml/e-ssml_scenario-1.html
259
+ # http://www.datypic.com/sc/ooxml/e-ssml_scenario-1.html
259
260
  class Scenario < OOXMLContainerObject
260
261
  define_attribute(:name, :string)
261
262
  define_attribute(:locked, :bool, :default => false)
@@ -266,7 +267,7 @@ module RubyXL
266
267
  define_element_name 'scenario'
267
268
  end
268
269
 
269
- # http://www.schemacentral.com/sc/ooxml/e-ssml_scenarios-1.html
270
+ # http://www.datypic.com/sc/ooxml/e-ssml_scenarios-1.html
270
271
  class Scenarios < OOXMLContainerObject
271
272
  define_attribute(:current, :int)
272
273
  define_attribute(:show, :int)
@@ -275,7 +276,7 @@ module RubyXL
275
276
  define_element_name 'scenarios'
276
277
  end
277
278
 
278
- # http://www.schemacentral.com/sc/ooxml/e-ssml_ignoredError-1.html
279
+ # http://www.datypic.com/sc/ooxml/e-ssml_ignoredError-1.html
279
280
  class IgnoredError < OOXMLObject
280
281
  define_attribute(:sqref, :sqref, :required => true)
281
282
  define_attribute(:pivot, :bool, :default => false)
@@ -291,30 +292,30 @@ module RubyXL
291
292
  define_element_name 'ignoredError'
292
293
  end
293
294
 
294
- # http://www.schemacentral.com/sc/ooxml/e-ssml_ignoredErrors-1.html
295
+ # http://www.datypic.com/sc/ooxml/e-ssml_ignoredErrors-1.html
295
296
  class IgnoredErrors < OOXMLContainerObject
296
297
  define_child_node(RubyXL::IgnoredError, :collection => true)
297
298
  define_child_node(RubyXL::ExtensionStorageArea)
298
299
  define_element_name 'ignoredErrors'
299
300
  end
300
301
 
301
- # http://www.schemacentral.com/sc/ooxml/e-ssml_hyperlink-1.html
302
+ # http://www.datypic.com/sc/ooxml/e-ssml_hyperlink-1.html
302
303
  class Hyperlink < OOXMLObject
303
304
  define_attribute(:ref, :ref, :required => true)
304
- define_attribute(:'r:id', :string)
305
+ define_relationship
305
306
  define_attribute(:location, :string)
306
307
  define_attribute(:tooltip, :string)
307
308
  define_attribute(:display, :string)
308
309
  define_element_name 'hyperlink'
309
310
  end
310
311
 
311
- # http://www.schemacentral.com/sc/ooxml/e-ssml_hyperlinks-1.html
312
+ # http://www.datypic.com/sc/ooxml/e-ssml_hyperlinks-1.html
312
313
  class Hyperlinks < OOXMLContainerObject
313
314
  define_child_node(RubyXL::Hyperlink, :collection => true)
314
315
  define_element_name 'hyperlinks'
315
316
  end
316
317
 
317
- # http://www.schemacentral.com/sc/ooxml/e-ssml_oleObject-1.html
318
+ # http://www.datypic.com/sc/ooxml/e-ssml_oleObject-1.html
318
319
  class OLEObject < OOXMLObject
319
320
  define_attribute(:progId, :string)
320
321
  define_attribute(:dvAspect, RubyXL::ST_DvAspect, :default => 'DVASPECT_CONTENT')
@@ -322,33 +323,33 @@ module RubyXL
322
323
  define_attribute(:oleUpdate, RubyXL::ST_OleUpdate)
323
324
  define_attribute(:autoLoad, :bool, :default => false)
324
325
  define_attribute(:shapeId, :int, :required => true)
325
- define_attribute(:'r:id', :string)
326
+ define_relationship
326
327
  define_element_name 'oleObject'
327
328
  end
328
329
 
329
- # http://www.schemacentral.com/sc/ooxml/e-ssml_oleObjects-1.html
330
+ # http://www.datypic.com/sc/ooxml/e-ssml_oleObjects-1.html
330
331
  class OLEObjects < OOXMLContainerObject
331
332
  define_child_node(RubyXL::OLEObject, :collection => true)
332
333
  define_child_node(RubyXL::AlternateContent)
333
334
  define_element_name 'oleObjects'
334
335
  end
335
336
 
336
- # http://www.schemacentral.com/sc/ooxml/e-ssml_dataRef-1.html
337
+ # http://www.datypic.com/sc/ooxml/e-ssml_dataRef-1.html
337
338
  class DataConsolidationReference < OOXMLObject
338
339
  define_attribute(:ref, :ref)
339
340
  define_attribute(:name, :string)
340
341
  define_attribute(:sheet, :string)
341
- define_attribute(:'r:id', :string)
342
+ define_relationship
342
343
  define_element_name 'dataRef'
343
344
  end
344
345
 
345
- # http://www.schemacentral.com/sc/ooxml/e-ssml_dataRefs-1.html
346
+ # http://www.datypic.com/sc/ooxml/e-ssml_dataRefs-1.html
346
347
  class DataConsolidationReferences < OOXMLContainerObject
347
348
  define_child_node(RubyXL::DataConsolidationReference, :collection => :with_count)
348
349
  define_element_name 'dataRefs'
349
350
  end
350
351
 
351
- # http://www.schemacentral.com/sc/ooxml/e-ssml_dataConsolidate-1.html
352
+ # http://www.datypic.com/sc/ooxml/e-ssml_dataConsolidate-1.html
352
353
  class DataConsolidate < OOXMLObject
353
354
  define_attribute(:function, RubyXL::ST_DataConsolidateFunction, :default => 'sum')
354
355
  define_attribute(:leftLabels, :bool, :default => false)
@@ -358,29 +359,29 @@ module RubyXL
358
359
  define_element_name 'dataConsolidate'
359
360
  end
360
361
 
361
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pane-1.html
362
+ # http://www.datypic.com/sc/ooxml/e-ssml_pane-1.html
362
363
  class Pane < OOXMLObject
363
364
  define_attribute(:xSplit, :double)
364
365
  define_attribute(:ySplit, :double)
365
- define_attribute(:topLeftCell, :string)
366
- define_attribute(:activePane, RubyXL::ST_Pane, :default => 'topLeft', )
367
- define_attribute(:state, RubyXL::ST_PaneState, :default=> 'split')
366
+ define_attribute(:topLeftCell, :ref)
367
+ define_attribute(:activePane, RubyXL::ST_Pane, :default => 'topLeft')
368
+ define_attribute(:state, RubyXL::ST_PaneState, :default => 'split')
368
369
  define_element_name 'pane'
369
370
  end
370
371
 
371
- # http://www.schemacentral.com/sc/ooxml/e-ssml_selection-1.html
372
+ # http://www.datypic.com/sc/ooxml/e-ssml_selection-1.html
372
373
  class Selection < OOXMLObject
373
374
  define_attribute(:pane, RubyXL::ST_Pane)
374
375
  define_attribute(:activeCell, :ref)
375
- define_attribute(:activeCellId, :int) # 0-based index of @active_cell in @sqref
376
+ define_attribute(:activeCellId, :uint) # 0-based index of @active_cell in @sqref
376
377
  define_attribute(:sqref, :sqref) # Array of references to the selected cells.
377
378
  define_element_name 'selection'
378
379
 
379
380
  def before_write_xml
380
- # Normally, rindex of activeCellId in sqref:
381
+ # Normally, +rindex+ of activeCellId in sqref:
381
382
  # <selection activeCell="E12" activeCellId="9" sqref="A4 B6 C8 D10 E12 A4 B6 C8 D10 E12"/>
382
383
  if @active_cell_id.nil? && !@active_cell.nil? && @sqref.size > 1 then
383
- # But, things can be more complex:
384
+ # But, things can get more complicated:
384
385
  # <selection activeCell="E8" activeCellId="2" sqref="A4:B4 C6:D6 E8:F8"/>
385
386
  # Not using .reverse.each here to avoid memory reallocation.
386
387
  @sqref.each_with_index { |ref, ind| @active_cell_id = ind if ref.cover?(@active_cell) }
@@ -389,7 +390,7 @@ module RubyXL
389
390
  end
390
391
  end
391
392
 
392
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customSheetView-1.html
393
+ # http://www.datypic.com/sc/ooxml/e-ssml_customSheetView-1.html
393
394
  class CustomSheetView < OOXMLObject
394
395
  define_attribute(:guid, :string, :required => true)
395
396
  define_attribute(:scale, :int, :default => 100)
@@ -424,47 +425,47 @@ module RubyXL
424
425
  define_element_name 'customSheetView'
425
426
  end
426
427
 
427
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customSheetViews-1.html
428
+ # http://www.datypic.com/sc/ooxml/e-ssml_customSheetViews-1.html
428
429
  class CustomSheetViews < OOXMLContainerObject
429
430
  define_child_node(RubyXL::CustomSheetView, :collection => true)
430
431
  define_element_name 'customSheetViews'
431
432
  end
432
433
 
433
- # http://www.schemacentral.com/sc/ooxml/e-ssml_control-1.html
434
+ # http://www.datypic.com/sc/ooxml/e-ssml_control-1.html
434
435
  class EmbeddedControl < OOXMLObject
435
436
  define_attribute(:shapeId, :int, :required => true)
436
- define_attribute(:'r:id', :string, :required => true)
437
+ define_relationship(:required => true)
437
438
  define_attribute(:name, :string)
438
439
  define_element_name 'control'
439
440
  end
440
441
 
441
- # http://www.schemacentral.com/sc/ooxml/e-ssml_controls-1.html
442
+ # http://www.datypic.com/sc/ooxml/e-ssml_controls-1.html
442
443
  class EmbeddedControls < OOXMLContainerObject
443
444
  define_child_node(RubyXL::EmbeddedControl, :collection => true)
444
445
  define_child_node(RubyXL::AlternateContent)
445
446
  define_element_name 'controls'
446
447
  end
447
448
 
448
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cellWatch-1.html
449
+ # http://www.datypic.com/sc/ooxml/e-ssml_cellWatch-1.html
449
450
  class CellWatch < OOXMLObject
450
451
  define_attribute(:r, :ref)
451
452
  define_element_name 'cellWatch'
452
453
  end
453
454
 
454
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cellWatches-1.html
455
+ # http://www.datypic.com/sc/ooxml/e-ssml_cellWatches-1.html
455
456
  class CellWatches < OOXMLContainerObject
456
457
  define_child_node(RubyXL::CellWatch, :collection => true)
457
458
  define_element_name 'cellWatches'
458
459
  end
459
460
 
460
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTagPr-1.html
461
+ # http://www.datypic.com/sc/ooxml/e-ssml_cellSmartTagPr-1.html
461
462
  class CellSmartTagProperty < OOXMLObject
462
463
  define_attribute(:key, :string, :required => true)
463
464
  define_attribute(:val, :string, :required => true)
464
465
  define_element_name 'cellSmartTagPr'
465
466
  end
466
467
 
467
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTag-1.html
468
+ # http://www.datypic.com/sc/ooxml/e-ssml_cellSmartTag-1.html
468
469
  class CellSmartTag < OOXMLObject
469
470
  define_attribute(:type, :int, :required => true)
470
471
  define_attribute(:deleted, :bool, :default => false)
@@ -473,27 +474,27 @@ module RubyXL
473
474
  define_element_name 'cellSmartTag'
474
475
  end
475
476
 
476
- # http://www.schemacentral.com/sc/ooxml/e-ssml_cellSmartTags-1.html
477
+ # http://www.datypic.com/sc/ooxml/e-ssml_cellSmartTags-1.html
477
478
  class CellSmartTags < OOXMLContainerObject
478
479
  define_attribute(:r, :ref, :accessor => :ref)
479
480
  define_child_node(RubyXL::CellSmartTag, :collection => true)
480
481
  define_element_name 'cellSmartTags'
481
482
  end
482
483
 
483
- # http://www.schemacentral.com/sc/ooxml/e-ssml_smartTags-1.html
484
+ # http://www.datypic.com/sc/ooxml/e-ssml_smartTags-1.html
484
485
  class SmartTags < OOXMLContainerObject
485
486
  define_child_node(RubyXL::CellSmartTags, :collection => true)
486
487
  define_element_name 'smartTags'
487
488
  end
488
489
 
489
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customPr-1.html
490
+ # http://www.datypic.com/sc/ooxml/e-ssml_customPr-1.html
490
491
  class CustomProperty < OOXMLObject
491
492
  define_attribute(:name, :string, :required => true)
492
- define_attribute(:'r:id', :string, :required => true)
493
+ define_relationship(:required => true)
493
494
  define_element_name 'customPr'
494
495
  end
495
496
 
496
- # http://www.schemacentral.com/sc/ooxml/e-ssml_customProperties-1.html
497
+ # http://www.datypic.com/sc/ooxml/e-ssml_customProperties-1.html
497
498
  class CustomProperties < OOXMLContainerObject
498
499
  define_child_node(RubyXL::CustomProperty, :collection => true)
499
500
  define_element_name 'customProperties'
@@ -528,75 +529,75 @@ module RubyXL
528
529
  define_element_name 'reference'
529
530
  end
530
531
 
531
- # http://www.schemacentral.com/sc/ooxml/e-ssml_references-1.html
532
+ # http://www.datypic.com/sc/ooxml/e-ssml_references-1.html
532
533
  class PivotReferences < OOXMLContainerObject
533
534
  define_child_node(RubyXL::PivotReference, :collection => :with_count)
534
535
  define_element_name 'references'
535
536
  end
536
537
 
537
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotArea-4.html
538
+ # http://www.datypic.com/sc/ooxml/e-ssml_pivotArea-4.html
538
539
  class PivotArea < OOXMLObject
539
540
  define_attribute(:field, :int)
540
541
  define_attribute(:type, RubyXL::ST_PivotAreaType, :default => 'normal')
541
- define_attribute(:dataOnly, :bool, :default => true)
542
- define_attribute(:labelOnly, :bool, :default => false)
543
- define_attribute(:grandRow, :bool, :default => false)
544
- define_attribute(:grandCol, :bool, :default => false)
545
- define_attribute(:cacheIndex, :bool, :default => false)
546
- define_attribute(:outline, :bool, :default => true)
542
+ define_attribute(:dataOnly, :bool, :default => true)
543
+ define_attribute(:labelOnly, :bool, :default => false)
544
+ define_attribute(:grandRow, :bool, :default => false)
545
+ define_attribute(:grandCol, :bool, :default => false)
546
+ define_attribute(:cacheIndex, :bool, :default => false)
547
+ define_attribute(:outline, :bool, :default => true)
547
548
  define_attribute(:offset, :ref)
548
549
  define_attribute(:collapsedLevelsAreSubtotals, :bool, :default => false)
549
550
  define_attribute(:axis, RubyXL::ST_Axis)
550
- define_attribute(:fieldPosition, :int, :default => 0)
551
+ define_attribute(:fieldPosition, :int, :default => 0)
551
552
  define_child_node(RubyXL::PivotReferences)
552
553
  define_child_node(RubyXL::ExtensionStorageArea)
553
554
  define_element_name 'pivotArea'
554
555
  end
555
556
 
556
- # http://www.schemacentral.com/sc/ooxml/e-ssml_pivotSelection-1.html
557
+ # http://www.datypic.com/sc/ooxml/e-ssml_pivotSelection-1.html
557
558
  class PivotTableSelection < OOXMLObject
558
559
  define_attribute(:pane, RubyXL::ST_Pane, :default => 'topLeft')
559
- define_attribute(:showHeader, :bool, :default => false)
560
- define_attribute(:label, :bool, :default => false)
561
- define_attribute(:data, :bool, :default => false)
562
- define_attribute(:extendable, :bool, :default => false)
563
- define_attribute(:count, :int, :default => 0)
560
+ define_attribute(:showHeader, :bool, :default => false)
561
+ define_attribute(:label, :bool, :default => false)
562
+ define_attribute(:data, :bool, :default => false)
563
+ define_attribute(:extendable, :bool, :default => false)
564
+ define_attribute(:count, :uint, :default => 0)
564
565
  define_attribute(:axis, RubyXL::ST_Axis)
565
- define_attribute(:dimension, :int, :default => 0)
566
- define_attribute(:start, :int, :default => 0)
567
- define_attribute(:min, :int, :default => 0)
568
- define_attribute(:max, :int, :default => 0)
569
- define_attribute(:activeRow, :int, :default => 0)
570
- define_attribute(:activeCol, :int, :default => 0)
571
- define_attribute(:previousRow, :int, :default => 0)
572
- define_attribute(:previousCol, :int, :default => 0)
573
- define_attribute(:click, :int, :default => 0)
574
- define_attribute(:'r:id', :string)
566
+ define_attribute(:dimension, :uint, :default => 0)
567
+ define_attribute(:start, :uint, :default => 0)
568
+ define_attribute(:min, :uint, :default => 0)
569
+ define_attribute(:max, :uint, :default => 0)
570
+ define_attribute(:activeRow, :uint, :default => 0)
571
+ define_attribute(:activeCol, :uint, :default => 0)
572
+ define_attribute(:previousRow, :uint, :default => 0)
573
+ define_attribute(:previousCol, :uint, :default => 0)
574
+ define_attribute(:click, :uint, :default => 0)
575
+ define_relationship
575
576
  define_child_node(RubyXL::PivotArea)
576
577
  define_element_name 'pivotSelection'
577
578
  end
578
579
 
579
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetView-1.html
580
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheetView-1.html
580
581
  class WorksheetView < OOXMLObject
581
- define_attribute(:windowProtection, :bool, :default => false)
582
- define_attribute(:showFormulas, :bool, :default => false)
583
- define_attribute(:showGridLines, :bool, :default => true)
584
- define_attribute(:showRowColHeaders, :bool, :default => true)
585
- define_attribute(:showZeros, :bool, :default => true)
586
- define_attribute(:rightToLeft, :bool, :default => false)
587
- define_attribute(:tabSelected, :bool, :default => false)
588
- define_attribute(:showRuler, :bool, :default => true)
589
- define_attribute(:showOutlineSymbols, :bool, :default => true)
590
- define_attribute(:defaultGridColor, :bool, :default => true)
591
- define_attribute(:showWhiteSpace, :bool, :default => true)
582
+ define_attribute(:windowProtection, :bool, :default => false)
583
+ define_attribute(:showFormulas, :bool, :default => false)
584
+ define_attribute(:showGridLines, :bool, :default => true)
585
+ define_attribute(:showRowColHeaders, :bool, :default => true)
586
+ define_attribute(:showZeros, :bool, :default => true)
587
+ define_attribute(:rightToLeft, :bool, :default => false)
588
+ define_attribute(:tabSelected, :bool, :default => false)
589
+ define_attribute(:showRuler, :bool, :default => true)
590
+ define_attribute(:showOutlineSymbols, :bool, :default => true)
591
+ define_attribute(:defaultGridColor, :bool, :default => true)
592
+ define_attribute(:showWhiteSpace, :bool, :default => true)
592
593
  define_attribute(:view, RubyXL::ST_SheetViewType, :default => 'normal')
593
594
  define_attribute(:topLeftCell, :ref)
594
- define_attribute(:colorId, :int, :default => 64)
595
- define_attribute(:zoomScale, :int, :default => 100)
596
- define_attribute(:zoomScaleNormal, :int, :default => 0)
597
- define_attribute(:zoomScaleSheetLayoutView, :bool, :default => 0)
598
- define_attribute(:zoomScalePageLayoutView, :bool, :default => 0)
599
- define_attribute(:workbookViewId, :int, :required => true, :default => 0 )
595
+ define_attribute(:colorId, :uint, :default => 64)
596
+ define_attribute(:zoomScale, :uint, :default => 100)
597
+ define_attribute(:zoomScaleNormal, :uint, :default => 0)
598
+ define_attribute(:zoomScaleSheetLayoutView, :uint, :default => 0)
599
+ define_attribute(:zoomScalePageLayoutView, :uint, :default => 0)
600
+ define_attribute(:workbookViewId, :uint, :required => true, :default => 0 )
600
601
  define_child_node(RubyXL::Pane)
601
602
  define_child_node(RubyXL::Selection, :collection => true, :accessor => :selections)
602
603
  define_child_node(RubyXL::PivotTableSelection, :collection => true, :accessor => :pivot_table_selections )
@@ -604,14 +605,14 @@ module RubyXL
604
605
  define_element_name 'sheetView'
605
606
  end
606
607
 
607
- # http://www.schemacentral.com/sc/ooxml/e-ssml_sheetViews-3.html
608
+ # http://www.datypic.com/sc/ooxml/e-ssml_sheetViews-3.html
608
609
  class WorksheetViews < OOXMLContainerObject
609
610
  define_child_node(RubyXL::WorksheetView, :collection => true)
610
611
  define_child_node(RubyXL::ExtensionStorageArea)
611
612
  define_element_name 'sheetViews'
612
613
  end
613
614
 
614
- # http://www.schemacentral.com/sc/ooxml/e-ssml_worksheet.html
615
+ # http://www.datypic.com/sc/ooxml/e-ssml_worksheet.html
615
616
  class Worksheet < OOXMLTopLevelObject
616
617
  CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
617
618
  REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet'
@@ -630,8 +631,11 @@ module RubyXL
630
631
  define_relationship(RubyXL::PivotTableFile)
631
632
  define_relationship(RubyXL::TableFile)
632
633
  define_relationship(RubyXL::ControlPropertiesFile)
634
+ define_relationship(RubyXL::CustomPropertyFile)
633
635
  define_relationship(RubyXL::SlicerFile)
634
636
  define_relationship(RubyXL::OLEObjectFile)
637
+ define_relationship(RubyXL::ActiveX)
638
+ define_relationship(RubyXL::QueryTable)
635
639
 
636
640
  define_child_node(RubyXL::WorksheetProperties)
637
641
  define_child_node(RubyXL::WorksheetDimensions)
@@ -740,8 +744,15 @@ module RubyXL
740
744
  sheet_obj
741
745
  end
742
746
 
747
+ def get_col_xf(column_index)
748
+ workbook.stylesheet.cell_xfs[get_col_style(column_index)]
749
+ end
750
+
751
+ def get_row_xf(row)
752
+ workbook.stylesheet.cell_xfs[get_row_style(row)]
753
+ end
754
+
743
755
  include LegacyWorksheet
744
- include WorksheetConvenienceMethods
745
756
  end
746
757
 
747
758
  end