rubyXL 3.4.38 → 3.4.39

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 (418) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -1
  3. data/README.rdoc +3 -4
  4. data/Rakefile +18 -13
  5. data/VERSION +1 -1
  6. data/lib/rubyXL/cell.rb +2 -2
  7. data/lib/rubyXL/convenience_methods/cell.rb +13 -6
  8. data/lib/rubyXL/convenience_methods/worksheet.rb +41 -30
  9. data/lib/rubyXL/objects/border.rb +9 -6
  10. data/lib/rubyXL/objects/cell_style.rb +2 -0
  11. data/lib/rubyXL/objects/color.rb +3 -1
  12. data/lib/rubyXL/objects/container_nodes.rb +2 -0
  13. data/lib/rubyXL/objects/fill.rb +2 -0
  14. data/lib/rubyXL/objects/font.rb +2 -0
  15. data/lib/rubyXL/objects/ooxml_object.rb +16 -16
  16. data/lib/rubyXL/objects/reference.rb +38 -33
  17. data/lib/rubyXL/objects/root.rb +8 -1
  18. data/lib/rubyXL/objects/sheet_data.rb +7 -2
  19. data/lib/rubyXL/objects/simple_types.rb +101 -98
  20. data/lib/rubyXL/objects/workbook.rb +5 -5
  21. data/lib/rubyXL/objects/worksheet.rb +23 -4
  22. data/lib/rubyXL/worksheet.rb +5 -17
  23. data/rdoc/README_rdoc.html +8 -8
  24. data/rdoc/RubyXL/AExtension.html +5 -5
  25. data/rdoc/RubyXL/AExtensionStorageArea.html +5 -5
  26. data/rdoc/RubyXL/ActiveX.html +5 -5
  27. data/rdoc/RubyXL/ActiveXBinary.html +5 -5
  28. data/rdoc/RubyXL/AdjustHandleList.html +5 -5
  29. data/rdoc/RubyXL/Alignment.html +5 -5
  30. data/rdoc/RubyXL/AlternateContent.html +5 -5
  31. data/rdoc/RubyXL/AlternateUrls.html +5 -5
  32. data/rdoc/RubyXL/Authors.html +5 -5
  33. data/rdoc/RubyXL/AutoFilter.html +5 -5
  34. data/rdoc/RubyXL/AutoFilterColumn.html +5 -5
  35. data/rdoc/RubyXL/BinaryImageFile.html +5 -5
  36. data/rdoc/RubyXL/BodyProperties.html +5 -5
  37. data/rdoc/RubyXL/BooleanNode.html +5 -5
  38. data/rdoc/RubyXL/BooleanValue.html +5 -5
  39. data/rdoc/RubyXL/Border.html +14 -13
  40. data/rdoc/RubyXL/BorderEdge.html +10 -10
  41. data/rdoc/RubyXL/Borders.html +6 -6
  42. data/rdoc/RubyXL/Break.html +5 -5
  43. data/rdoc/RubyXL/BreakList.html +5 -5
  44. data/rdoc/RubyXL/CT_AdjPoint2D.html +5 -5
  45. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +5 -5
  46. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +5 -5
  47. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +5 -5
  48. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +5 -5
  49. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +5 -5
  50. data/rdoc/RubyXL/CT_Backdrop.html +5 -5
  51. data/rdoc/RubyXL/CT_Bevel.html +5 -5
  52. data/rdoc/RubyXL/CT_BiLevelEffect.html +5 -5
  53. data/rdoc/RubyXL/CT_BlendEffect.html +5 -5
  54. data/rdoc/RubyXL/CT_Blip.html +5 -5
  55. data/rdoc/RubyXL/CT_BlipFillProperties.html +5 -5
  56. data/rdoc/RubyXL/CT_BlurEffect.html +5 -5
  57. data/rdoc/RubyXL/CT_Camera.html +5 -5
  58. data/rdoc/RubyXL/CT_Color.html +5 -5
  59. data/rdoc/RubyXL/CT_ColorChangeEffect.html +5 -5
  60. data/rdoc/RubyXL/CT_ColorMapping.html +5 -5
  61. data/rdoc/RubyXL/CT_ColorScheme.html +5 -5
  62. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +5 -5
  63. data/rdoc/RubyXL/CT_ConnectionSite.html +5 -5
  64. data/rdoc/RubyXL/CT_ConnectionSiteList.html +5 -5
  65. data/rdoc/RubyXL/CT_DashStop.html +5 -5
  66. data/rdoc/RubyXL/CT_DashStopList.html +5 -5
  67. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +5 -5
  68. data/rdoc/RubyXL/CT_DuotoneEffect.html +5 -5
  69. data/rdoc/RubyXL/CT_EffectContainer.html +5 -5
  70. data/rdoc/RubyXL/CT_EffectList.html +5 -5
  71. data/rdoc/RubyXL/CT_EffectReference.html +5 -5
  72. data/rdoc/RubyXL/CT_EffectStyleItem.html +5 -5
  73. data/rdoc/RubyXL/CT_EffectStyleList.html +5 -5
  74. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +5 -5
  75. data/rdoc/RubyXL/CT_FillEffect.html +5 -5
  76. data/rdoc/RubyXL/CT_FillOverlayEffect.html +5 -5
  77. data/rdoc/RubyXL/CT_FillStyleList.html +5 -5
  78. data/rdoc/RubyXL/CT_FlatText.html +5 -5
  79. data/rdoc/RubyXL/CT_FontCollection.html +5 -5
  80. data/rdoc/RubyXL/CT_FontReference.html +5 -5
  81. data/rdoc/RubyXL/CT_GeomGuideList.html +5 -5
  82. data/rdoc/RubyXL/CT_GlowEffect.html +5 -5
  83. data/rdoc/RubyXL/CT_GradientFillProperties.html +5 -5
  84. data/rdoc/RubyXL/CT_GradientStop.html +5 -5
  85. data/rdoc/RubyXL/CT_GradientStopList.html +5 -5
  86. data/rdoc/RubyXL/CT_HSLEffect.html +5 -5
  87. data/rdoc/RubyXL/CT_HslColor.html +5 -5
  88. data/rdoc/RubyXL/CT_Hyperlink.html +5 -5
  89. data/rdoc/RubyXL/CT_InnerShadowEffect.html +5 -5
  90. data/rdoc/RubyXL/CT_LightRig.html +5 -5
  91. data/rdoc/RubyXL/CT_LineEndProperties.html +5 -5
  92. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +5 -5
  93. data/rdoc/RubyXL/CT_LineProperties.html +5 -5
  94. data/rdoc/RubyXL/CT_LineStyleList.html +5 -5
  95. data/rdoc/RubyXL/CT_LinearShadeProperties.html +5 -5
  96. data/rdoc/RubyXL/CT_LuminanceEffect.html +5 -5
  97. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +5 -5
  98. data/rdoc/RubyXL/CT_OuterShadowEffect.html +5 -5
  99. data/rdoc/RubyXL/CT_Path2D.html +5 -5
  100. data/rdoc/RubyXL/CT_Path2DArcTo.html +5 -5
  101. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +5 -5
  102. data/rdoc/RubyXL/CT_Path2DList.html +5 -5
  103. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +5 -5
  104. data/rdoc/RubyXL/CT_Path2DTo.html +5 -5
  105. data/rdoc/RubyXL/CT_PathShadeProperties.html +5 -5
  106. data/rdoc/RubyXL/CT_PatternFillProperties.html +5 -5
  107. data/rdoc/RubyXL/CT_Point3D.html +5 -5
  108. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +5 -5
  109. data/rdoc/RubyXL/CT_PresetColor.html +5 -5
  110. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +5 -5
  111. data/rdoc/RubyXL/CT_PresetShadowEffect.html +5 -5
  112. data/rdoc/RubyXL/CT_PresetTextShape.html +5 -5
  113. data/rdoc/RubyXL/CT_ReflectionEffect.html +5 -5
  114. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +5 -5
  115. data/rdoc/RubyXL/CT_RelativeRect.html +5 -5
  116. data/rdoc/RubyXL/CT_SRgbColor.html +5 -5
  117. data/rdoc/RubyXL/CT_ScRgbColor.html +5 -5
  118. data/rdoc/RubyXL/CT_Scene3D.html +5 -5
  119. data/rdoc/RubyXL/CT_SchemeColor.html +5 -5
  120. data/rdoc/RubyXL/CT_Shape3D.html +5 -5
  121. data/rdoc/RubyXL/CT_ShapeStyle.html +5 -5
  122. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +5 -5
  123. data/rdoc/RubyXL/CT_SphereCoords.html +5 -5
  124. data/rdoc/RubyXL/CT_StretchInfoProperties.html +5 -5
  125. data/rdoc/RubyXL/CT_StyleMatrix.html +5 -5
  126. data/rdoc/RubyXL/CT_StyleMatrixReference.html +5 -5
  127. data/rdoc/RubyXL/CT_SupplementalFont.html +5 -5
  128. data/rdoc/RubyXL/CT_SystemColor.html +5 -5
  129. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +5 -5
  130. data/rdoc/RubyXL/CT_TextBlipBullet.html +5 -5
  131. data/rdoc/RubyXL/CT_TextCharBullet.html +5 -5
  132. data/rdoc/RubyXL/CT_TextCharacterProperties.html +5 -5
  133. data/rdoc/RubyXL/CT_TextFont.html +5 -5
  134. data/rdoc/RubyXL/CT_TextListStyle.html +5 -5
  135. data/rdoc/RubyXL/CT_TextNormalAutofit.html +5 -5
  136. data/rdoc/RubyXL/CT_TextParagraphProperties.html +5 -5
  137. data/rdoc/RubyXL/CT_TextSpacing.html +5 -5
  138. data/rdoc/RubyXL/CT_TextTabStop.html +5 -5
  139. data/rdoc/RubyXL/CT_TextTabStopList.html +5 -5
  140. data/rdoc/RubyXL/CT_TileInfoProperties.html +5 -5
  141. data/rdoc/RubyXL/CT_TintEffect.html +5 -5
  142. data/rdoc/RubyXL/CT_Transform2D.html +5 -5
  143. data/rdoc/RubyXL/CT_TransformEffect.html +5 -5
  144. data/rdoc/RubyXL/CT_Vector3D.html +5 -5
  145. data/rdoc/RubyXL/CT_XYAdjustHandle.html +5 -5
  146. data/rdoc/RubyXL/CalculationChain.html +5 -5
  147. data/rdoc/RubyXL/CalculationChainCell.html +5 -5
  148. data/rdoc/RubyXL/CalculationProperties.html +5 -5
  149. data/rdoc/RubyXL/Cell.html +6 -6
  150. data/rdoc/RubyXL/CellConvenienceMethods.html +69 -48
  151. data/rdoc/RubyXL/CellExt.html +5 -5
  152. data/rdoc/RubyXL/CellSmartTag.html +5 -5
  153. data/rdoc/RubyXL/CellSmartTagProperty.html +5 -5
  154. data/rdoc/RubyXL/CellSmartTags.html +5 -5
  155. data/rdoc/RubyXL/CellStyle.html +5 -5
  156. data/rdoc/RubyXL/CellStyleXFs.html +5 -5
  157. data/rdoc/RubyXL/CellStyles.html +5 -5
  158. data/rdoc/RubyXL/CellValue.html +5 -5
  159. data/rdoc/RubyXL/CellWatch.html +5 -5
  160. data/rdoc/RubyXL/CellWatches.html +5 -5
  161. data/rdoc/RubyXL/CellXFs.html +5 -5
  162. data/rdoc/RubyXL/ChartColorsFile.html +5 -5
  163. data/rdoc/RubyXL/ChartFile.html +5 -5
  164. data/rdoc/RubyXL/ChartStyleFile.html +5 -5
  165. data/rdoc/RubyXL/ChartUserShapesFile.html +5 -5
  166. data/rdoc/RubyXL/Chartsheet.html +5 -5
  167. data/rdoc/RubyXL/ChartsheetPageSetup.html +5 -5
  168. data/rdoc/RubyXL/ChartsheetProperties.html +5 -5
  169. data/rdoc/RubyXL/ChartsheetProtection.html +5 -5
  170. data/rdoc/RubyXL/ChartsheetView.html +5 -5
  171. data/rdoc/RubyXL/ChartsheetViews.html +5 -5
  172. data/rdoc/RubyXL/Color.html +7 -7
  173. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +5 -5
  174. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +5 -5
  175. data/rdoc/RubyXL/ColorConvenienceClasses.html +5 -5
  176. data/rdoc/RubyXL/ColorConvenienceMethods.html +5 -5
  177. data/rdoc/RubyXL/ColorFilter.html +5 -5
  178. data/rdoc/RubyXL/ColorScale.html +5 -5
  179. data/rdoc/RubyXL/ColorSet.html +5 -5
  180. data/rdoc/RubyXL/Colors.html +5 -5
  181. data/rdoc/RubyXL/ColumnRange.html +5 -5
  182. data/rdoc/RubyXL/ColumnRanges.html +5 -5
  183. data/rdoc/RubyXL/Comment.html +5 -5
  184. data/rdoc/RubyXL/CommentList.html +5 -5
  185. data/rdoc/RubyXL/CommentsFile.html +5 -5
  186. data/rdoc/RubyXL/ConditionalFormatValue.html +5 -5
  187. data/rdoc/RubyXL/ConditionalFormatting.html +5 -5
  188. data/rdoc/RubyXL/ConditionalFormattingRule.html +5 -5
  189. data/rdoc/RubyXL/Connection.html +5 -5
  190. data/rdoc/RubyXL/ConnectionTable.html +5 -5
  191. data/rdoc/RubyXL/ConnectionTables.html +5 -5
  192. data/rdoc/RubyXL/ConnectionTextField.html +5 -5
  193. data/rdoc/RubyXL/ConnectionTextFields.html +5 -5
  194. data/rdoc/RubyXL/Connections.html +5 -5
  195. data/rdoc/RubyXL/ContentTypeDefault.html +5 -5
  196. data/rdoc/RubyXL/ContentTypeOverride.html +5 -5
  197. data/rdoc/RubyXL/ContentTypes.html +5 -5
  198. data/rdoc/RubyXL/ControlPropertiesFile.html +5 -5
  199. data/rdoc/RubyXL/CorePropertiesFile.html +5 -5
  200. data/rdoc/RubyXL/CustomColor.html +5 -5
  201. data/rdoc/RubyXL/CustomColorList.html +5 -5
  202. data/rdoc/RubyXL/CustomFilter.html +5 -5
  203. data/rdoc/RubyXL/CustomFilters.html +5 -5
  204. data/rdoc/RubyXL/CustomGeometry.html +5 -5
  205. data/rdoc/RubyXL/CustomProperties.html +5 -5
  206. data/rdoc/RubyXL/CustomPropertiesFile.html +5 -5
  207. data/rdoc/RubyXL/CustomProperty.html +5 -5
  208. data/rdoc/RubyXL/CustomPropertyFile.html +5 -5
  209. data/rdoc/RubyXL/CustomSheetView.html +5 -5
  210. data/rdoc/RubyXL/CustomSheetViews.html +5 -5
  211. data/rdoc/RubyXL/CustomWorkbookView.html +5 -5
  212. data/rdoc/RubyXL/CustomWorkbookViews.html +5 -5
  213. data/rdoc/RubyXL/CustomXMLFile.html +5 -5
  214. data/rdoc/RubyXL/DXF.html +5 -5
  215. data/rdoc/RubyXL/DXFs.html +5 -5
  216. data/rdoc/RubyXL/DataBar.html +5 -5
  217. data/rdoc/RubyXL/DataConsolidate.html +5 -5
  218. data/rdoc/RubyXL/DataConsolidationReference.html +5 -5
  219. data/rdoc/RubyXL/DataConsolidationReferences.html +5 -5
  220. data/rdoc/RubyXL/DataType.html +5 -5
  221. data/rdoc/RubyXL/DataValidation.html +5 -5
  222. data/rdoc/RubyXL/DataValidations.html +5 -5
  223. data/rdoc/RubyXL/DateGroupItem.html +5 -5
  224. data/rdoc/RubyXL/DefinedName.html +5 -5
  225. data/rdoc/RubyXL/DefinedNameExt.html +5 -5
  226. data/rdoc/RubyXL/DefinedNames.html +5 -5
  227. data/rdoc/RubyXL/DefinedNamesExt.html +5 -5
  228. data/rdoc/RubyXL/DocumentPropertiesFile.html +5 -5
  229. data/rdoc/RubyXL/DrawingFile.html +5 -5
  230. data/rdoc/RubyXL/DynamicFilter.html +5 -5
  231. data/rdoc/RubyXL/EmbeddedControl.html +5 -5
  232. data/rdoc/RubyXL/EmbeddedControls.html +5 -5
  233. data/rdoc/RubyXL/Extension.html +5 -5
  234. data/rdoc/RubyXL/ExtensionStorageArea.html +5 -5
  235. data/rdoc/RubyXL/Extents.html +5 -5
  236. data/rdoc/RubyXL/ExternalBook.html +5 -5
  237. data/rdoc/RubyXL/ExternalLinksFile.html +5 -5
  238. data/rdoc/RubyXL/ExternalReference.html +5 -5
  239. data/rdoc/RubyXL/ExternalReferences.html +5 -5
  240. data/rdoc/RubyXL/ExtraColorSchemeList.html +5 -5
  241. data/rdoc/RubyXL/FieldItem.html +5 -5
  242. data/rdoc/RubyXL/FileRecoveryProperties.html +5 -5
  243. data/rdoc/RubyXL/FileSharing.html +5 -5
  244. data/rdoc/RubyXL/FileVersion.html +5 -5
  245. data/rdoc/RubyXL/Fill.html +6 -6
  246. data/rdoc/RubyXL/Fills.html +6 -6
  247. data/rdoc/RubyXL/FilterContainer.html +5 -5
  248. data/rdoc/RubyXL/FloatNode.html +5 -5
  249. data/rdoc/RubyXL/FloatValue.html +5 -5
  250. data/rdoc/RubyXL/Font.html +6 -6
  251. data/rdoc/RubyXL/FontConvenienceMethods.html +5 -5
  252. data/rdoc/RubyXL/FontScheme.html +5 -5
  253. data/rdoc/RubyXL/Fonts.html +6 -6
  254. data/rdoc/RubyXL/Formula.html +5 -5
  255. data/rdoc/RubyXL/FunctionGroup.html +5 -5
  256. data/rdoc/RubyXL/FunctionGroups.html +5 -5
  257. data/rdoc/RubyXL/GenericStorageObject.html +5 -5
  258. data/rdoc/RubyXL/GradientFill.html +5 -5
  259. data/rdoc/RubyXL/HeaderFooterSettings.html +5 -5
  260. data/rdoc/RubyXL/Hyperlink.html +5 -5
  261. data/rdoc/RubyXL/HyperlinkRelFile.html +5 -5
  262. data/rdoc/RubyXL/Hyperlinks.html +5 -5
  263. data/rdoc/RubyXL/IconFilter.html +5 -5
  264. data/rdoc/RubyXL/IconSet.html +5 -5
  265. data/rdoc/RubyXL/IgnoredError.html +5 -5
  266. data/rdoc/RubyXL/IgnoredErrors.html +5 -5
  267. data/rdoc/RubyXL/IndexedColors.html +5 -5
  268. data/rdoc/RubyXL/InputCells.html +5 -5
  269. data/rdoc/RubyXL/IntegerNode.html +5 -5
  270. data/rdoc/RubyXL/IntegerValue.html +5 -5
  271. data/rdoc/RubyXL/LegacyCell.html +5 -5
  272. data/rdoc/RubyXL/LegacyWorksheet.html +6 -140
  273. data/rdoc/RubyXL/MRUColors.html +5 -5
  274. data/rdoc/RubyXL/MacrosFile.html +5 -5
  275. data/rdoc/RubyXL/MergedCell.html +5 -5
  276. data/rdoc/RubyXL/MergedCells.html +5 -5
  277. data/rdoc/RubyXL/NumFmt.html +5 -5
  278. data/rdoc/RubyXL/NumberFormat.html +5 -5
  279. data/rdoc/RubyXL/NumberFormats.html +5 -5
  280. data/rdoc/RubyXL/OLEObject.html +5 -5
  281. data/rdoc/RubyXL/OLEObjectFile.html +5 -5
  282. data/rdoc/RubyXL/OLEObjects.html +5 -5
  283. data/rdoc/RubyXL/OLESize.html +5 -5
  284. data/rdoc/RubyXL/OOXMLContainerObject.html +13 -20
  285. data/rdoc/RubyXL/OOXMLIgnored.html +5 -5
  286. data/rdoc/RubyXL/OOXMLObject.html +5 -5
  287. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +17 -13
  288. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +16 -17
  289. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +5 -5
  290. data/rdoc/RubyXL/OOXMLTopLevelObject.html +6 -6
  291. data/rdoc/RubyXL/OdbcOleDbProperties.html +5 -5
  292. data/rdoc/RubyXL/Offset.html +5 -5
  293. data/rdoc/RubyXL/OlapProperties.html +5 -5
  294. data/rdoc/RubyXL/OleItem.html +5 -5
  295. data/rdoc/RubyXL/OleItems.html +5 -5
  296. data/rdoc/RubyXL/OleLink.html +5 -5
  297. data/rdoc/RubyXL/OutlineProperties.html +5 -5
  298. data/rdoc/RubyXL/PageMargins.html +5 -5
  299. data/rdoc/RubyXL/PageSetup.html +5 -5
  300. data/rdoc/RubyXL/PageSetupProperties.html +5 -5
  301. data/rdoc/RubyXL/Pane.html +5 -5
  302. data/rdoc/RubyXL/Parser.html +5 -5
  303. data/rdoc/RubyXL/PatternFill.html +5 -5
  304. data/rdoc/RubyXL/PersonMetadata.html +5 -5
  305. data/rdoc/RubyXL/PhoneticProperties.html +5 -5
  306. data/rdoc/RubyXL/PhoneticRun.html +5 -5
  307. data/rdoc/RubyXL/PivotArea.html +5 -5
  308. data/rdoc/RubyXL/PivotCache.html +5 -5
  309. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +5 -5
  310. data/rdoc/RubyXL/PivotCacheRecordsFile.html +5 -5
  311. data/rdoc/RubyXL/PivotCaches.html +5 -5
  312. data/rdoc/RubyXL/PivotReference.html +5 -5
  313. data/rdoc/RubyXL/PivotReferences.html +5 -5
  314. data/rdoc/RubyXL/{PivotTableSelection.html → PivotSelection.html} +12 -12
  315. data/rdoc/RubyXL/PivotTableFile.html +5 -5
  316. data/rdoc/RubyXL/PresetGeometry.html +5 -5
  317. data/rdoc/RubyXL/PrintOptions.html +5 -5
  318. data/rdoc/RubyXL/PrinterSettingsFile.html +5 -5
  319. data/rdoc/RubyXL/ProtectedRange.html +5 -5
  320. data/rdoc/RubyXL/ProtectedRanges.html +5 -5
  321. data/rdoc/RubyXL/Protection.html +5 -5
  322. data/rdoc/RubyXL/QueryParameter.html +5 -5
  323. data/rdoc/RubyXL/QueryParameters.html +5 -5
  324. data/rdoc/RubyXL/QueryTable.html +5 -5
  325. data/rdoc/RubyXL/QueryTableDeletedField.html +5 -5
  326. data/rdoc/RubyXL/QueryTableDeletedFields.html +5 -5
  327. data/rdoc/RubyXL/QueryTableField.html +5 -5
  328. data/rdoc/RubyXL/QueryTableFields.html +5 -5
  329. data/rdoc/RubyXL/QueryTableRefresh.html +5 -5
  330. data/rdoc/RubyXL/RID.html +5 -5
  331. data/rdoc/RubyXL/RawOOXML.html +5 -5
  332. data/rdoc/RubyXL/Reference.html +110 -154
  333. data/rdoc/RubyXL/Relationship.html +5 -5
  334. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +5 -5
  335. data/rdoc/RubyXL/RelationshipSupport.html +5 -5
  336. data/rdoc/RubyXL/RevisionPointer.html +5 -5
  337. data/rdoc/RubyXL/RichText.html +5 -5
  338. data/rdoc/RubyXL/RichTextRun.html +5 -5
  339. data/rdoc/RubyXL/Row.html +14 -14
  340. data/rdoc/RubyXL/RowExt.html +5 -5
  341. data/rdoc/RubyXL/RunProperties.html +5 -5
  342. data/rdoc/RubyXL/Scenario.html +5 -5
  343. data/rdoc/RubyXL/Scenarios.html +5 -5
  344. data/rdoc/RubyXL/Selection.html +6 -6
  345. data/rdoc/RubyXL/ShapeGuide.html +5 -5
  346. data/rdoc/RubyXL/ShapeTextRectangle.html +5 -5
  347. data/rdoc/RubyXL/SharedStringsTable.html +5 -5
  348. data/rdoc/RubyXL/Sheet.html +5 -5
  349. data/rdoc/RubyXL/SheetCalculationProperties.html +5 -5
  350. data/rdoc/RubyXL/SheetData.html +7 -7
  351. data/rdoc/RubyXL/SheetDataExt.html +5 -5
  352. data/rdoc/RubyXL/SheetDataSet.html +5 -5
  353. data/rdoc/RubyXL/SheetMetadata.html +5 -5
  354. data/rdoc/RubyXL/SheetName.html +5 -5
  355. data/rdoc/RubyXL/SheetNames.html +5 -5
  356. data/rdoc/RubyXL/Sheets.html +5 -5
  357. data/rdoc/RubyXL/SlicerCacheFile.html +5 -5
  358. data/rdoc/RubyXL/SlicerFile.html +5 -5
  359. data/rdoc/RubyXL/SmartTagProperties.html +5 -5
  360. data/rdoc/RubyXL/SmartTagType.html +5 -5
  361. data/rdoc/RubyXL/SmartTagTypes.html +5 -5
  362. data/rdoc/RubyXL/SmartTags.html +5 -5
  363. data/rdoc/RubyXL/SortCondition.html +5 -5
  364. data/rdoc/RubyXL/SortState.html +5 -5
  365. data/rdoc/RubyXL/Sqref.html +7 -7
  366. data/rdoc/RubyXL/Stop.html +5 -5
  367. data/rdoc/RubyXL/StringNode.html +5 -5
  368. data/rdoc/RubyXL/StringNodeW3C.html +7 -7
  369. data/rdoc/RubyXL/StringValue.html +5 -5
  370. data/rdoc/RubyXL/Stylesheet.html +5 -5
  371. data/rdoc/RubyXL/TableFile.html +5 -5
  372. data/rdoc/RubyXL/TableParts.html +5 -5
  373. data/rdoc/RubyXL/TableStyle.html +5 -5
  374. data/rdoc/RubyXL/TableStyles.html +5 -5
  375. data/rdoc/RubyXL/Text.html +5 -5
  376. data/rdoc/RubyXL/TextImportSettings.html +5 -5
  377. data/rdoc/RubyXL/Theme.html +5 -5
  378. data/rdoc/RubyXL/ThemeElements.html +5 -5
  379. data/rdoc/RubyXL/ThumbnailFile.html +5 -5
  380. data/rdoc/RubyXL/Top10.html +5 -5
  381. data/rdoc/RubyXL/VMLDrawingFile.html +5 -5
  382. data/rdoc/RubyXL/Variant.html +5 -5
  383. data/rdoc/RubyXL/Vector.html +6 -6
  384. data/rdoc/RubyXL/VectorValue.html +5 -5
  385. data/rdoc/RubyXL/VisualProperties.html +5 -5
  386. data/rdoc/RubyXL/WebPublishObject.html +5 -5
  387. data/rdoc/RubyXL/WebPublishObjects.html +5 -5
  388. data/rdoc/RubyXL/WebPublishingItem.html +5 -5
  389. data/rdoc/RubyXL/WebPublishingItems.html +5 -5
  390. data/rdoc/RubyXL/WebPublishingProperties.html +5 -5
  391. data/rdoc/RubyXL/WebQueryProperties.html +5 -5
  392. data/rdoc/RubyXL/Workbook.html +8 -8
  393. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +5 -5
  394. data/rdoc/RubyXL/WorkbookProperties.html +5 -5
  395. data/rdoc/RubyXL/WorkbookProtection.html +5 -5
  396. data/rdoc/RubyXL/WorkbookRoot.html +15 -8
  397. data/rdoc/RubyXL/WorkbookView.html +5 -5
  398. data/rdoc/RubyXL/WorkbookViews.html +5 -5
  399. data/rdoc/RubyXL/Worksheet.html +147 -13
  400. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +111 -100
  401. data/rdoc/RubyXL/WorksheetDimensions.html +6 -6
  402. data/rdoc/RubyXL/WorksheetFormatProperties.html +5 -5
  403. data/rdoc/RubyXL/WorksheetProperties.html +5 -5
  404. data/rdoc/RubyXL/WorksheetProtection.html +5 -5
  405. data/rdoc/RubyXL/WorksheetView.html +5 -5
  406. data/rdoc/RubyXL/WorksheetViews.html +5 -5
  407. data/rdoc/RubyXL/XF.html +5 -5
  408. data/rdoc/RubyXL.html +13 -5
  409. data/rdoc/created.rid +20 -20
  410. data/rdoc/index.html +10 -10
  411. data/rdoc/js/search_data.js +1 -1
  412. data/rubyXL.gemspec +7 -4
  413. data/spec/lib/cell_spec.rb +45 -5
  414. data/spec/lib/color_spec.rb +2 -2
  415. data/spec/lib/reference_spec.rb +25 -0
  416. data/spec/lib/workbook_root_spec.rb +43 -0
  417. data/spec/lib/worksheet_spec.rb +65 -57
  418. metadata +32 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 653d773015a0aca3439878d0e16a4e91517cf07cf3c3a0ff62d72c56ebd307b6
4
- data.tar.gz: 7c58595e70a5be7e8ae8f9ecb5ced1eea4721a78f62653bd494b82ef5957d19f
3
+ metadata.gz: 9d5586b1840082a24c9f55befaada16985ca69b63792f7ceb6b65729ff234e85
4
+ data.tar.gz: 24d767bc267d067a0766867844d53894f34bd5ce2e81482650d04a0a2e7fb067
5
5
  SHA512:
6
- metadata.gz: 216a635924307eb9180227ecda2b3817786985b40987826a74f031e7b99a4dba045d9fb97e6e5fedb5ffb87544c75852d82300f2a652627ecae7ad5f224f0802
7
- data.tar.gz: f7ec19093979640748284eda348c6bf49de9543003ef63e6454fc8e04c4fdcf06ef8a52ce45c09d8dbb60f7b00435884351412f98e83de7c1538829842756fc7
6
+ metadata.gz: 2a3211c5ed20bb2488057e40d05b5a6e7b0e871cec6864e98942e7ad9e69c348af7044215b0ab54f87fe1c3afdba24e1e126ff794cff845c0597fb00c6f2fefb
7
+ data.tar.gz: 73b787fc9271e14eb7eda7a65df9022fc0b2aefb0e7b0f29e8f17cf6374c08ae771ee0287fee7a21bcabe21fbfecc32b42820639146bafa2ff34b3f95a6428f0
data/Gemfile CHANGED
@@ -8,11 +8,14 @@ gem 'rubyzip', '>= 3.2.2', require: 'zip'
8
8
  group :development, :test do
9
9
  gem 'bundler'
10
10
  gem 'rake'
11
+
11
12
  gem 'juwelier'
13
+ gem 'git', '~> 4.1' # last compatible with juwelier
14
+
12
15
  gem 'rspec'
13
16
  gem 'simplecov'
14
17
 
15
- # gem 'stackprof'
18
+ gem 'stackprof'
16
19
  gem 'ruby-prof'
17
20
  gem 'rspec_junit_formatter'
18
21
 
data/README.rdoc CHANGED
@@ -138,17 +138,16 @@ Please note: these methods are being phased out in favor of the OOXML object mod
138
138
  cell = worksheet.add_cell(1, 1, 'B2')
139
139
  cell.change_border(:top, 'thin') # Sets the cell to have a top, thin border
140
140
  # Note that with diagonals, you have to specify which one of the diagonals (or both) you need.
141
- cell.change_border( :diagonal, 'thick', [ :diagonal_down ]) # Sets A1 to have a thin diagonal going from top left to bottom right
141
+ cell.change_border(:diagonal, 'thick', [ :diagonal_down ]) # Sets A1 to have a thick diagonal going from top left to bottom right
142
142
  # You can turn on both diagonals, but then they both will share the same style and color:
143
- cell.change_border( :diagonal, 'thick', [ :diagonal_down, :diagonal_up ])
143
+ cell.change_border(:diagonal, 'thick', [ :diagonal_down, :diagonal_up ])
144
144
 
145
145
  ===== Border Colors
146
146
  # Make sure you set the border style first so there's something to color.
147
147
  cell.change_border_color(:top, '0ba53d') # Sets top border color to green
148
- cell.change_border_color(:diagonal, 'dd0000') # Sets diaginal border color to red
148
+ cell.change_border_color(:diagonal, 'dd0000') # Sets diagonal border color to red
149
149
 
150
150
  ===== Changing whole row or column
151
-
152
151
  worksheet.change_row_border(0, :left, 'hairline') # Sets first row to have a left, hairline border
153
152
  worksheet.change_column_border(0, :diagonal, 'medium') # Sets first column to have diagonal, medium border
154
153
  worksheet.change_row_border_color(0, :top, '0ba53d') # Sets first row to have a green top border
data/Rakefile CHANGED
@@ -9,6 +9,11 @@ rescue Bundler::BundlerError => e
9
9
  exit e.status_code
10
10
  end
11
11
 
12
+ require 'psych'
13
+ if defined?(Psych::ClassLoader) && defined?(Psych::ClassLoader::ALLOWED_CLASSES)
14
+ Psych::ClassLoader::ALLOWED_CLASSES << 'Gem::Specification'
15
+ end
16
+
12
17
  require 'juwelier'
13
18
  Juwelier::Tasks.new do |gem|
14
19
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
@@ -46,14 +51,16 @@ Rake::RDocTask.new do |rdoc|
46
51
  rdoc.rdoc_files.include('lib/**/*.rb')
47
52
  end
48
53
 
54
+ task :preload_library do
55
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib' # Make Ruby aware of load path
56
+ require './lib/rubyXL'
57
+ end
58
+
49
59
  desc 'Dump profiling data with stackprof'
50
- task :stackprof do
60
+ task :stackprof => :preload_library do
51
61
  require 'benchmark'
52
62
  require 'stackprof'
53
63
 
54
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib' # Make Ruby aware of load path
55
- require './lib/rubyXL'
56
-
57
64
  spreadsheets = Dir.glob(File.join('test', 'input', '*.xls?')).sort!
58
65
 
59
66
  spreadsheets.each { |input|
@@ -74,30 +81,28 @@ task :stackprof do
74
81
  end
75
82
 
76
83
  desc 'Dump profiling data with ruby-prof'
77
- task :rubyprof do
78
- require 'benchmark'
84
+ task :rubyprof => :preload_library do
79
85
  require 'ruby-prof'
80
86
 
81
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib' # Make Ruby aware of load path
82
- require './lib/rubyXL'
83
-
84
87
  spreadsheets = Dir.glob(File.join('test', 'input', '*.xls?')).sort!
85
88
 
86
89
  spreadsheets.each { |input|
87
90
  puts "<<<--- Profiling parsing of #{input}..."
88
91
  doc = nil
89
- result = RubyProf.profile {
92
+ result = RubyProf::Profile.profile {
90
93
  doc = RubyXL::Parser.parse(input)
91
94
  }
92
95
  printer = RubyProf::CallStackPrinter.new(result)
93
- File.open("tmp/ruby-prof-parse-#{File.basename(input)}.html", 'w') { |f| printer.print(f, {}) }
96
+ File.open("tmp/ruby-prof-parse-#{File.basename(input)}.html", 'w') { |f| printer.print(f) }
94
97
 
95
98
  output = File.join('test', 'output', File.basename(input))
96
99
  puts "--->>> Profiling writing of #{output}..."
97
- result = RubyProf.profile {
100
+ result = RubyProf::Profile.profile {
98
101
  doc.write(output)
99
102
  }
100
103
  printer = RubyProf::CallStackPrinter.new(result)
101
- File.open("tmp/ruby-prof-write-#{File.basename(input)}.html", 'w') { |f| printer.print(f, {}) }
104
+ File.open("tmp/ruby-prof-write-#{File.basename(input)}.html", 'w') { |f| printer.print(f) }
102
105
  }
103
106
  end
107
+
108
+ Rake::Task["console"].enhance([:preload_library])
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.38
1
+ 3.4.39
data/lib/rubyXL/cell.rb CHANGED
@@ -16,12 +16,12 @@ module RubyXL
16
16
  end
17
17
  }
18
18
  end
19
- raise "This cell #{self} is not in workbook #{workbook}"
19
+ raise RuntimeError, "Cell #{self} is not in workbook #{workbook}"
20
20
  end
21
21
 
22
22
  def validate_worksheet
23
23
  return if @worksheet && @worksheet[row] && @worksheet[row][column].equal?(self)
24
- raise "Cell #{self} is not in worksheet #{worksheet}"
24
+ raise RuntimeError, "Cell #{self} is not in worksheet #{worksheet}"
25
25
  end
26
26
  end
27
27
  end
@@ -1,5 +1,8 @@
1
1
  module RubyXL
2
2
  module CellConvenienceMethods
3
+ # Excel has a hard limit of 65'530 hyperlinks per Worksheet
4
+ MAX_HYPERLINKS_PER_WORKSHEET = 65530
5
+
3
6
  def change_contents(data, formula_expression = nil)
4
7
  validate_worksheet
5
8
 
@@ -21,10 +24,10 @@ module RubyXL
21
24
  def remove_formula
22
25
  self.formula = nil
23
26
 
24
- calculation_chain = workbook && workbook.calculation_chain
25
- calculation_cells = calculation_chain && calculation_chain.cells
26
- calculation_cells && calculation_cells.reject! { |c|
27
- c.ref.col_range.c == self.column && c.ref.row_range.begin == self.row
27
+ calculation_chain = workbook&.calculation_chain
28
+ calculation_cells = calculation_chain&.cells
29
+ calculation_cells&.reject! { |c|
30
+ (c.ref.first_col == self.column) && (c.ref.first_row == self.row)
28
31
  }
29
32
  end
30
33
 
@@ -180,7 +183,7 @@ module RubyXL
180
183
  # Changes font size of cell
181
184
  def change_font_size(font_size = 10)
182
185
  validate_worksheet
183
- raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
186
+ raise(ArgumentError, 'Argument must be a number') unless font_size.is_a?(Integer) || font_size.is_a?(Float)
184
187
 
185
188
  font = get_cell_font.dup
186
189
  font.set_size(font_size)
@@ -249,11 +252,15 @@ module RubyXL
249
252
  when Worksheet::BOLD then change_font_bold(arg)
250
253
  when Worksheet::UNDERLINE then change_font_underline(arg)
251
254
  when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)
252
- else raise 'Invalid change_type'
255
+ else raise ArgumentError, "Invalid change_type: #{change_type}"
253
256
  end
254
257
  end
255
258
 
256
259
  def add_hyperlink(url, tooltip = nil)
260
+ if worksheet.hyperlinks.size >= MAX_HYPERLINKS_PER_WORKSHEET
261
+ raise RuntimeError, "Maximum number of hyperlinks per worksheet reached"
262
+ end
263
+
257
264
  worksheet.relationship_container ||= RubyXL::OOXMLRelationshipsFile.new
258
265
  relationships = worksheet.relationship_container.relationships
259
266
  r_id = "rId#{relationships.size + 1}"
@@ -28,7 +28,7 @@ module RubyXL
28
28
  end
29
29
  }
30
30
  else
31
- raise 'invalid shift option'
31
+ raise ArgumentError, "Invalid shift option: #{shift}"
32
32
  end
33
33
 
34
34
  return add_cell(row, col, data, formula)
@@ -62,7 +62,7 @@ module RubyXL
62
62
  end
63
63
  }
64
64
  else
65
- raise 'invalid shift option'
65
+ raise ArgumentError, "Invalid shift option: #{shift}"
66
66
  end
67
67
 
68
68
  return old_cell
@@ -108,14 +108,14 @@ module RubyXL
108
108
  # Update merged cells for all rows below
109
109
  if self.merged_cells then
110
110
  merged_cells.each { |mc|
111
- next if mc.ref.row_range.last < row_index
111
+ next if mc.ref.last_row < row_index
112
112
 
113
- in_merged_cell = mc.ref.row_range.first < row_index
113
+ in_merged_cell = mc.ref.first_row < row_index
114
114
  mc.ref = RubyXL::Reference.new(
115
- mc.ref.row_range.first + (in_merged_cell ? 0 : 1),
116
- mc.ref.row_range.last + 1,
117
- mc.ref.col_range.first,
118
- mc.ref.col_range.last,
115
+ mc.ref.first_row + (in_merged_cell ? 0 : 1),
116
+ mc.ref.last_row + 1,
117
+ mc.ref.first_col,
118
+ mc.ref.last_col,
119
119
  )
120
120
  }
121
121
  end
@@ -137,18 +137,24 @@ module RubyXL
137
137
 
138
138
  # Update row number of merged cells
139
139
  if self.merged_cells then
140
- merged_cells.delete_if { |mc| mc.ref.row_range == (row_index..row_index) }
140
+ merged_cells.delete_if { |mc|
141
+ reference = mc.ref
142
+ (reference.first_row == row_index) && (reference.last_row == row_index)
143
+ }
144
+
141
145
  merged_cells.each { |mc|
142
- next if mc.ref.row_range.last < row_index
146
+ reference = mc.ref
147
+ next if reference.last_row < row_index
143
148
 
144
- in_merged_cell = mc.ref.row_range.first <= row_index
149
+ in_merged_cell = reference.first_row <= row_index
145
150
  mc.ref = RubyXL::Reference.new(
146
- mc.ref.row_range.first - (in_merged_cell ? 0 : 1),
147
- mc.ref.row_range.last - 1,
148
- mc.ref.col_range.first,
149
- mc.ref.col_range.last,
151
+ reference.first_row - (in_merged_cell ? 0 : 1),
152
+ reference.last_row - 1,
153
+ reference.first_col,
154
+ reference.last_col,
150
155
  )
151
156
  }
157
+
152
158
  merged_cells.delete_if { |mc| mc.ref.single_cell? }
153
159
  end
154
160
 
@@ -186,14 +192,14 @@ module RubyXL
186
192
  # Update merged cells for all rows below
187
193
  if self.merged_cells then
188
194
  merged_cells.each { |mc|
189
- next if mc.ref.col_range.last < column_index
195
+ next if mc.ref.last_col < column_index
190
196
 
191
- in_merged_cell = mc.ref.row_range.first < column_index
197
+ in_merged_cell = mc.ref.first_col < column_index
192
198
  mc.ref = RubyXL::Reference.new(
193
- mc.ref.row_range.first,
194
- mc.ref.row_range.last,
195
- mc.ref.col_range.first + (in_merged_cell ? 0 : 1),
196
- mc.ref.col_range.last + 1,
199
+ mc.ref.first_row,
200
+ mc.ref.last_row,
201
+ mc.ref.first_col + (in_merged_cell ? 0 : 1),
202
+ mc.ref.last_col + 1,
197
203
  )
198
204
  }
199
205
  end
@@ -221,16 +227,21 @@ module RubyXL
221
227
  # Update row number of merged cells
222
228
  return unless self.merged_cells
223
229
 
224
- merged_cells.delete_if { |mc| mc.ref.col_range == (column_index..column_index) }
230
+ merged_cells.delete_if { |mc|
231
+ reference = mc.ref
232
+ (reference.first_col == column_index) && (reference.last_col == column_index)
233
+ }
234
+
225
235
  merged_cells.each { |mc|
226
- next if mc.ref.col_range.last < column_index
236
+ reference = mc.ref
237
+ next if reference.last_col < column_index
227
238
 
228
- in_merged_cell = mc.ref.col_range.first <= column_index
239
+ in_merged_cell = reference.first_col <= column_index
229
240
  mc.ref = RubyXL::Reference.new(
230
- mc.ref.row_range.first,
231
- mc.ref.row_range.last,
232
- mc.ref.col_range.first - (in_merged_cell ? 0 : 1),
233
- mc.ref.col_range.last - 1,
241
+ reference.first_row,
242
+ reference.last_row,
243
+ reference.first_col - (in_merged_cell ? 0 : 1),
244
+ reference.last_col - 1,
234
245
  )
235
246
  }
236
247
 
@@ -704,11 +715,11 @@ module RubyXL
704
715
  row_from, row_to, col_from, col_to = params.first.fetch_values(:row_from, :row_to, :col_from, :col_to)
705
716
  when String then
706
717
  from, to = params[0].split(':')
707
- raise ArgumentError.new("reference for merging cells must be a range") if to.nil?
718
+ raise(ArgumentError, "Reference for merging cells must be a range") if to.nil?
708
719
  row_from, col_from = RubyXL::Reference.ref2ind(from)
709
720
  row_to, col_to = RubyXL::Reference.ref2ind(to)
710
721
  else
711
- raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
722
+ raise(ArgumentError, "Invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
712
723
  end
713
724
  end
714
725
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/simple_types'
3
5
 
@@ -6,8 +8,8 @@ module RubyXL
6
8
  define_attribute(:style, RubyXL::ST_BorderStyle, :default => 'none')
7
9
  define_child_node(RubyXL::Color)
8
10
 
9
- def set_rgb_color(font_color)
10
- self.color = RubyXL::Color.new(:rgb => font_color.to_s)
11
+ def set_rgb_color(edge_color)
12
+ self.color = RubyXL::Color.new(:rgb => edge_color.to_s)
11
13
  end
12
14
 
13
15
  def get_rgb_color
@@ -43,8 +45,8 @@ module RubyXL
43
45
  end
44
46
 
45
47
  if diagonals then
46
- self.diagonal_up = true if diagonals.index(:diagonal_up)
47
- self.diagonal_down = true if diagonals.index(:diagonal_down)
48
+ self.diagonal_up = true if diagonals.include?(:diagonal_up)
49
+ self.diagonal_down = true if diagonals.include?(:diagonal_down)
48
50
  end
49
51
  end
50
52
 
@@ -58,8 +60,9 @@ module RubyXL
58
60
  if edge
59
61
  edge.set_rgb_color(color)
60
62
  else
61
- self.send("#{direction}=", RubyXL::BorderEdge.new)
62
- self.send(direction).set_rgb_color(color)
63
+ edge = RubyXL::BorderEdge.new
64
+ edge.set_rgb_color(color)
65
+ self.send("#{direction}=", edge)
63
66
  end
64
67
  end
65
68
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/simple_types'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/simple_types'
3
5
 
@@ -18,7 +20,7 @@ module RubyXL
18
20
  if color =~ COLOR_REGEXP
19
21
  return true
20
22
  else
21
- raise 'invalid color'
23
+ raise ArgumentError, "Invalid color value: #{color}"
22
24
  end
23
25
  end
24
26
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/simple_types'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/simple_types'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubyXL/objects/ooxml_object'
2
4
  require 'rubyXL/objects/container_nodes'
3
5
  require 'rubyXL/objects/color'
@@ -34,7 +34,7 @@ module RubyXL
34
34
  # * +:bool+ - <tt>Boolean</tt> ("1" and "true" convert to +true+, others to +false+)
35
35
  # * one of +simple_types+ - <tt>String</tt>, plus the list of acceptable values is saved for future validation (not used yet).
36
36
  # * +extra_parameters+ - Hash of optional parameters as follows:
37
- # * +:accessor+ - Name of the accessor for this attribute to be defined on the object. If not provided, defaults to classidied +attribute_name+.
37
+ # * +:accessor+ - Name of the accessor for this attribute to be defined on the object. If not provided, defaults to snakecased +attribute_name+.
38
38
  # * +:default+ - Value this attribute defaults to if not explicitly provided.
39
39
  # * +:required+ - Whether this attribute is required when writing XML. If the value of the attrinute is not explicitly provided, +:default+ is written instead.
40
40
  # * +:computed+ - Do not store this attribute on +parse+, but do call the object-provided read accessor on +write_xml+.
@@ -52,6 +52,8 @@ module RubyXL
52
52
  attr_hash = { :attr_type => attr_type }
53
53
  attr_hash.merge!(extra_params) if extra_params
54
54
  attr_hash[:accessor] ||= accessorize(attr_name)
55
+ attr_hash[:instance_var] ||= "@#{attr_hash[:accessor]}".to_sym
56
+ attr_hash[:setter] ||= "#{attr_hash[:accessor]}=".to_sym
55
57
  attrs[attr_name.to_s] = attr_hash
56
58
  self.send(:attr_accessor, attr_hash[:accessor]) unless attr_hash[:computed]
57
59
  end
@@ -89,7 +91,9 @@ module RubyXL
89
91
  child_nodes[child_node_name] = {
90
92
  :class => klass,
91
93
  :is_array => extra_params[:collection],
92
- :accessor => accessor
94
+ :accessor => accessor,
95
+ :setter => "#{accessor}=".to_sym,
96
+ :instance_var => "@#{accessor}".to_sym
93
97
  }
94
98
 
95
99
  define_count_attribute if extra_params[:collection] == :with_count
@@ -164,7 +168,7 @@ module RubyXL
164
168
  end
165
169
 
166
170
  child_node_params = known_child_nodes[child_node_name]
167
- raise "Unknown child node [#{child_node_name}] for element [#{node.name}]" if child_node_params.nil?
171
+ raise(RuntimeError, "Unknown child node [#{child_node_name}] for element [#{node.name}]") if child_node_params.nil?
168
172
  parsed_object = child_node_params[:class].parse(child_node, known_namespaces)
169
173
  if child_node_params[:is_array] then
170
174
  index = parsed_object.index_in_collection
@@ -179,7 +183,7 @@ module RubyXL
179
183
  collection[index] = parsed_object
180
184
  end
181
185
  else
182
- obj.send("#{child_node_params[:accessor]}=", parsed_object)
186
+ obj.send(child_node_params[:setter], parsed_object)
183
187
  end
184
188
  }
185
189
  end
@@ -208,10 +212,10 @@ module RubyXL
208
212
  when :int then Integer(raw_value)
209
213
  when :uint then
210
214
  v = Integer(raw_value)
211
- raise ArgumentError.new("invalid value for unsigned Integer(): \"#{raw_value}\"") if v < 0
215
+ raise(ArgumentError, "Invalid value for unsigned Integer(): \"#{raw_value}\"") if v < 0
212
216
  v
213
217
  end
214
- obj.send("#{params[:accessor]}=", val)
218
+ obj.send(params[:setter], val)
215
219
  end
216
220
  end
217
221
 
@@ -230,10 +234,9 @@ module RubyXL
230
234
 
231
235
  def initialize(params = nil)
232
236
  @local_namespaces = nil
233
- params ||= {}
234
237
 
235
238
  obtain_class_variable(:@@ooxml_attributes).each_value { |v|
236
- instance_variable_set("@#{v[:accessor]}", params[v[:accessor]]) unless v[:computed]
239
+ instance_variable_set(v[:instance_var], params&.[](v[:accessor])) unless v[:computed]
237
240
  }
238
241
 
239
242
  init_child_nodes(params)
@@ -242,15 +245,14 @@ module RubyXL
242
245
  def init_child_nodes(params)
243
246
  obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
244
247
  initial_value =
245
- if params.has_key?(v[:accessor]) then params[v[:accessor]]
248
+ if params&.has_key?(v[:accessor]) then params[v[:accessor]]
246
249
  elsif v[:is_array] then []
247
250
  else nil
248
251
  end
249
252
 
250
- instance_variable_set("@#{v[:accessor]}", initial_value)
253
+ instance_variable_set(v[:instance_var], initial_value)
251
254
  }
252
255
  end
253
- private :init_child_nodes
254
256
 
255
257
  def preserve_whitespace
256
258
  self.xml_space = (value.is_a?(String) && ((value =~ /\A\s/) || (value =~ /\s\Z/) || value.include?("\n"))) ? 'preserve' : nil
@@ -395,7 +397,7 @@ module RubyXL
395
397
  def init_child_nodes(params)
396
398
  obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
397
399
  next if v[:is_array] # Only one collection node allowed per OOXMLContainerObject, and it is contained in itself.
398
- instance_variable_set("@#{v[:accessor]}", params[v[:accessor]])
400
+ instance_variable_set(v[:instance_var], params[v[:accessor]])
399
401
  }
400
402
  end
401
403
  protected :init_child_nodes
@@ -405,9 +407,7 @@ module RubyXL
405
407
  end
406
408
 
407
409
  def inspect
408
- vars = [ super ]
409
- vars = self.instance_variables.each { |v| vars << "#{v}=#{instance_variable_get(v).inspect}" }
410
- "<#{self.class}: #{super} #{vars.join(", ")}>"
410
+ "<#{self.class}: #{super} #{self.instance_variables.collect{ |v| "#{v}=#{instance_variable_get(v).inspect}" }.join(', ')}>"
411
411
  end
412
412
 
413
413
  class << self
@@ -430,7 +430,7 @@ module RubyXL
430
430
  # Prototype method. For top-level OOXML object, returns the path at which the current object's XML file
431
431
  # is located within the <tt>.xlsx</tt> zip container.
432
432
  def xlsx_path
433
- raise 'Subclass responsebility'
433
+ raise RuntimeError, 'Subclass responsebility'
434
434
  end
435
435
 
436
436
  # Sets the list of namespaces on this object to be added when writing out XML. Valid only on top-level objects.
@@ -3,8 +3,9 @@ module RubyXL
3
3
  ROW_MAX = 1024 * 1024
4
4
  COL_MAX = 16393
5
5
 
6
- attr_reader :row_range, :col_range, :sheet_name
6
+ attr_reader :first_row, :last_row, :first_col, :last_col
7
7
  attr_reader :row_from_absolute, :row_to_absolute, :col_from_absolute, :col_to_absolute
8
+ attr_reader :sheet_name
8
9
 
9
10
  # RubyXL::Reference.new(row, col)
10
11
  # RubyXL::Reference.new(row_from, row_to, col_from, col_to)
@@ -33,56 +34,60 @@ module RubyXL
33
34
  row_from, col_from, @row_from_absolute, @col_from_absolute = self.class.ref2ind(from)
34
35
  row_to, col_to, @row_to_absolute, @col_to_absolute = self.class.ref2ind(to) unless to.nil?
35
36
  else
36
- raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
37
+ raise(ArgumentError, "Invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
37
38
  end
38
39
  end
39
40
 
40
- @row_range = Range.new(row_from || 0, row_to || row_from || ROW_MAX)
41
- @col_range = Range.new(col_from || 0, col_to || col_from || COL_MAX)
41
+ @first_row = row_from || 0
42
+ @last_row = row_to || row_from || ROW_MAX
43
+ @first_col = col_from || 0
44
+ @last_col = col_to || col_from || COL_MAX
42
45
  end
43
46
 
44
- def single_cell?
45
- (@row_range.begin == @row_range.end) && (@col_range.begin == @col_range.end)
46
- end
47
-
48
- def valid?
49
- !(row_range.begin.negative? || col_range.begin.negative?)
50
- end
51
-
52
- def first_row
53
- @row_range.begin
47
+ def row_range
48
+ warn "[DEPRECATION] `row_range` is deprecated. Please use `first_row` and `last_row` instead."
49
+ @row_range ||= Range.new(@first_row, @last_row)
54
50
  end
55
51
 
56
- def last_row
57
- @row_range.end
52
+ def col_range
53
+ warn "[DEPRECATION] `col_range` is deprecated. Please use `first_col` and `last_col` instead."
54
+ @col_range ||= Range.new(@first_col, @last_col)
58
55
  end
59
56
 
60
- def first_col
61
- @col_range.begin
57
+ def single_cell?
58
+ (@first_row == @last_row) && (@first_col == @last_col)
62
59
  end
63
60
 
64
- def last_col
65
- @col_range.end
61
+ def valid?
62
+ !(@first_row.negative? || @first_col.negative?)
66
63
  end
67
64
 
68
65
  def ==(other)
69
- !other.nil? && (@sheet_name == other.sheet_name) &&
70
- (@row_range == other.row_range) && (@col_range == other.col_range)
66
+ return false unless other.is_a?(RubyXL::Reference)
67
+ return false unless @sheet_name == other.sheet_name
68
+
69
+ (@first_row == other.first_row) &&
70
+ (@last_row == other.last_row) &&
71
+ (@first_col == other.first_col) &&
72
+ (@last_col == other.last_col)
71
73
  end
72
74
 
73
75
  def cover?(other)
74
- !other.nil? && (@row_range.cover?(other.row_range.begin) &&
75
- @row_range.cover?(other.row_range.end) &&
76
- @col_range.cover?(other.col_range.begin) &&
77
- @col_range.cover?(other.col_range.end))
76
+ return false unless other.is_a?(RubyXL::Reference)
77
+ return false unless @sheet_name == other.sheet_name
78
+
79
+ (@first_row <= other.first_row) &&
80
+ (@last_row >= other.last_row) &&
81
+ (@first_col <= other.first_col) &&
82
+ (@last_col >= other.last_col)
78
83
  end
79
84
 
80
85
  def to_s
81
86
  result = +''
82
87
 
83
88
  if @sheet_name then
84
- if @sheet_name.index(' ') then
85
- result << "'#{@sheet_name}'"
89
+ if @sheet_name.include?(' ') then
90
+ result << "'" << @sheet_name << "'"
86
91
  else
87
92
  result << @sheet_name
88
93
  end
@@ -90,19 +95,19 @@ module RubyXL
90
95
  end
91
96
 
92
97
  if single_cell? then
93
- result << self.class.ind2ref(@row_range.begin, @col_range.begin, @row_from_absolute, @col_from_absolute)
98
+ result << self.class.ind2ref(@first_row, @first_col, @row_from_absolute, @col_from_absolute)
94
99
  else
95
- result << self.class.ind2ref(@row_range.begin, @col_range.begin, @row_from_absolute, @col_from_absolute)
100
+ result << self.class.ind2ref(@first_row, @first_col, @row_from_absolute, @col_from_absolute)
96
101
  result << ':'
97
- result << self.class.ind2ref(@row_range.end, @col_range.end, @row_to_absolute, @col_to_absolute)
102
+ result << self.class.ind2ref(@last_row, @last_col, @row_to_absolute, @col_to_absolute)
98
103
  end
99
104
  end
100
105
 
101
106
  def inspect
102
107
  if single_cell? then
103
- "#<#{self.class} @sheet_name=#{@sheet_name} @row=#{@row_range.begin} @col=#{@col_range.begin}>"
108
+ "#<#{self.class} @sheet_name=#{@sheet_name} @row=#{@first_row} @col=#{@first_col}>"
104
109
  else
105
- "#<#{self.class} @sheet_name=#{@sheet_name} @row_range=#{@row_range} @col_range=#{@col_range}>"
110
+ "#<#{self.class} @sheet_name=#{@sheet_name} rows=#{@first_row}..#{@last_row} cols=#{@first_col}..#{@last_col}>"
106
111
  end
107
112
  end
108
113