rubyXL 3.4.14 → 3.4.33

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 (462) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -1
  3. data/.rubocop.yml +124 -0
  4. data/CHANGELOG.md +12 -0
  5. data/Gemfile +10 -8
  6. data/README.rdoc +32 -13
  7. data/Rakefile +26 -27
  8. data/VERSION +1 -1
  9. data/lib/rubyXL/cell.rb +2 -4
  10. data/lib/rubyXL/convenience_methods/cell.rb +36 -32
  11. data/lib/rubyXL/convenience_methods/color.rb +9 -13
  12. data/lib/rubyXL/convenience_methods/workbook.rb +10 -9
  13. data/lib/rubyXL/convenience_methods/worksheet.rb +103 -7
  14. data/lib/rubyXL/objects/border.rb +0 -3
  15. data/lib/rubyXL/objects/calculation_chain.rb +2 -2
  16. data/lib/rubyXL/objects/cell_style.rb +1 -3
  17. data/lib/rubyXL/objects/chartsheet.rb +6 -10
  18. data/lib/rubyXL/objects/color.rb +2 -4
  19. data/lib/rubyXL/objects/column_range.rb +16 -15
  20. data/lib/rubyXL/objects/comments.rb +1 -4
  21. data/lib/rubyXL/objects/connection.rb +11 -11
  22. data/lib/rubyXL/objects/container_nodes.rb +1 -5
  23. data/lib/rubyXL/objects/content_types.rb +3 -6
  24. data/lib/rubyXL/objects/data_validation.rb +2 -2
  25. data/lib/rubyXL/objects/document_properties.rb +10 -13
  26. data/lib/rubyXL/objects/extensions.rb +0 -2
  27. data/lib/rubyXL/objects/external_links.rb +37 -7
  28. data/lib/rubyXL/objects/fill.rb +2 -5
  29. data/lib/rubyXL/objects/filters.rb +5 -7
  30. data/lib/rubyXL/objects/font.rb +2 -4
  31. data/lib/rubyXL/objects/formula.rb +3 -5
  32. data/lib/rubyXL/objects/ooxml_object.rb +34 -32
  33. data/lib/rubyXL/objects/query_table.rb +7 -5
  34. data/lib/rubyXL/objects/reference.rb +26 -17
  35. data/lib/rubyXL/objects/relationships.rb +7 -12
  36. data/lib/rubyXL/objects/root.rb +0 -2
  37. data/lib/rubyXL/objects/shared_strings.rb +4 -7
  38. data/lib/rubyXL/objects/sheet_common.rb +1 -3
  39. data/lib/rubyXL/objects/sheet_data.rb +12 -14
  40. data/lib/rubyXL/objects/simple_types.rb +3 -1
  41. data/lib/rubyXL/objects/storage.rb +57 -51
  42. data/lib/rubyXL/objects/stylesheet.rb +9 -17
  43. data/lib/rubyXL/objects/text.rb +6 -8
  44. data/lib/rubyXL/objects/theme.rb +19 -24
  45. data/lib/rubyXL/objects/workbook.rb +43 -38
  46. data/lib/rubyXL/objects/worksheet.rb +35 -31
  47. data/lib/rubyXL/parser.rb +1 -3
  48. data/lib/rubyXL/worksheet.rb +86 -79
  49. data/lib/rubyXL.rb +0 -1
  50. data/rdoc/README_rdoc.html +139 -73
  51. data/rdoc/RubyXL/AExtension.html +24 -60
  52. data/rdoc/RubyXL/AExtensionStorageArea.html +6 -13
  53. data/rdoc/RubyXL/ActiveX.html +19 -46
  54. data/rdoc/RubyXL/ActiveXBinary.html +6 -18
  55. data/rdoc/RubyXL/AdjustHandleList.html +6 -13
  56. data/rdoc/RubyXL/Alignment.html +6 -13
  57. data/rdoc/RubyXL/AlternateContent.html +6 -13
  58. data/rdoc/RubyXL/AlternateUrls.html +99 -0
  59. data/rdoc/RubyXL/Authors.html +6 -13
  60. data/rdoc/RubyXL/AutoFilter.html +6 -13
  61. data/rdoc/RubyXL/AutoFilterColumn.html +6 -13
  62. data/rdoc/RubyXL/BinaryImageFile.html +6 -21
  63. data/rdoc/RubyXL/BodyProperties.html +6 -13
  64. data/rdoc/RubyXL/BooleanNode.html +6 -13
  65. data/rdoc/RubyXL/BooleanValue.html +6 -13
  66. data/rdoc/RubyXL/Border.html +37 -89
  67. data/rdoc/RubyXL/BorderEdge.html +23 -53
  68. data/rdoc/RubyXL/Borders.html +16 -35
  69. data/rdoc/RubyXL/Break.html +6 -13
  70. data/rdoc/RubyXL/BreakList.html +6 -13
  71. data/rdoc/RubyXL/CT_AdjPoint2D.html +6 -13
  72. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +6 -13
  73. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +6 -13
  74. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +6 -13
  75. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +6 -13
  76. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +6 -13
  77. data/rdoc/RubyXL/CT_Backdrop.html +6 -13
  78. data/rdoc/RubyXL/CT_Bevel.html +6 -13
  79. data/rdoc/RubyXL/CT_BiLevelEffect.html +6 -13
  80. data/rdoc/RubyXL/CT_BlendEffect.html +6 -13
  81. data/rdoc/RubyXL/CT_Blip.html +6 -13
  82. data/rdoc/RubyXL/CT_BlipFillProperties.html +6 -13
  83. data/rdoc/RubyXL/CT_BlurEffect.html +6 -13
  84. data/rdoc/RubyXL/CT_Camera.html +6 -13
  85. data/rdoc/RubyXL/CT_Color.html +6 -13
  86. data/rdoc/RubyXL/CT_ColorChangeEffect.html +6 -13
  87. data/rdoc/RubyXL/CT_ColorMapping.html +6 -13
  88. data/rdoc/RubyXL/CT_ColorScheme.html +6 -13
  89. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +6 -13
  90. data/rdoc/RubyXL/CT_ConnectionSite.html +6 -13
  91. data/rdoc/RubyXL/CT_ConnectionSiteList.html +6 -13
  92. data/rdoc/RubyXL/CT_DashStop.html +6 -13
  93. data/rdoc/RubyXL/CT_DashStopList.html +6 -13
  94. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +6 -13
  95. data/rdoc/RubyXL/CT_DuotoneEffect.html +6 -13
  96. data/rdoc/RubyXL/CT_EffectContainer.html +6 -13
  97. data/rdoc/RubyXL/CT_EffectList.html +6 -13
  98. data/rdoc/RubyXL/CT_EffectReference.html +6 -13
  99. data/rdoc/RubyXL/CT_EffectStyleItem.html +6 -13
  100. data/rdoc/RubyXL/CT_EffectStyleList.html +6 -13
  101. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +6 -13
  102. data/rdoc/RubyXL/CT_FillEffect.html +6 -13
  103. data/rdoc/RubyXL/CT_FillOverlayEffect.html +6 -13
  104. data/rdoc/RubyXL/CT_FillStyleList.html +6 -13
  105. data/rdoc/RubyXL/CT_FlatText.html +6 -13
  106. data/rdoc/RubyXL/CT_FontCollection.html +6 -13
  107. data/rdoc/RubyXL/CT_FontReference.html +6 -13
  108. data/rdoc/RubyXL/CT_GeomGuideList.html +6 -13
  109. data/rdoc/RubyXL/CT_GlowEffect.html +6 -13
  110. data/rdoc/RubyXL/CT_GradientFillProperties.html +6 -13
  111. data/rdoc/RubyXL/CT_GradientStop.html +6 -13
  112. data/rdoc/RubyXL/CT_GradientStopList.html +6 -13
  113. data/rdoc/RubyXL/CT_HSLEffect.html +6 -13
  114. data/rdoc/RubyXL/CT_HslColor.html +6 -13
  115. data/rdoc/RubyXL/CT_Hyperlink.html +6 -13
  116. data/rdoc/RubyXL/CT_InnerShadowEffect.html +6 -13
  117. data/rdoc/RubyXL/CT_LightRig.html +6 -13
  118. data/rdoc/RubyXL/CT_LineEndProperties.html +6 -13
  119. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +6 -13
  120. data/rdoc/RubyXL/CT_LineProperties.html +6 -13
  121. data/rdoc/RubyXL/CT_LineStyleList.html +6 -13
  122. data/rdoc/RubyXL/CT_LinearShadeProperties.html +6 -13
  123. data/rdoc/RubyXL/CT_LuminanceEffect.html +6 -13
  124. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +6 -13
  125. data/rdoc/RubyXL/CT_OuterShadowEffect.html +6 -13
  126. data/rdoc/RubyXL/CT_Path2D.html +6 -13
  127. data/rdoc/RubyXL/CT_Path2DArcTo.html +6 -13
  128. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +6 -13
  129. data/rdoc/RubyXL/CT_Path2DList.html +6 -13
  130. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +6 -13
  131. data/rdoc/RubyXL/CT_Path2DTo.html +6 -13
  132. data/rdoc/RubyXL/CT_PathShadeProperties.html +6 -13
  133. data/rdoc/RubyXL/CT_PatternFillProperties.html +6 -13
  134. data/rdoc/RubyXL/CT_Point3D.html +6 -13
  135. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +6 -13
  136. data/rdoc/RubyXL/CT_PresetColor.html +6 -13
  137. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +6 -13
  138. data/rdoc/RubyXL/CT_PresetShadowEffect.html +6 -13
  139. data/rdoc/RubyXL/CT_PresetTextShape.html +6 -13
  140. data/rdoc/RubyXL/CT_ReflectionEffect.html +6 -13
  141. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +6 -13
  142. data/rdoc/RubyXL/CT_RelativeRect.html +6 -13
  143. data/rdoc/RubyXL/CT_SRgbColor.html +6 -13
  144. data/rdoc/RubyXL/CT_ScRgbColor.html +6 -13
  145. data/rdoc/RubyXL/CT_Scene3D.html +6 -13
  146. data/rdoc/RubyXL/CT_SchemeColor.html +6 -13
  147. data/rdoc/RubyXL/CT_Shape3D.html +6 -13
  148. data/rdoc/RubyXL/CT_ShapeStyle.html +6 -13
  149. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +6 -13
  150. data/rdoc/RubyXL/CT_SphereCoords.html +6 -13
  151. data/rdoc/RubyXL/CT_StretchInfoProperties.html +6 -13
  152. data/rdoc/RubyXL/CT_StyleMatrix.html +6 -13
  153. data/rdoc/RubyXL/CT_StyleMatrixReference.html +6 -13
  154. data/rdoc/RubyXL/CT_SupplementalFont.html +6 -13
  155. data/rdoc/RubyXL/CT_SystemColor.html +6 -13
  156. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +6 -13
  157. data/rdoc/RubyXL/CT_TextBlipBullet.html +6 -13
  158. data/rdoc/RubyXL/CT_TextCharBullet.html +6 -13
  159. data/rdoc/RubyXL/CT_TextCharacterProperties.html +6 -13
  160. data/rdoc/RubyXL/CT_TextFont.html +6 -13
  161. data/rdoc/RubyXL/CT_TextListStyle.html +6 -13
  162. data/rdoc/RubyXL/CT_TextNormalAutofit.html +6 -13
  163. data/rdoc/RubyXL/CT_TextParagraphProperties.html +6 -13
  164. data/rdoc/RubyXL/CT_TextSpacing.html +6 -13
  165. data/rdoc/RubyXL/CT_TextTabStop.html +6 -13
  166. data/rdoc/RubyXL/CT_TextTabStopList.html +6 -13
  167. data/rdoc/RubyXL/CT_TileInfoProperties.html +6 -13
  168. data/rdoc/RubyXL/CT_TintEffect.html +6 -13
  169. data/rdoc/RubyXL/CT_Transform2D.html +6 -13
  170. data/rdoc/RubyXL/CT_TransformEffect.html +6 -13
  171. data/rdoc/RubyXL/CT_Vector3D.html +6 -13
  172. data/rdoc/RubyXL/CT_XYAdjustHandle.html +6 -13
  173. data/rdoc/RubyXL/CalculationChain.html +15 -42
  174. data/rdoc/RubyXL/CalculationChainCell.html +6 -13
  175. data/rdoc/RubyXL/CalculationProperties.html +6 -13
  176. data/rdoc/RubyXL/Cell.html +116 -290
  177. data/rdoc/RubyXL/CellConvenienceMethods.html +318 -641
  178. data/rdoc/RubyXL/CellExt.html +6 -13
  179. data/rdoc/RubyXL/CellSmartTag.html +6 -13
  180. data/rdoc/RubyXL/CellSmartTagProperty.html +6 -13
  181. data/rdoc/RubyXL/CellSmartTags.html +6 -13
  182. data/rdoc/RubyXL/CellStyle.html +6 -13
  183. data/rdoc/RubyXL/CellStyleXFs.html +16 -35
  184. data/rdoc/RubyXL/CellStyles.html +16 -35
  185. data/rdoc/RubyXL/CellValue.html +16 -35
  186. data/rdoc/RubyXL/CellWatch.html +6 -13
  187. data/rdoc/RubyXL/CellWatches.html +6 -13
  188. data/rdoc/RubyXL/CellXFs.html +18 -40
  189. data/rdoc/RubyXL/ChartColorsFile.html +6 -21
  190. data/rdoc/RubyXL/ChartFile.html +18 -48
  191. data/rdoc/RubyXL/ChartStyleFile.html +6 -21
  192. data/rdoc/RubyXL/ChartUserShapesFile.html +6 -21
  193. data/rdoc/RubyXL/Chartsheet.html +18 -65
  194. data/rdoc/RubyXL/ChartsheetPageSetup.html +6 -13
  195. data/rdoc/RubyXL/ChartsheetProperties.html +6 -13
  196. data/rdoc/RubyXL/ChartsheetProtection.html +6 -13
  197. data/rdoc/RubyXL/ChartsheetView.html +6 -13
  198. data/rdoc/RubyXL/ChartsheetViews.html +6 -13
  199. data/rdoc/RubyXL/Color.html +17 -41
  200. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +25 -69
  201. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +36 -92
  202. data/rdoc/RubyXL/ColorConvenienceClasses.html +4 -10
  203. data/rdoc/RubyXL/ColorConvenienceMethods.html +14 -32
  204. data/rdoc/RubyXL/ColorFilter.html +6 -13
  205. data/rdoc/RubyXL/ColorScale.html +6 -13
  206. data/rdoc/RubyXL/ColorSet.html +6 -13
  207. data/rdoc/RubyXL/Colors.html +6 -13
  208. data/rdoc/RubyXL/ColumnRange.html +66 -81
  209. data/rdoc/RubyXL/ColumnRanges.html +43 -95
  210. data/rdoc/RubyXL/Comment.html +6 -13
  211. data/rdoc/RubyXL/CommentList.html +6 -13
  212. data/rdoc/RubyXL/CommentsFile.html +16 -48
  213. data/rdoc/RubyXL/ConditionalFormatValue.html +6 -13
  214. data/rdoc/RubyXL/ConditionalFormatting.html +6 -13
  215. data/rdoc/RubyXL/ConditionalFormattingRule.html +6 -13
  216. data/rdoc/RubyXL/Connection.html +6 -13
  217. data/rdoc/RubyXL/ConnectionTable.html +6 -13
  218. data/rdoc/RubyXL/ConnectionTables.html +6 -13
  219. data/rdoc/RubyXL/ConnectionTextField.html +6 -13
  220. data/rdoc/RubyXL/ConnectionTextFields.html +6 -13
  221. data/rdoc/RubyXL/Connections.html +15 -42
  222. data/rdoc/RubyXL/ContentTypeDefault.html +6 -13
  223. data/rdoc/RubyXL/ContentTypeOverride.html +6 -13
  224. data/rdoc/RubyXL/ContentTypes.html +25 -63
  225. data/rdoc/RubyXL/ControlPropertiesFile.html +8 -18
  226. data/rdoc/RubyXL/CorePropertiesFile.html +72 -192
  227. data/rdoc/RubyXL/CustomColor.html +6 -13
  228. data/rdoc/RubyXL/CustomColorList.html +6 -13
  229. data/rdoc/RubyXL/CustomFilter.html +6 -13
  230. data/rdoc/RubyXL/CustomFilters.html +6 -13
  231. data/rdoc/RubyXL/CustomGeometry.html +6 -13
  232. data/rdoc/RubyXL/CustomProperties.html +6 -13
  233. data/rdoc/RubyXL/CustomPropertiesFile.html +6 -21
  234. data/rdoc/RubyXL/CustomProperty.html +6 -13
  235. data/rdoc/RubyXL/CustomPropertyFile.html +6 -21
  236. data/rdoc/RubyXL/CustomSheetView.html +6 -13
  237. data/rdoc/RubyXL/CustomSheetViews.html +6 -13
  238. data/rdoc/RubyXL/CustomWorkbookView.html +6 -13
  239. data/rdoc/RubyXL/CustomWorkbookViews.html +6 -13
  240. data/rdoc/RubyXL/CustomXMLFile.html +6 -18
  241. data/rdoc/RubyXL/DXF.html +6 -13
  242. data/rdoc/RubyXL/DXFs.html +6 -13
  243. data/rdoc/RubyXL/DataBar.html +6 -13
  244. data/rdoc/RubyXL/DataConsolidate.html +6 -13
  245. data/rdoc/RubyXL/DataConsolidationReference.html +6 -13
  246. data/rdoc/RubyXL/DataConsolidationReferences.html +6 -13
  247. data/rdoc/RubyXL/DataType.html +4 -33
  248. data/rdoc/RubyXL/DataValidation.html +6 -13
  249. data/rdoc/RubyXL/DataValidations.html +6 -13
  250. data/rdoc/RubyXL/DateGroupItem.html +6 -13
  251. data/rdoc/RubyXL/DefinedName.html +6 -13
  252. data/rdoc/RubyXL/DefinedNameExt.html +6 -13
  253. data/rdoc/RubyXL/DefinedNames.html +6 -13
  254. data/rdoc/RubyXL/DefinedNamesExt.html +6 -13
  255. data/rdoc/RubyXL/DocumentPropertiesFile.html +23 -65
  256. data/rdoc/RubyXL/DrawingFile.html +18 -48
  257. data/rdoc/RubyXL/DynamicFilter.html +6 -13
  258. data/rdoc/RubyXL/EmbeddedControl.html +6 -13
  259. data/rdoc/RubyXL/EmbeddedControls.html +6 -13
  260. data/rdoc/RubyXL/Extension.html +6 -13
  261. data/rdoc/RubyXL/ExtensionStorageArea.html +6 -13
  262. data/rdoc/RubyXL/Extents.html +6 -13
  263. data/rdoc/RubyXL/ExternalBook.html +6 -13
  264. data/rdoc/RubyXL/ExternalLinksFile.html +18 -48
  265. data/rdoc/RubyXL/ExternalReference.html +6 -13
  266. data/rdoc/RubyXL/ExternalReferences.html +6 -13
  267. data/rdoc/RubyXL/ExtraColorSchemeList.html +6 -13
  268. data/rdoc/RubyXL/FieldItem.html +6 -13
  269. data/rdoc/RubyXL/FileRecoveryProperties.html +6 -13
  270. data/rdoc/RubyXL/FileSharing.html +6 -13
  271. data/rdoc/RubyXL/FileVersion.html +6 -13
  272. data/rdoc/RubyXL/Fill.html +16 -35
  273. data/rdoc/RubyXL/Fills.html +16 -35
  274. data/rdoc/RubyXL/FilterContainer.html +6 -13
  275. data/rdoc/RubyXL/FloatNode.html +6 -13
  276. data/rdoc/RubyXL/FloatValue.html +6 -13
  277. data/rdoc/RubyXL/Font.html +18 -42
  278. data/rdoc/RubyXL/FontConvenienceMethods.html +92 -253
  279. data/rdoc/RubyXL/FontScheme.html +6 -13
  280. data/rdoc/RubyXL/Fonts.html +16 -35
  281. data/rdoc/RubyXL/Formula.html +6 -13
  282. data/rdoc/RubyXL/FunctionGroup.html +6 -13
  283. data/rdoc/RubyXL/FunctionGroups.html +6 -13
  284. data/rdoc/RubyXL/GenericStorageObject.html +32 -90
  285. data/rdoc/RubyXL/GradientFill.html +6 -13
  286. data/rdoc/RubyXL/HeaderFooterSettings.html +6 -13
  287. data/rdoc/RubyXL/Hyperlink.html +6 -13
  288. data/rdoc/RubyXL/HyperlinkRelFile.html +6 -18
  289. data/rdoc/RubyXL/Hyperlinks.html +6 -13
  290. data/rdoc/RubyXL/IconFilter.html +6 -13
  291. data/rdoc/RubyXL/IconSet.html +6 -13
  292. data/rdoc/RubyXL/IgnoredError.html +6 -13
  293. data/rdoc/RubyXL/IgnoredErrors.html +6 -13
  294. data/rdoc/RubyXL/IndexedColors.html +6 -13
  295. data/rdoc/RubyXL/InputCells.html +6 -13
  296. data/rdoc/RubyXL/IntegerNode.html +6 -13
  297. data/rdoc/RubyXL/IntegerValue.html +6 -13
  298. data/rdoc/RubyXL/LegacyCell.html +14 -32
  299. data/rdoc/RubyXL/LegacyWorksheet.html +64 -116
  300. data/rdoc/RubyXL/MRUColors.html +6 -13
  301. data/rdoc/RubyXL/MacrosFile.html +6 -21
  302. data/rdoc/RubyXL/MergedCell.html +6 -13
  303. data/rdoc/RubyXL/MergedCells.html +6 -13
  304. data/rdoc/RubyXL/NumFmt.html +6 -13
  305. data/rdoc/RubyXL/NumberFormat.html +17 -36
  306. data/rdoc/RubyXL/NumberFormats.html +16 -40
  307. data/rdoc/RubyXL/OLEObject.html +6 -13
  308. data/rdoc/RubyXL/OLEObjectFile.html +6 -21
  309. data/rdoc/RubyXL/OLEObjects.html +6 -13
  310. data/rdoc/RubyXL/OLESize.html +6 -13
  311. data/rdoc/RubyXL/OOXMLContainerObject.html +57 -140
  312. data/rdoc/RubyXL/OOXMLIgnored.html +24 -55
  313. data/rdoc/RubyXL/OOXMLObject.html +9 -19
  314. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +80 -115
  315. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +79 -185
  316. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +86 -223
  317. data/rdoc/RubyXL/OOXMLTopLevelObject.html +46 -123
  318. data/rdoc/RubyXL/OdbcOleDbProperties.html +6 -13
  319. data/rdoc/RubyXL/Offset.html +6 -13
  320. data/rdoc/RubyXL/OlapProperties.html +6 -13
  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 +6 -13
  325. data/rdoc/RubyXL/PageMargins.html +6 -13
  326. data/rdoc/RubyXL/PageSetup.html +6 -13
  327. data/rdoc/RubyXL/PageSetupProperties.html +6 -13
  328. data/rdoc/RubyXL/Pane.html +6 -13
  329. data/rdoc/RubyXL/Parser.html +24 -54
  330. data/rdoc/RubyXL/PatternFill.html +6 -13
  331. data/rdoc/RubyXL/PersonMetadata.html +108 -0
  332. data/rdoc/RubyXL/PhoneticProperties.html +6 -13
  333. data/rdoc/RubyXL/PhoneticRun.html +6 -13
  334. data/rdoc/RubyXL/PivotArea.html +6 -13
  335. data/rdoc/RubyXL/PivotCache.html +6 -13
  336. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +8 -26
  337. data/rdoc/RubyXL/PivotCacheRecordsFile.html +6 -21
  338. data/rdoc/RubyXL/PivotCaches.html +6 -13
  339. data/rdoc/RubyXL/PivotReference.html +6 -13
  340. data/rdoc/RubyXL/PivotReferences.html +6 -13
  341. data/rdoc/RubyXL/PivotTableFile.html +8 -26
  342. data/rdoc/RubyXL/PivotTableSelection.html +6 -13
  343. data/rdoc/RubyXL/PresetGeometry.html +6 -13
  344. data/rdoc/RubyXL/PrintOptions.html +6 -13
  345. data/rdoc/RubyXL/PrinterSettingsFile.html +6 -21
  346. data/rdoc/RubyXL/ProtectedRange.html +6 -13
  347. data/rdoc/RubyXL/ProtectedRanges.html +6 -13
  348. data/rdoc/RubyXL/Protection.html +6 -13
  349. data/rdoc/RubyXL/QueryParameter.html +6 -13
  350. data/rdoc/RubyXL/QueryParameters.html +6 -13
  351. data/rdoc/RubyXL/QueryTable.html +18 -48
  352. data/rdoc/RubyXL/QueryTableDeletedField.html +6 -13
  353. data/rdoc/RubyXL/QueryTableDeletedFields.html +6 -13
  354. data/rdoc/RubyXL/QueryTableField.html +6 -13
  355. data/rdoc/RubyXL/QueryTableFields.html +6 -13
  356. data/rdoc/RubyXL/QueryTableRefresh.html +6 -13
  357. data/rdoc/RubyXL/RID.html +6 -13
  358. data/rdoc/RubyXL/RawOOXML.html +24 -60
  359. data/rdoc/RubyXL/Reference.html +137 -263
  360. data/rdoc/RubyXL/Relationship.html +6 -13
  361. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +14 -32
  362. data/rdoc/RubyXL/RelationshipSupport.html +52 -137
  363. data/rdoc/RubyXL/RevisionPointer.html +6 -13
  364. data/rdoc/RubyXL/RichText.html +19 -37
  365. data/rdoc/RubyXL/RichTextRun.html +16 -35
  366. data/rdoc/RubyXL/Row.html +63 -180
  367. data/rdoc/RubyXL/RowExt.html +6 -13
  368. data/rdoc/RubyXL/RunProperties.html +6 -13
  369. data/rdoc/RubyXL/Scenario.html +6 -13
  370. data/rdoc/RubyXL/Scenarios.html +6 -13
  371. data/rdoc/RubyXL/Selection.html +16 -35
  372. data/rdoc/RubyXL/ShapeGuide.html +6 -13
  373. data/rdoc/RubyXL/ShapeTextRectangle.html +6 -13
  374. data/rdoc/RubyXL/SharedStringsTable.html +60 -156
  375. data/rdoc/RubyXL/Sheet.html +6 -13
  376. data/rdoc/RubyXL/SheetCalculationProperties.html +6 -13
  377. data/rdoc/RubyXL/SheetData.html +21 -51
  378. data/rdoc/RubyXL/SheetDataExt.html +6 -13
  379. data/rdoc/RubyXL/SheetDataSet.html +6 -13
  380. data/rdoc/RubyXL/SheetMetadata.html +108 -0
  381. data/rdoc/RubyXL/SheetName.html +6 -13
  382. data/rdoc/RubyXL/SheetNames.html +6 -13
  383. data/rdoc/RubyXL/Sheets.html +6 -13
  384. data/rdoc/RubyXL/SlicerCacheFile.html +6 -21
  385. data/rdoc/RubyXL/SlicerFile.html +6 -21
  386. data/rdoc/RubyXL/SmartTagProperties.html +6 -13
  387. data/rdoc/RubyXL/SmartTagType.html +6 -13
  388. data/rdoc/RubyXL/SmartTagTypes.html +6 -13
  389. data/rdoc/RubyXL/SmartTags.html +6 -13
  390. data/rdoc/RubyXL/SortCondition.html +6 -13
  391. data/rdoc/RubyXL/SortState.html +6 -13
  392. data/rdoc/RubyXL/Sqref.html +25 -56
  393. data/rdoc/RubyXL/Stop.html +6 -13
  394. data/rdoc/RubyXL/StringNode.html +6 -13
  395. data/rdoc/RubyXL/StringNodeW3C.html +24 -55
  396. data/rdoc/RubyXL/StringValue.html +6 -13
  397. data/rdoc/RubyXL/Stylesheet.html +45 -118
  398. data/rdoc/RubyXL/TableFile.html +6 -21
  399. data/rdoc/RubyXL/TableParts.html +6 -13
  400. data/rdoc/RubyXL/TableStyle.html +6 -13
  401. data/rdoc/RubyXL/TableStyles.html +6 -13
  402. data/rdoc/RubyXL/Text.html +25 -63
  403. data/rdoc/RubyXL/TextImportSettings.html +6 -13
  404. data/rdoc/RubyXL/Theme.html +46 -96
  405. data/rdoc/RubyXL/ThemeElements.html +6 -13
  406. data/rdoc/RubyXL/ThumbnailFile.html +6 -21
  407. data/rdoc/RubyXL/Top10.html +6 -13
  408. data/rdoc/RubyXL/VMLDrawingFile.html +9 -27
  409. data/rdoc/RubyXL/Variant.html +6 -13
  410. data/rdoc/RubyXL/Vector.html +16 -35
  411. data/rdoc/RubyXL/VectorValue.html +6 -13
  412. data/rdoc/RubyXL/VisualProperties.html +6 -13
  413. data/rdoc/RubyXL/WebPublishObject.html +6 -13
  414. data/rdoc/RubyXL/WebPublishObjects.html +6 -13
  415. data/rdoc/RubyXL/WebPublishingItem.html +6 -13
  416. data/rdoc/RubyXL/WebPublishingItems.html +6 -13
  417. data/rdoc/RubyXL/WebPublishingProperties.html +6 -13
  418. data/rdoc/RubyXL/WebQueryProperties.html +6 -13
  419. data/rdoc/RubyXL/Workbook.html +222 -583
  420. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +170 -309
  421. data/rdoc/RubyXL/WorkbookProperties.html +6 -13
  422. data/rdoc/RubyXL/WorkbookProtection.html +6 -13
  423. data/rdoc/RubyXL/WorkbookRoot.html +47 -125
  424. data/rdoc/RubyXL/WorkbookView.html +6 -13
  425. data/rdoc/RubyXL/WorkbookViews.html +6 -13
  426. data/rdoc/RubyXL/Worksheet.html +79 -160
  427. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +605 -1269
  428. data/rdoc/RubyXL/WorksheetDimensions.html +6 -13
  429. data/rdoc/RubyXL/WorksheetFormatProperties.html +6 -13
  430. data/rdoc/RubyXL/WorksheetProperties.html +6 -13
  431. data/rdoc/RubyXL/WorksheetProtection.html +6 -13
  432. data/rdoc/RubyXL/WorksheetView.html +6 -13
  433. data/rdoc/RubyXL/WorksheetViews.html +6 -13
  434. data/rdoc/RubyXL/XF.html +6 -13
  435. data/rdoc/RubyXL.html +15 -324
  436. data/rdoc/created.rid +44 -44
  437. data/rdoc/css/rdoc.css +76 -8
  438. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  439. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  440. data/rdoc/index.html +397 -769
  441. data/rdoc/js/darkfish.js +14 -1
  442. data/rdoc/js/navigation.js +8 -8
  443. data/rdoc/js/navigation.js.gz +0 -0
  444. data/rdoc/js/search.js +4 -4
  445. data/rdoc/js/search_index.js +1 -1
  446. data/rdoc/js/search_index.js.gz +0 -0
  447. data/rdoc/js/searcher.js.gz +0 -0
  448. data/rdoc/table_of_contents.html +68 -5
  449. data/rubyXL.gemspec +28 -29
  450. data/spec/lib/cell_spec.rb +67 -9
  451. data/spec/lib/color_spec.rb +8 -1
  452. data/spec/lib/parser_spec.rb +28 -28
  453. data/spec/lib/reference_spec.rb +41 -5
  454. data/spec/lib/rgb_color_spec.rb +16 -3
  455. data/spec/lib/stylesheet_spec.rb +10 -11
  456. data/spec/lib/text_spec.rb +4 -6
  457. data/spec/lib/workbook_spec.rb +20 -8
  458. data/spec/lib/worksheet_spec.rb +815 -460
  459. data/spec/spec_helper.rb +2 -0
  460. data/test/test_parse_write.rb +3 -3
  461. metadata +26 -6
  462. data/Gemfile.lock +0 -92
@@ -6,7 +6,6 @@ require 'rubyXL/objects/border'
6
6
  require 'rubyXL/objects/extensions'
7
7
 
8
8
  module RubyXL
9
-
10
9
  # http://www.datypic.com/sc/ooxml/e-ssml_numFmt-1.html
11
10
  class NumberFormat < OOXMLObject
12
11
  define_attribute(:numFmtId, :int, :required => true)
@@ -15,9 +14,8 @@ module RubyXL
15
14
 
16
15
  def is_date_format?
17
16
  # v-------- Toss all the escaped chars -------v v--- and see if any date-related remained
18
- !!(format_code.gsub(/(\"[^\"]*\"|\[[^\]]*\]|[\\_*].)/i, '') =~ /[dmyhs]/i)
17
+ !!(format_code.gsub(/("[^"]*"|\[[^\]]*\]|[\\_*].)/i, '') =~ /[dmyhs]/i)
19
18
  end
20
-
21
19
  end
22
20
 
23
21
  # http://www.datypic.com/sc/ooxml/e-ssml_numFmts-1.html
@@ -63,7 +61,6 @@ module RubyXL
63
61
  def find_by_format_id(format_id)
64
62
  self.find { |fmt| fmt.num_fmt_id == format_id }
65
63
  end
66
-
67
64
  end
68
65
 
69
66
  # http://www.datypic.com/sc/ooxml/e-ssml_cellStyleXfs-1.html
@@ -82,11 +79,8 @@ module RubyXL
82
79
  define_element_name 'cellXfs'
83
80
 
84
81
  def self.default
85
- self.new(:_ => [
86
- RubyXL::XF.new(
87
- :num_fmt_id => 0, :font_id => 0, :fill_id => 0, :border_id => 0, :xfId => 0
88
- )
89
- ])
82
+ self.new(:_ => [ RubyXL::XF.new(:num_fmt_id => 0, :font_id => 0, :fill_id => 0,
83
+ :border_id => 0, :xfId => 0) ])
90
84
  end
91
85
  end
92
86
 
@@ -161,8 +155,8 @@ module RubyXL
161
155
 
162
156
  # http://www.datypic.com/sc/ooxml/e-ssml_styleSheet.html
163
157
  class Stylesheet < OOXMLTopLevelObject
164
- CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
165
- REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles'
158
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'.freeze
159
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles'.freeze
166
160
 
167
161
  define_child_node(RubyXL::NumberFormats, :accessor => :number_formats)
168
162
  define_child_node(RubyXL::Fonts)
@@ -176,11 +170,11 @@ module RubyXL
176
170
  define_child_node(RubyXL::Colors)
177
171
  define_child_node(RubyXL::ExtensionStorageArea)
178
172
  define_element_name 'styleSheet'
179
- set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
173
+ set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
180
174
  'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r',
181
- 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
182
- 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac' => 'x14ac',
183
- 'urn:schemas-microsoft-com:mac:vml' => 'mv')
175
+ 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
176
+ 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac' => 'x14ac',
177
+ 'urn:schemas-microsoft-com:mac:vml' => 'mv')
184
178
 
185
179
  def initialize(*args)
186
180
  super
@@ -226,7 +220,5 @@ module RubyXL
226
220
 
227
221
  return max_fmt_id
228
222
  end
229
-
230
223
  end
231
-
232
224
  end
@@ -4,7 +4,6 @@ require 'rubyXL/objects/container_nodes'
4
4
  require 'rubyXL/objects/color'
5
5
 
6
6
  module RubyXL
7
-
8
7
  # http://www.datypic.com/sc/ooxml/e-ssml_t-1.html
9
8
  class Text < OOXMLObject
10
9
  define_attribute(:_, :string, :accessor => :value)
@@ -19,12 +18,12 @@ module RubyXL
19
18
 
20
19
  def before_write_xml
21
20
  preserve_whitespace
22
- self.value.gsub!(INVALID_XML10_CHARS) { |c| "_x%04x_" % c.ord }
21
+ self.value.gsub(INVALID_XML10_CHARS) { |bad_char| format('_x%04x_', bad_char.ord) }
23
22
  true
24
23
  end
25
24
 
26
25
  def to_s
27
- value.to_s.gsub(ESCAPED_UNICODE) { |m| $1.hex.chr(::Encoding::UTF_8) }
26
+ value.to_s.gsub(ESCAPED_UNICODE) { Regexp.last_match(1).hex.chr(::Encoding::UTF_8) }
28
27
  end
29
28
  end
30
29
 
@@ -57,7 +56,6 @@ module RubyXL
57
56
  def to_s
58
57
  t.to_s
59
58
  end
60
-
61
59
  end
62
60
 
63
61
  # http://www.datypic.com/sc/ooxml/e-ssml_rPh-1.html
@@ -70,7 +68,7 @@ module RubyXL
70
68
 
71
69
  # http://www.datypic.com/sc/ooxml/e-ssml_phoneticPr-1.html
72
70
  class PhoneticProperties < OOXMLObject
73
- define_attribute(:fontId, :int, :required => true)
71
+ define_attribute(:fontId, :int, :required => true)
74
72
  define_attribute(:type, RubyXL::ST_PhoneticType, :default => 'fullwidthKatakana')
75
73
  define_attribute(:alignment, RubyXL::ST_PhoneticAlignment, :default => 'left')
76
74
  define_element_name 'phoneticPr'
@@ -85,10 +83,10 @@ module RubyXL
85
83
  define_element_name 'is'
86
84
 
87
85
  def to_s
88
- str = if t.nil? then '' else t.to_s end
89
- r && r.each { |rtr| str << rtr.to_s if rtr }
86
+ # `dup` here unfreezes the string since it's not a constant but initial value
87
+ str = t.nil? ? ''.dup : t.to_s
88
+ r&.each { |rtr| str << rtr.to_s if rtr }
90
89
  str
91
90
  end
92
91
  end
93
-
94
92
  end
@@ -1,9 +1,7 @@
1
- # encoding: UTF-8 <-- magic comment, need this because of sime fancy fonts in the default scheme below. See http://stackoverflow.com/questions/6444826/ruby-utf-8-file-encoding
2
1
  require 'rubyXL/objects/ooxml_object'
3
2
  require 'rubyXL/objects/extensions'
4
3
 
5
4
  module RubyXL
6
-
7
5
  # http://www.datypic.com/sc/ooxml/e-a_ext-1.html
8
6
  class AExtension < OOXMLObject
9
7
  define_attribute(:uri, :string)
@@ -19,7 +17,6 @@ module RubyXL
19
17
  def write_xml(xml, node_name_override = nil)
20
18
  self.raw_xml
21
19
  end
22
-
23
20
  end
24
21
 
25
22
  class AExtensionStorageArea < OOXMLObject
@@ -1164,7 +1161,7 @@ module RubyXL
1164
1161
  class CT_Hyperlink < OOXMLObject
1165
1162
  define_child_node(RubyXL::CT_EmbeddedWAVAudioFile)
1166
1163
  define_child_node(RubyXL::AExtensionStorageArea)
1167
- define_attribute(:'r:id', :string)
1164
+ define_relationship
1168
1165
  define_attribute(:invalidUrl, :string, :default => '')
1169
1166
  define_attribute(:action, :string, :default => '')
1170
1167
  define_attribute(:tgtFrame, :string, :default => '')
@@ -1183,7 +1180,7 @@ module RubyXL
1183
1180
  define_child_node(RubyXL::CT_GradientFillProperties)
1184
1181
  define_child_node(RubyXL::CT_BlipFillProperties)
1185
1182
  define_child_node(RubyXL::CT_PatternFillProperties)
1186
- define_child_node(RubyXL::BooleanValue, :node_name => 'a:grpFill')
1183
+ define_child_node(RubyXL::BooleanValue, :node_name => 'a:grpFill')
1187
1184
  # -- EG_EffectProperties
1188
1185
  define_child_node(RubyXL::CT_EffectList)
1189
1186
  define_child_node(RubyXL::CT_EffectContainer, :node_name => 'a:effectDag')
@@ -1373,8 +1370,8 @@ module RubyXL
1373
1370
 
1374
1371
  # http://www.datypic.com/sc/ooxml/e-a_theme.html
1375
1372
  class Theme < OOXMLTopLevelObject
1376
- CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.theme+xml'
1377
- REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme'
1373
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.theme+xml'.freeze
1374
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme'.freeze
1378
1375
 
1379
1376
  define_attribute(:name, :string, :default => '')
1380
1377
  define_child_node(RubyXL::ThemeElements)
@@ -1392,21 +1389,21 @@ module RubyXL
1392
1389
  end
1393
1390
 
1394
1391
  def get_theme_color(idx)
1395
- color_scheme = a_theme_elements && a_theme_elements.a_clr_scheme
1396
-
1397
- if color_scheme then
1398
- case idx
1399
- when 0 then color_scheme.a_lt1
1400
- when 1 then color_scheme.a_dk1
1401
- when 2 then color_scheme.a_lt2
1402
- when 3 then color_scheme.a_dk2
1403
- when 4 then color_scheme.a_accent1
1404
- when 5 then color_scheme.a_accent2
1405
- when 6 then color_scheme.a_accent3
1406
- when 7 then color_scheme.a_accent4
1407
- when 8 then color_scheme.a_accent5
1408
- when 9 then color_scheme.a_accent6
1409
- end
1392
+ color_scheme = a_theme_elements&.a_clr_scheme
1393
+
1394
+ return unless color_scheme
1395
+
1396
+ case idx
1397
+ when 0 then color_scheme.a_lt1
1398
+ when 1 then color_scheme.a_dk1
1399
+ when 2 then color_scheme.a_lt2
1400
+ when 3 then color_scheme.a_dk2
1401
+ when 4 then color_scheme.a_accent1
1402
+ when 5 then color_scheme.a_accent2
1403
+ when 6 then color_scheme.a_accent3
1404
+ when 7 then color_scheme.a_accent4
1405
+ when 8 then color_scheme.a_accent5
1406
+ when 9 then color_scheme.a_accent6
1410
1407
  end
1411
1408
  end
1412
1409
 
@@ -1729,7 +1726,5 @@ module RubyXL
1729
1726
  </a:theme>'
1730
1727
  self.parse(default_theme)
1731
1728
  end
1732
-
1733
1729
  end
1734
-
1735
1730
  end
@@ -1,4 +1,3 @@
1
- #require 'tmpdir'
2
1
  require 'date'
3
2
  require 'rubyXL/objects/ooxml_object'
4
3
  require 'rubyXL/objects/shared_strings'
@@ -14,7 +13,6 @@ require 'rubyXL/objects/extensions'
14
13
  require 'rubyXL/objects/external_links'
15
14
 
16
15
  module RubyXL
17
-
18
16
  # Eventually, the entire code for Workbook will be moved here.
19
17
 
20
18
  # http://www.datypic.com/sc/ooxml/e-ssml_fileVersion-1.html
@@ -37,7 +35,7 @@ module RubyXL
37
35
 
38
36
  # http://www.datypic.com/sc/ooxml/e-ssml_workbookPr-1.html
39
37
  class WorkbookProperties < OOXMLObject
40
- define_attribute(:date1904, :bool, :default => false)
38
+ define_attribute(:date1904, :bool, :default => false)
41
39
  define_attribute(:showObjects, RubyXL::ST_Objects, :default => 'all')
42
40
  define_attribute(:showBorderUnselectedTables, :bool, :default => true)
43
41
  define_attribute(:filterPrivacy, :bool, :default => false)
@@ -98,7 +96,7 @@ module RubyXL
98
96
  define_attribute(:name, :string, :required => true)
99
97
  define_attribute(:sheetId, :int, :required => true)
100
98
  define_attribute(:state, RubyXL::ST_Visibility, :default => 'visible')
101
- define_attribute(:'r:id', :string, :required => true)
99
+ define_relationship(:required => true)
102
100
  define_element_name 'sheet'
103
101
  end
104
102
 
@@ -110,7 +108,7 @@ module RubyXL
110
108
 
111
109
  # http://www.datypic.com/sc/ooxml/e-ssml_externalReference-1.html
112
110
  class ExternalReference < OOXMLObject
113
- define_attribute(:'r:id', :string, :required => true)
111
+ define_relationship(:required => true)
114
112
  define_element_name 'externalReference'
115
113
  end
116
114
 
@@ -152,8 +150,8 @@ module RubyXL
152
150
 
153
151
  # http://www.datypic.com/sc/ooxml/e-ssml_pivotCache-1.html
154
152
  class PivotCache < OOXMLObject
155
- define_attribute(:cacheId, :int, :required => true)
156
- define_attribute(:'r:id', :string, :required => true)
153
+ define_attribute(:cacheId, :int, :required => true)
154
+ define_relationship(:required => true)
157
155
  define_element_name 'pivotCache'
158
156
  end
159
157
 
@@ -186,7 +184,7 @@ module RubyXL
186
184
  define_attribute(:vml, :bool, :default => false)
187
185
  define_attribute(:allowPng, :bool, :default => false)
188
186
  define_attribute(:targetScreenSize, RubyXL::ST_TargetScreenSize, :default => '800x600')
189
- define_attribute(:dpi, :int, :default => 96)
187
+ define_attribute(:dpi, :int, :default => 96)
190
188
  define_attribute(:codePage, :int)
191
189
  define_element_name 'webPublishing'
192
190
  end
@@ -195,7 +193,7 @@ module RubyXL
195
193
  class CalculationProperties < OOXMLObject
196
194
  define_attribute(:calcId, :int)
197
195
  define_attribute(:calcMode, RubyXL::ST_CalcMode, :default => 'auto')
198
- define_attribute(:fullCalcOnLoad, :bool, :default => false)
196
+ define_attribute(:fullCalcOnLoad, :bool, :default => false)
199
197
  define_attribute(:refMode, RubyXL::ST_RefMode, :default => 'A1')
200
198
  define_attribute(:iterate, :bool, :default => false)
201
199
  define_attribute(:iterateCount, :int, :default => 100)
@@ -216,7 +214,7 @@ module RubyXL
216
214
  define_attribute(:sourceObject, :string)
217
215
  define_attribute(:destinationFile, :string, :required => true)
218
216
  define_attribute(:title, :string)
219
- define_attribute(:autoRepublish, :bool, :default => false)
217
+ define_attribute(:autoRepublish, :bool, :default => false)
220
218
  define_element_name 'webPublishObject'
221
219
  end
222
220
 
@@ -228,7 +226,7 @@ module RubyXL
228
226
 
229
227
  # http://www.datypic.com/sc/ooxml/e-ssml_smartTagPr-1.html
230
228
  class SmartTagProperties < OOXMLObject
231
- define_attribute(:embed, :bool, :default => false)
229
+ define_attribute(:embed, :bool, :default => false)
232
230
  define_attribute(:show, RubyXL::ST_SmartTagShow, :default => 'all')
233
231
  define_element_name 'smartTagPr'
234
232
  end
@@ -280,7 +278,7 @@ module RubyXL
280
278
  define_attribute(:yWindow, :int, :default => 0)
281
279
  define_attribute(:windowWidth, :int)
282
280
  define_attribute(:windowHeight, :int)
283
- define_attribute(:tabRatio, :int, :default => 600)
281
+ define_attribute(:tabRatio, :int, :default => 600)
284
282
  define_attribute(:activeSheetId, :int)
285
283
  define_attribute(:showFormulaBar, :bool, :default => true)
286
284
  define_attribute(:showStatusbar, :bool, :default => true)
@@ -298,15 +296,17 @@ module RubyXL
298
296
 
299
297
  # http://www.datypic.com/sc/ooxml/e-ssml_workbook.html
300
298
  class Workbook < OOXMLTopLevelObject
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'
304
- CONTENT_TYPE_WITH_MACROS = 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'
305
- REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'
299
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'.freeze
300
+ CONTENT_TYPE_TEMPLATE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml'.freeze
301
+ CONTENT_TYPE_TEMPLATE_WITH_MACROS = 'application/vnd.ms-excel.template.macroEnabled.main+xml'.freeze
302
+ CONTENT_TYPE_WITH_MACROS = 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'.freeze
303
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'.freeze
306
304
 
307
305
  # http://www.accountingweb.com/technology/excel/seven-characters-you-cant-use-in-worksheet-names
308
- SHEET_NAME_FORBIDDEN_CHARS = /[\/\\\*\[\]\:\?]/
309
- #SHEET_NAME_FORBIDDEN_NAMES = [ 'History' ]
306
+ SHEET_NAME_FORBIDDEN_CHARS = %r{[/\\*\[\]:?]}
307
+
308
+ # https://answers.microsoft.com/en-us/msoffice/forum/all/excel-history-is-a-reserved-name-help/f8a398a4-b72c-48e3-82da-4f132c305e91
309
+ SHEET_NAME_FORBIDDEN_NAMES = [ 'History' ]
310
310
 
311
311
  include RubyXL::RelationshipSupport
312
312
 
@@ -332,8 +332,9 @@ module RubyXL
332
332
  define_relationship(RubyXL::PivotCacheDefinitionFile)
333
333
  define_relationship(RubyXL::PivotCacheRecordsFile)
334
334
  define_relationship(RubyXL::CustomXMLFile)
335
- define_relationship(RubyXL::MacrosFile, :macros)
335
+ define_relationship(RubyXL::MacrosFile, :macros)
336
336
  define_relationship(RubyXL::SlicerCacheFile)
337
+ define_relationship(RubyXL::PersonMetadata)
337
338
 
338
339
  define_child_node(RubyXL::FileVersion)
339
340
  define_child_node(RubyXL::FileSharing)
@@ -358,13 +359,12 @@ module RubyXL
358
359
  define_child_node(RubyXL::ExtensionStorageArea)
359
360
 
360
361
  define_element_name 'workbook'
361
- set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
362
+ set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
362
363
  'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r',
363
- 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
364
- 'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main' => 'x15')
364
+ 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
365
+ 'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main' => 'x15')
365
366
 
366
- attr_accessor :worksheets
367
- attr_accessor :is_template
367
+ attr_accessor :worksheets, :is_template
368
368
 
369
369
  def before_write_xml
370
370
  max_sheet_id = worksheets.collect(&:sheet_id).compact.max || 0
@@ -375,6 +375,7 @@ module RubyXL
375
375
  rel = relationship_container.find_by_target(sheet.xlsx_path)
376
376
 
377
377
  raise "Worksheet name '#{sheet.sheet_name}' contains forbidden characters" if sheet.sheet_name =~ SHEET_NAME_FORBIDDEN_CHARS
378
+ raise "Worksheet name '#{sheet.sheet_name}' is forbidden" if SHEET_NAME_FORBIDDEN_NAMES.include?(sheet.sheet_name)
378
379
 
379
380
  sheets << RubyXL::Sheet.new(:name => sheet.sheet_name[0..30], # Max sheet name length is 31 char
380
381
  :sheet_id => sheet.sheet_id || (max_sheet_id += 1),
@@ -403,33 +404,39 @@ module RubyXL
403
404
  raise "Unsupported extension: #{extension} (only .xlsx, .xlsm, .xltx and .xltm files are supported)."
404
405
  end
405
406
 
406
- File.open(dst_file_path, "wb") { |output_file| FileUtils.copy_stream(root.stream, output_file) }
407
+ File.open(dst_file_path, 'wb') { |output_file| FileUtils.copy_stream(root.stream, output_file) }
407
408
 
408
409
  return dst_file_path
409
410
  end
410
411
  alias_method :write, :save
411
412
 
412
413
  DATE1904 = DateTime.new(1904, 1, 1)
413
- # Subtracting one day to accomodate for erroneous 1900 leap year compatibility only for 1900 based dates
414
+ # Subtracting one day to accommodate for erroneous 1900 leap year compatibility only for 1900 based dates
414
415
  DATE1899 = DateTime.new(1899, 12, 31) - 1
415
416
  MARCH_1_1900 = 61
416
417
 
417
418
  def base_date
418
- (workbook_properties && workbook_properties.date1904) ? DATE1904 : DATE1899
419
+ workbook_properties&.date1904 ? DATE1904 : DATE1899
419
420
  end
420
421
  private :base_date
421
422
 
422
423
  def date_to_num(date)
423
- date && (date.ajd - base_date().ajd).to_f
424
+ case date
425
+ when Date, DateTime then (date.ajd - base_date.ajd).to_f
426
+ when Time then ((date.to_r - base_date.to_time.to_r) / 86400).to_f
427
+ end
424
428
  end
425
429
 
426
430
  def num_to_date(num)
431
+ return nil if num.nil?
432
+
427
433
  # Bug-for-bug Excel compatibility (https://support.microsoft.com/kb/214058/)
428
- if num && num < MARCH_1_1900 then
429
- num += 1 unless workbook_properties && workbook_properties.date1904
434
+ if num < MARCH_1_1900 then
435
+ num += 1 unless workbook_properties&.date1904
430
436
  end
431
437
 
432
- num && (base_date + num)
438
+ dateparts = num.divmod(1)
439
+ base_date + (dateparts[0] + ((dateparts[1] * 86400).round(6) / 86400))
433
440
  end
434
441
 
435
442
  include Enumerable
@@ -511,7 +518,7 @@ module RubyXL
511
518
  end
512
519
 
513
520
  def company
514
- root.document_properties.company && root.document_properties.company.value
521
+ root.document_properties.company&.value
515
522
  end
516
523
 
517
524
  def company=(v)
@@ -520,7 +527,7 @@ module RubyXL
520
527
  end
521
528
 
522
529
  def application
523
- root.document_properties.application && root.document_properties.application.value
530
+ root.document_properties.application&.value
524
531
  end
525
532
 
526
533
  def application=(v)
@@ -529,7 +536,7 @@ module RubyXL
529
536
  end
530
537
 
531
538
  def appversion
532
- root.document_properties.app_version && root.document_properties.app_version.value
539
+ root.document_properties.app_version&.value
533
540
  end
534
541
 
535
542
  def appversion=(v)
@@ -554,14 +561,12 @@ module RubyXL
554
561
  end
555
562
 
556
563
  def date1904
557
- workbook_properties && workbook_properties.date1904
564
+ workbook_properties&.date1904
558
565
  end
559
566
 
560
567
  def date1904=(v)
561
568
  self.workbook_properties ||= RubyXL::WorkbookProperties.new
562
569
  workbook_properties.date1904 = v
563
570
  end
564
-
565
571
  end
566
-
567
572
  end
@@ -15,7 +15,6 @@ require 'rubyXL/objects/query_table'
15
15
  require 'rubyXL/worksheet'
16
16
 
17
17
  module RubyXL
18
-
19
18
  # Eventually, the entire code for Worksheet will be moved here. One small step at a time!
20
19
 
21
20
  # http://www.datypic.com/sc/ooxml/e-ssml_outlinePr-1.html
@@ -58,7 +57,7 @@ module RubyXL
58
57
  end
59
58
 
60
59
  class WorksheetFormatProperties < OOXMLObject
61
- define_attribute(:baseColWidth, :int, :default => 8)
60
+ define_attribute(:baseColWidth, :int, :default => 8)
62
61
  define_attribute(:defaultColWidth, :double)
63
62
  define_attribute(:defaultRowHeight, :double, :required => true)
64
63
  define_attribute(:customHeight, :bool, :default => false)
@@ -83,12 +82,12 @@ module RubyXL
83
82
  define_attribute(:blackAndWhite, :bool, :default => false)
84
83
  define_attribute(:draft, :bool, :default => false)
85
84
  define_attribute(:cellComments, RubyXL::ST_CellComments, :default => 'none')
86
- define_attribute(:useFirstPageNumber, :bool, :default => false)
85
+ define_attribute(:useFirstPageNumber, :bool, :default => false)
87
86
  define_attribute(:errors, RubyXL::ST_PrintError, :default => 'displayed')
88
87
  define_attribute(:horizontalDpi, :int, :default => 600)
89
88
  define_attribute(:verticalDpi, :int, :default => 600)
90
89
  define_attribute(:copies, :int, :default => 1)
91
- define_attribute(:'r:id', :string)
90
+ define_relationship
92
91
  define_element_name 'pageSetup'
93
92
  end
94
93
 
@@ -166,7 +165,7 @@ module RubyXL
166
165
  class ConditionalFormatValue < OOXMLObject
167
166
  define_attribute(:type, RubyXL::ST_CfvoType, :required => true)
168
167
  define_attribute(:val, :string)
169
- define_attribute(:gte, :bool, :default => true)
168
+ define_attribute(:gte, :bool, :default => true)
170
169
  define_child_node(RubyXL::ExtensionStorageArea)
171
170
  define_element_name 'cfvo'
172
171
  end
@@ -174,7 +173,7 @@ module RubyXL
174
173
  # http://www.datypic.com/sc/ooxml/e-ssml_colorScale-1.html
175
174
  class ColorScale < OOXMLObject
176
175
  define_child_node(RubyXL::ConditionalFormatValue, :collection => true, :accessor => :cfvo)
177
- define_child_node(RubyXL::Color)
176
+ define_child_node(RubyXL::Color, :collection => true)
178
177
  define_element_name 'colorScale'
179
178
  end
180
179
 
@@ -184,7 +183,7 @@ module RubyXL
184
183
  define_attribute(:maxLength, :int, :default => 90)
185
184
  define_attribute(:showValue, :bool, :default => true)
186
185
  define_child_node(RubyXL::ConditionalFormatValue, :collection => true, :accessor => :cfvo)
187
- define_child_node(RubyXL::Color)
186
+ define_child_node(RubyXL::Color, :collection => true)
188
187
  define_element_name 'dataBar'
189
188
  end
190
189
 
@@ -212,7 +211,7 @@ module RubyXL
212
211
  define_attribute(:timePeriod, RubyXL::ST_TimePeriod)
213
212
  define_attribute(:rank, :int)
214
213
  define_attribute(:stdDev, :int)
215
- define_attribute(:equalAverage, :bool, :default => false)
214
+ define_attribute(:equalAverage, :bool, :default => false)
216
215
  define_child_node(RubyXL::Formula, :collection => true, :node_name => :formula, :accessor => :formulas)
217
216
  define_child_node(RubyXL::ColorScale)
218
217
  define_child_node(RubyXL::DataBar)
@@ -301,8 +300,8 @@ module RubyXL
301
300
 
302
301
  # http://www.datypic.com/sc/ooxml/e-ssml_hyperlink-1.html
303
302
  class Hyperlink < OOXMLObject
304
- define_attribute(:ref, :ref, :required => true)
305
- define_attribute(:'r:id', :string)
303
+ define_attribute(:ref, :ref, :required => true)
304
+ define_relationship
306
305
  define_attribute(:location, :string)
307
306
  define_attribute(:tooltip, :string)
308
307
  define_attribute(:display, :string)
@@ -323,7 +322,7 @@ module RubyXL
323
322
  define_attribute(:oleUpdate, RubyXL::ST_OleUpdate)
324
323
  define_attribute(:autoLoad, :bool, :default => false)
325
324
  define_attribute(:shapeId, :int, :required => true)
326
- define_attribute(:'r:id', :string)
325
+ define_relationship
327
326
  define_element_name 'oleObject'
328
327
  end
329
328
 
@@ -339,7 +338,7 @@ module RubyXL
339
338
  define_attribute(:ref, :ref)
340
339
  define_attribute(:name, :string)
341
340
  define_attribute(:sheet, :string)
342
- define_attribute(:'r:id', :string)
341
+ define_relationship
343
342
  define_element_name 'dataRef'
344
343
  end
345
344
 
@@ -408,9 +407,9 @@ module RubyXL
408
407
  define_attribute(:hiddenRows, :bool, :default => false)
409
408
  define_attribute(:hiddenColumns, :bool, :default => false)
410
409
  define_attribute(:state, RubyXL::ST_Visibility, :default => 'visible')
411
- define_attribute(:filterUnique, :bool, :default => false)
410
+ define_attribute(:filterUnique, :bool, :default => false)
412
411
  define_attribute(:view, RubyXL::ST_SheetViewType, :default => 'normal')
413
- define_attribute(:showRuler, :bool, :default => true)
412
+ define_attribute(:showRuler, :bool, :default => true)
414
413
  define_attribute(:topLeftCell, :ref)
415
414
  define_child_node(RubyXL::Pane)
416
415
  define_child_node(RubyXL::Selection)
@@ -433,9 +432,9 @@ module RubyXL
433
432
 
434
433
  # http://www.datypic.com/sc/ooxml/e-ssml_control-1.html
435
434
  class EmbeddedControl < OOXMLObject
436
- define_attribute(:shapeId, :int, :required => true)
437
- define_attribute(:'r:id', :string, :required => true)
438
- define_attribute(:name, :string)
435
+ define_attribute(:shapeId, :int, :required => true)
436
+ define_relationship(:required => true)
437
+ define_attribute(:name, :string)
439
438
  define_element_name 'control'
440
439
  end
441
440
 
@@ -489,8 +488,8 @@ module RubyXL
489
488
 
490
489
  # http://www.datypic.com/sc/ooxml/e-ssml_customPr-1.html
491
490
  class CustomProperty < OOXMLObject
492
- define_attribute(:name, :string, :required => true)
493
- define_attribute(:'r:id', :string, :required => true)
491
+ define_attribute(:name, :string, :required => true)
492
+ define_relationship(:required => true)
494
493
  define_element_name 'customPr'
495
494
  end
496
495
 
@@ -546,7 +545,7 @@ module RubyXL
546
545
  define_attribute(:cacheIndex, :bool, :default => false)
547
546
  define_attribute(:outline, :bool, :default => true)
548
547
  define_attribute(:offset, :ref)
549
- define_attribute(:collapsedLevelsAreSubtotals, :bool, :default => false)
548
+ define_attribute(:collapsedLevelsAreSubtotals, :bool, :default => false)
550
549
  define_attribute(:axis, RubyXL::ST_Axis)
551
550
  define_attribute(:fieldPosition, :int, :default => 0)
552
551
  define_child_node(RubyXL::PivotReferences)
@@ -572,7 +571,7 @@ module RubyXL
572
571
  define_attribute(:previousRow, :uint, :default => 0)
573
572
  define_attribute(:previousCol, :uint, :default => 0)
574
573
  define_attribute(:click, :uint, :default => 0)
575
- define_attribute(:'r:id', :string)
574
+ define_relationship
576
575
  define_child_node(RubyXL::PivotArea)
577
576
  define_element_name 'pivotSelection'
578
577
  end
@@ -597,10 +596,10 @@ module RubyXL
597
596
  define_attribute(:zoomScaleNormal, :uint, :default => 0)
598
597
  define_attribute(:zoomScaleSheetLayoutView, :uint, :default => 0)
599
598
  define_attribute(:zoomScalePageLayoutView, :uint, :default => 0)
600
- define_attribute(:workbookViewId, :uint, :required => true, :default => 0 )
599
+ define_attribute(:workbookViewId, :uint, :required => true, :default => 0)
601
600
  define_child_node(RubyXL::Pane)
602
601
  define_child_node(RubyXL::Selection, :collection => true, :accessor => :selections)
603
- define_child_node(RubyXL::PivotTableSelection, :collection => true, :accessor => :pivot_table_selections )
602
+ define_child_node(RubyXL::PivotTableSelection, :collection => true, :accessor => :pivot_table_selections)
604
603
  define_child_node(RubyXL::ExtensionStorageArea)
605
604
  define_element_name 'sheetView'
606
605
  end
@@ -614,8 +613,8 @@ module RubyXL
614
613
 
615
614
  # http://www.datypic.com/sc/ooxml/e-ssml_worksheet.html
616
615
  class Worksheet < OOXMLTopLevelObject
617
- CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
618
- REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet'
616
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'.freeze
617
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet'.freeze
619
618
 
620
619
  include RubyXL::RelationshipSupport
621
620
 
@@ -651,7 +650,7 @@ module RubyXL
651
650
  define_child_node(RubyXL::SortState)
652
651
  define_child_node(RubyXL::DataConsolidate)
653
652
  define_child_node(RubyXL::CustomSheetViews)
654
- define_child_node(RubyXL::MergedCells, :accessor => :merged_cells)
653
+ define_child_node(RubyXL::MergedCells, :accessor => :merged_cells)
655
654
  define_child_node(RubyXL::PhoneticProperties)
656
655
  define_child_node(RubyXL::ConditionalFormatting, :collection => [0..-1])
657
656
  define_child_node(RubyXL::DataValidations)
@@ -677,11 +676,11 @@ module RubyXL
677
676
  define_child_node(RubyXL::ExtensionStorageArea)
678
677
  define_child_node(RubyXL::AlternateContent)
679
678
  define_element_name 'worksheet'
680
- set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
679
+ set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
681
680
  'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r',
682
- 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
683
- 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac' => 'x14ac',
684
- 'urn:schemas-microsoft-com:mac:vml' => 'mv')
681
+ 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
682
+ 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac' => 'x14ac',
683
+ 'urn:schemas-microsoft-com:mac:vml' => 'mv')
685
684
 
686
685
  attr_accessor :workbook, :state, :sheet_name, :sheet_id, :rels
687
686
 
@@ -752,7 +751,12 @@ module RubyXL
752
751
  workbook.stylesheet.cell_xfs[get_row_style(row)]
753
752
  end
754
753
 
754
+ def cell_at(ref)
755
+ reference = RubyXL::Reference.new(ref)
756
+ raise "Invalid reference: #{ref}" unless reference.valid? && reference.single_cell?
757
+ sheet_data&.rows&.[](reference.first_row)&.cells&.[](reference.first_col)
758
+ end
759
+
755
760
  include LegacyWorksheet
756
761
  end
757
-
758
762
  end