rubyXL 3.4.25 → 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 (437) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/.rubocop.yml +124 -0
  4. data/CHANGELOG.md +12 -0
  5. data/Gemfile +2 -0
  6. data/README.rdoc +6 -4
  7. data/VERSION +1 -1
  8. data/lib/rubyXL/convenience_methods/cell.rb +1 -1
  9. data/lib/rubyXL/convenience_methods/color.rb +6 -6
  10. data/lib/rubyXL/convenience_methods/workbook.rb +1 -5
  11. data/lib/rubyXL/convenience_methods/worksheet.rb +26 -6
  12. data/lib/rubyXL/objects/color.rb +1 -1
  13. data/lib/rubyXL/objects/column_range.rb +16 -12
  14. data/lib/rubyXL/objects/document_properties.rb +1 -0
  15. data/lib/rubyXL/objects/external_links.rb +8 -0
  16. data/lib/rubyXL/objects/ooxml_object.rb +16 -14
  17. data/lib/rubyXL/objects/query_table.rb +4 -2
  18. data/lib/rubyXL/objects/reference.rb +21 -10
  19. data/lib/rubyXL/objects/relationships.rb +1 -1
  20. data/lib/rubyXL/objects/shared_strings.rb +1 -1
  21. data/lib/rubyXL/objects/sheet_data.rb +6 -6
  22. data/lib/rubyXL/objects/storage.rb +6 -1
  23. data/lib/rubyXL/objects/stylesheet.rb +2 -3
  24. data/lib/rubyXL/objects/text.rb +3 -3
  25. data/lib/rubyXL/objects/theme.rb +15 -17
  26. data/lib/rubyXL/objects/workbook.rb +10 -9
  27. data/lib/rubyXL/objects/worksheet.rb +2 -2
  28. data/lib/rubyXL/worksheet.rb +11 -3
  29. data/rdoc/README_rdoc.html +101 -49
  30. data/rdoc/RubyXL/AExtension.html +17 -13
  31. data/rdoc/RubyXL/AExtensionStorageArea.html +3 -3
  32. data/rdoc/RubyXL/ActiveX.html +10 -8
  33. data/rdoc/RubyXL/ActiveXBinary.html +3 -3
  34. data/rdoc/RubyXL/AdjustHandleList.html +3 -3
  35. data/rdoc/RubyXL/Alignment.html +3 -3
  36. data/rdoc/RubyXL/AlternateContent.html +3 -3
  37. data/rdoc/RubyXL/AlternateUrls.html +99 -0
  38. data/rdoc/RubyXL/Authors.html +3 -3
  39. data/rdoc/RubyXL/AutoFilter.html +3 -3
  40. data/rdoc/RubyXL/AutoFilterColumn.html +3 -3
  41. data/rdoc/RubyXL/BinaryImageFile.html +3 -3
  42. data/rdoc/RubyXL/BodyProperties.html +3 -3
  43. data/rdoc/RubyXL/BooleanNode.html +3 -3
  44. data/rdoc/RubyXL/BooleanValue.html +3 -3
  45. data/rdoc/RubyXL/Border.html +27 -19
  46. data/rdoc/RubyXL/BorderEdge.html +15 -11
  47. data/rdoc/RubyXL/Borders.html +9 -7
  48. data/rdoc/RubyXL/Break.html +3 -3
  49. data/rdoc/RubyXL/BreakList.html +3 -3
  50. data/rdoc/RubyXL/CT_AdjPoint2D.html +3 -3
  51. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +3 -3
  52. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +3 -3
  53. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +3 -3
  54. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +3 -3
  55. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +3 -3
  56. data/rdoc/RubyXL/CT_Backdrop.html +3 -3
  57. data/rdoc/RubyXL/CT_Bevel.html +3 -3
  58. data/rdoc/RubyXL/CT_BiLevelEffect.html +3 -3
  59. data/rdoc/RubyXL/CT_BlendEffect.html +3 -3
  60. data/rdoc/RubyXL/CT_Blip.html +3 -3
  61. data/rdoc/RubyXL/CT_BlipFillProperties.html +3 -3
  62. data/rdoc/RubyXL/CT_BlurEffect.html +3 -3
  63. data/rdoc/RubyXL/CT_Camera.html +3 -3
  64. data/rdoc/RubyXL/CT_Color.html +3 -3
  65. data/rdoc/RubyXL/CT_ColorChangeEffect.html +3 -3
  66. data/rdoc/RubyXL/CT_ColorMapping.html +3 -3
  67. data/rdoc/RubyXL/CT_ColorScheme.html +3 -3
  68. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +3 -3
  69. data/rdoc/RubyXL/CT_ConnectionSite.html +3 -3
  70. data/rdoc/RubyXL/CT_ConnectionSiteList.html +3 -3
  71. data/rdoc/RubyXL/CT_DashStop.html +3 -3
  72. data/rdoc/RubyXL/CT_DashStopList.html +3 -3
  73. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +3 -3
  74. data/rdoc/RubyXL/CT_DuotoneEffect.html +3 -3
  75. data/rdoc/RubyXL/CT_EffectContainer.html +3 -3
  76. data/rdoc/RubyXL/CT_EffectList.html +3 -3
  77. data/rdoc/RubyXL/CT_EffectReference.html +3 -3
  78. data/rdoc/RubyXL/CT_EffectStyleItem.html +3 -3
  79. data/rdoc/RubyXL/CT_EffectStyleList.html +3 -3
  80. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +3 -3
  81. data/rdoc/RubyXL/CT_FillEffect.html +3 -3
  82. data/rdoc/RubyXL/CT_FillOverlayEffect.html +3 -3
  83. data/rdoc/RubyXL/CT_FillStyleList.html +3 -3
  84. data/rdoc/RubyXL/CT_FlatText.html +3 -3
  85. data/rdoc/RubyXL/CT_FontCollection.html +3 -3
  86. data/rdoc/RubyXL/CT_FontReference.html +3 -3
  87. data/rdoc/RubyXL/CT_GeomGuideList.html +3 -3
  88. data/rdoc/RubyXL/CT_GlowEffect.html +3 -3
  89. data/rdoc/RubyXL/CT_GradientFillProperties.html +3 -3
  90. data/rdoc/RubyXL/CT_GradientStop.html +3 -3
  91. data/rdoc/RubyXL/CT_GradientStopList.html +3 -3
  92. data/rdoc/RubyXL/CT_HSLEffect.html +3 -3
  93. data/rdoc/RubyXL/CT_HslColor.html +3 -3
  94. data/rdoc/RubyXL/CT_Hyperlink.html +3 -3
  95. data/rdoc/RubyXL/CT_InnerShadowEffect.html +3 -3
  96. data/rdoc/RubyXL/CT_LightRig.html +3 -3
  97. data/rdoc/RubyXL/CT_LineEndProperties.html +3 -3
  98. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +3 -3
  99. data/rdoc/RubyXL/CT_LineProperties.html +3 -3
  100. data/rdoc/RubyXL/CT_LineStyleList.html +3 -3
  101. data/rdoc/RubyXL/CT_LinearShadeProperties.html +3 -3
  102. data/rdoc/RubyXL/CT_LuminanceEffect.html +3 -3
  103. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +3 -3
  104. data/rdoc/RubyXL/CT_OuterShadowEffect.html +3 -3
  105. data/rdoc/RubyXL/CT_Path2D.html +3 -3
  106. data/rdoc/RubyXL/CT_Path2DArcTo.html +3 -3
  107. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +3 -3
  108. data/rdoc/RubyXL/CT_Path2DList.html +3 -3
  109. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +3 -3
  110. data/rdoc/RubyXL/CT_Path2DTo.html +3 -3
  111. data/rdoc/RubyXL/CT_PathShadeProperties.html +3 -3
  112. data/rdoc/RubyXL/CT_PatternFillProperties.html +3 -3
  113. data/rdoc/RubyXL/CT_Point3D.html +3 -3
  114. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +3 -3
  115. data/rdoc/RubyXL/CT_PresetColor.html +3 -3
  116. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +3 -3
  117. data/rdoc/RubyXL/CT_PresetShadowEffect.html +3 -3
  118. data/rdoc/RubyXL/CT_PresetTextShape.html +3 -3
  119. data/rdoc/RubyXL/CT_ReflectionEffect.html +3 -3
  120. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +3 -3
  121. data/rdoc/RubyXL/CT_RelativeRect.html +3 -3
  122. data/rdoc/RubyXL/CT_SRgbColor.html +3 -3
  123. data/rdoc/RubyXL/CT_ScRgbColor.html +3 -3
  124. data/rdoc/RubyXL/CT_Scene3D.html +3 -3
  125. data/rdoc/RubyXL/CT_SchemeColor.html +3 -3
  126. data/rdoc/RubyXL/CT_Shape3D.html +3 -3
  127. data/rdoc/RubyXL/CT_ShapeStyle.html +3 -3
  128. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +3 -3
  129. data/rdoc/RubyXL/CT_SphereCoords.html +3 -3
  130. data/rdoc/RubyXL/CT_StretchInfoProperties.html +3 -3
  131. data/rdoc/RubyXL/CT_StyleMatrix.html +3 -3
  132. data/rdoc/RubyXL/CT_StyleMatrixReference.html +3 -3
  133. data/rdoc/RubyXL/CT_SupplementalFont.html +3 -3
  134. data/rdoc/RubyXL/CT_SystemColor.html +3 -3
  135. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +3 -3
  136. data/rdoc/RubyXL/CT_TextBlipBullet.html +3 -3
  137. data/rdoc/RubyXL/CT_TextCharBullet.html +3 -3
  138. data/rdoc/RubyXL/CT_TextCharacterProperties.html +3 -3
  139. data/rdoc/RubyXL/CT_TextFont.html +3 -3
  140. data/rdoc/RubyXL/CT_TextListStyle.html +3 -3
  141. data/rdoc/RubyXL/CT_TextNormalAutofit.html +3 -3
  142. data/rdoc/RubyXL/CT_TextParagraphProperties.html +3 -3
  143. data/rdoc/RubyXL/CT_TextSpacing.html +3 -3
  144. data/rdoc/RubyXL/CT_TextTabStop.html +3 -3
  145. data/rdoc/RubyXL/CT_TextTabStopList.html +3 -3
  146. data/rdoc/RubyXL/CT_TileInfoProperties.html +3 -3
  147. data/rdoc/RubyXL/CT_TintEffect.html +3 -3
  148. data/rdoc/RubyXL/CT_Transform2D.html +3 -3
  149. data/rdoc/RubyXL/CT_TransformEffect.html +3 -3
  150. data/rdoc/RubyXL/CT_Vector3D.html +3 -3
  151. data/rdoc/RubyXL/CT_XYAdjustHandle.html +3 -3
  152. data/rdoc/RubyXL/CalculationChain.html +9 -7
  153. data/rdoc/RubyXL/CalculationChainCell.html +3 -3
  154. data/rdoc/RubyXL/CalculationProperties.html +3 -3
  155. data/rdoc/RubyXL/Cell.html +93 -65
  156. data/rdoc/RubyXL/CellConvenienceMethods.html +220 -148
  157. data/rdoc/RubyXL/CellExt.html +3 -3
  158. data/rdoc/RubyXL/CellSmartTag.html +3 -3
  159. data/rdoc/RubyXL/CellSmartTagProperty.html +3 -3
  160. data/rdoc/RubyXL/CellSmartTags.html +3 -3
  161. data/rdoc/RubyXL/CellStyle.html +3 -3
  162. data/rdoc/RubyXL/CellStyleXFs.html +9 -7
  163. data/rdoc/RubyXL/CellStyles.html +10 -8
  164. data/rdoc/RubyXL/CellValue.html +9 -7
  165. data/rdoc/RubyXL/CellWatch.html +3 -3
  166. data/rdoc/RubyXL/CellWatches.html +3 -3
  167. data/rdoc/RubyXL/CellXFs.html +11 -10
  168. data/rdoc/RubyXL/ChartColorsFile.html +3 -3
  169. data/rdoc/RubyXL/ChartFile.html +9 -7
  170. data/rdoc/RubyXL/ChartStyleFile.html +3 -3
  171. data/rdoc/RubyXL/ChartUserShapesFile.html +3 -3
  172. data/rdoc/RubyXL/Chartsheet.html +9 -7
  173. data/rdoc/RubyXL/ChartsheetPageSetup.html +3 -3
  174. data/rdoc/RubyXL/ChartsheetProperties.html +3 -3
  175. data/rdoc/RubyXL/ChartsheetProtection.html +3 -3
  176. data/rdoc/RubyXL/ChartsheetView.html +3 -3
  177. data/rdoc/RubyXL/ChartsheetViews.html +3 -3
  178. data/rdoc/RubyXL/Color.html +9 -7
  179. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +17 -13
  180. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +23 -17
  181. data/rdoc/RubyXL/ColorConvenienceClasses.html +3 -3
  182. data/rdoc/RubyXL/ColorConvenienceMethods.html +9 -7
  183. data/rdoc/RubyXL/ColorFilter.html +3 -3
  184. data/rdoc/RubyXL/ColorScale.html +3 -3
  185. data/rdoc/RubyXL/ColorSet.html +3 -3
  186. data/rdoc/RubyXL/Colors.html +3 -3
  187. data/rdoc/RubyXL/ColumnRange.html +57 -20
  188. data/rdoc/RubyXL/ColumnRanges.html +37 -29
  189. data/rdoc/RubyXL/Comment.html +3 -3
  190. data/rdoc/RubyXL/CommentList.html +3 -3
  191. data/rdoc/RubyXL/CommentsFile.html +9 -7
  192. data/rdoc/RubyXL/ConditionalFormatValue.html +3 -3
  193. data/rdoc/RubyXL/ConditionalFormatting.html +3 -3
  194. data/rdoc/RubyXL/ConditionalFormattingRule.html +3 -3
  195. data/rdoc/RubyXL/Connection.html +3 -3
  196. data/rdoc/RubyXL/ConnectionTable.html +3 -3
  197. data/rdoc/RubyXL/ConnectionTables.html +3 -3
  198. data/rdoc/RubyXL/ConnectionTextField.html +3 -3
  199. data/rdoc/RubyXL/ConnectionTextFields.html +3 -3
  200. data/rdoc/RubyXL/Connections.html +9 -7
  201. data/rdoc/RubyXL/ContentTypeDefault.html +3 -3
  202. data/rdoc/RubyXL/ContentTypeOverride.html +3 -3
  203. data/rdoc/RubyXL/ContentTypes.html +15 -11
  204. data/rdoc/RubyXL/ControlPropertiesFile.html +3 -3
  205. data/rdoc/RubyXL/CorePropertiesFile.html +66 -48
  206. data/rdoc/RubyXL/CustomColor.html +3 -3
  207. data/rdoc/RubyXL/CustomColorList.html +3 -3
  208. data/rdoc/RubyXL/CustomFilter.html +3 -3
  209. data/rdoc/RubyXL/CustomFilters.html +3 -3
  210. data/rdoc/RubyXL/CustomGeometry.html +3 -3
  211. data/rdoc/RubyXL/CustomProperties.html +3 -3
  212. data/rdoc/RubyXL/CustomPropertiesFile.html +3 -3
  213. data/rdoc/RubyXL/CustomProperty.html +3 -3
  214. data/rdoc/RubyXL/CustomPropertyFile.html +3 -3
  215. data/rdoc/RubyXL/CustomSheetView.html +3 -3
  216. data/rdoc/RubyXL/CustomSheetViews.html +3 -3
  217. data/rdoc/RubyXL/CustomWorkbookView.html +3 -3
  218. data/rdoc/RubyXL/CustomWorkbookViews.html +3 -3
  219. data/rdoc/RubyXL/CustomXMLFile.html +3 -3
  220. data/rdoc/RubyXL/DXF.html +3 -3
  221. data/rdoc/RubyXL/DXFs.html +3 -3
  222. data/rdoc/RubyXL/DataBar.html +3 -3
  223. data/rdoc/RubyXL/DataConsolidate.html +3 -3
  224. data/rdoc/RubyXL/DataConsolidationReference.html +3 -3
  225. data/rdoc/RubyXL/DataConsolidationReferences.html +3 -3
  226. data/rdoc/RubyXL/DataType.html +3 -3
  227. data/rdoc/RubyXL/DataValidation.html +3 -3
  228. data/rdoc/RubyXL/DataValidations.html +3 -3
  229. data/rdoc/RubyXL/DateGroupItem.html +3 -3
  230. data/rdoc/RubyXL/DefinedName.html +3 -3
  231. data/rdoc/RubyXL/DefinedNameExt.html +3 -3
  232. data/rdoc/RubyXL/DefinedNames.html +3 -3
  233. data/rdoc/RubyXL/DefinedNamesExt.html +3 -3
  234. data/rdoc/RubyXL/DocumentPropertiesFile.html +17 -12
  235. data/rdoc/RubyXL/DrawingFile.html +9 -7
  236. data/rdoc/RubyXL/DynamicFilter.html +3 -3
  237. data/rdoc/RubyXL/EmbeddedControl.html +3 -3
  238. data/rdoc/RubyXL/EmbeddedControls.html +3 -3
  239. data/rdoc/RubyXL/Extension.html +3 -3
  240. data/rdoc/RubyXL/ExtensionStorageArea.html +3 -3
  241. data/rdoc/RubyXL/Extents.html +3 -3
  242. data/rdoc/RubyXL/ExternalBook.html +3 -3
  243. data/rdoc/RubyXL/ExternalLinksFile.html +10 -8
  244. data/rdoc/RubyXL/ExternalReference.html +3 -3
  245. data/rdoc/RubyXL/ExternalReferences.html +3 -3
  246. data/rdoc/RubyXL/ExtraColorSchemeList.html +3 -3
  247. data/rdoc/RubyXL/FieldItem.html +3 -3
  248. data/rdoc/RubyXL/FileRecoveryProperties.html +3 -3
  249. data/rdoc/RubyXL/FileSharing.html +3 -3
  250. data/rdoc/RubyXL/FileVersion.html +3 -3
  251. data/rdoc/RubyXL/Fill.html +9 -7
  252. data/rdoc/RubyXL/Fills.html +9 -7
  253. data/rdoc/RubyXL/FilterContainer.html +3 -3
  254. data/rdoc/RubyXL/FloatNode.html +3 -3
  255. data/rdoc/RubyXL/FloatValue.html +3 -3
  256. data/rdoc/RubyXL/Font.html +9 -7
  257. data/rdoc/RubyXL/FontConvenienceMethods.html +87 -59
  258. data/rdoc/RubyXL/FontScheme.html +3 -3
  259. data/rdoc/RubyXL/Fonts.html +9 -7
  260. data/rdoc/RubyXL/Formula.html +3 -3
  261. data/rdoc/RubyXL/FunctionGroup.html +3 -3
  262. data/rdoc/RubyXL/FunctionGroups.html +3 -3
  263. data/rdoc/RubyXL/GenericStorageObject.html +22 -16
  264. data/rdoc/RubyXL/GradientFill.html +3 -3
  265. data/rdoc/RubyXL/HeaderFooterSettings.html +3 -3
  266. data/rdoc/RubyXL/Hyperlink.html +3 -3
  267. data/rdoc/RubyXL/HyperlinkRelFile.html +3 -3
  268. data/rdoc/RubyXL/Hyperlinks.html +3 -3
  269. data/rdoc/RubyXL/IconFilter.html +3 -3
  270. data/rdoc/RubyXL/IconSet.html +3 -3
  271. data/rdoc/RubyXL/IgnoredError.html +3 -3
  272. data/rdoc/RubyXL/IgnoredErrors.html +3 -3
  273. data/rdoc/RubyXL/IndexedColors.html +3 -3
  274. data/rdoc/RubyXL/InputCells.html +3 -3
  275. data/rdoc/RubyXL/IntegerNode.html +3 -3
  276. data/rdoc/RubyXL/IntegerValue.html +3 -3
  277. data/rdoc/RubyXL/LegacyCell.html +9 -7
  278. data/rdoc/RubyXL/LegacyWorksheet.html +55 -30
  279. data/rdoc/RubyXL/MRUColors.html +3 -3
  280. data/rdoc/RubyXL/MacrosFile.html +3 -3
  281. data/rdoc/RubyXL/MergedCell.html +3 -3
  282. data/rdoc/RubyXL/MergedCells.html +3 -3
  283. data/rdoc/RubyXL/NumFmt.html +3 -3
  284. data/rdoc/RubyXL/NumberFormat.html +9 -7
  285. data/rdoc/RubyXL/NumberFormats.html +9 -7
  286. data/rdoc/RubyXL/OLEObject.html +3 -3
  287. data/rdoc/RubyXL/OLEObjectFile.html +3 -3
  288. data/rdoc/RubyXL/OLEObjects.html +3 -3
  289. data/rdoc/RubyXL/OLESize.html +3 -3
  290. data/rdoc/RubyXL/OOXMLContainerObject.html +46 -34
  291. data/rdoc/RubyXL/OOXMLIgnored.html +15 -11
  292. data/rdoc/RubyXL/OOXMLObject.html +3 -3
  293. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +46 -31
  294. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +67 -52
  295. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +64 -44
  296. data/rdoc/RubyXL/OOXMLTopLevelObject.html +38 -28
  297. data/rdoc/RubyXL/OdbcOleDbProperties.html +3 -3
  298. data/rdoc/RubyXL/Offset.html +3 -3
  299. data/rdoc/RubyXL/OlapProperties.html +3 -3
  300. data/rdoc/RubyXL/OleItem.html +3 -3
  301. data/rdoc/RubyXL/OleItems.html +3 -3
  302. data/rdoc/RubyXL/OleLink.html +3 -3
  303. data/rdoc/RubyXL/OutlineProperties.html +3 -3
  304. data/rdoc/RubyXL/PageMargins.html +3 -3
  305. data/rdoc/RubyXL/PageSetup.html +3 -3
  306. data/rdoc/RubyXL/PageSetupProperties.html +3 -3
  307. data/rdoc/RubyXL/Pane.html +3 -3
  308. data/rdoc/RubyXL/Parser.html +15 -11
  309. data/rdoc/RubyXL/PatternFill.html +3 -3
  310. data/rdoc/RubyXL/PersonMetadata.html +108 -0
  311. data/rdoc/RubyXL/PhoneticProperties.html +3 -3
  312. data/rdoc/RubyXL/PhoneticRun.html +3 -3
  313. data/rdoc/RubyXL/PivotArea.html +3 -3
  314. data/rdoc/RubyXL/PivotCache.html +3 -3
  315. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +3 -3
  316. data/rdoc/RubyXL/PivotCacheRecordsFile.html +3 -3
  317. data/rdoc/RubyXL/PivotCaches.html +3 -3
  318. data/rdoc/RubyXL/PivotReference.html +3 -3
  319. data/rdoc/RubyXL/PivotReferences.html +3 -3
  320. data/rdoc/RubyXL/PivotTableFile.html +3 -3
  321. data/rdoc/RubyXL/PivotTableSelection.html +3 -3
  322. data/rdoc/RubyXL/PresetGeometry.html +3 -3
  323. data/rdoc/RubyXL/PrintOptions.html +3 -3
  324. data/rdoc/RubyXL/PrinterSettingsFile.html +3 -3
  325. data/rdoc/RubyXL/ProtectedRange.html +3 -3
  326. data/rdoc/RubyXL/ProtectedRanges.html +3 -3
  327. data/rdoc/RubyXL/Protection.html +3 -3
  328. data/rdoc/RubyXL/QueryParameter.html +3 -3
  329. data/rdoc/RubyXL/QueryParameters.html +3 -3
  330. data/rdoc/RubyXL/QueryTable.html +10 -8
  331. data/rdoc/RubyXL/QueryTableDeletedField.html +3 -3
  332. data/rdoc/RubyXL/QueryTableDeletedFields.html +3 -3
  333. data/rdoc/RubyXL/QueryTableField.html +3 -3
  334. data/rdoc/RubyXL/QueryTableFields.html +3 -3
  335. data/rdoc/RubyXL/QueryTableRefresh.html +3 -3
  336. data/rdoc/RubyXL/RID.html +3 -3
  337. data/rdoc/RubyXL/RawOOXML.html +15 -11
  338. data/rdoc/RubyXL/Reference.html +113 -77
  339. data/rdoc/RubyXL/Relationship.html +3 -3
  340. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +9 -7
  341. data/rdoc/RubyXL/RelationshipSupport.html +39 -27
  342. data/rdoc/RubyXL/RevisionPointer.html +3 -3
  343. data/rdoc/RubyXL/RichText.html +11 -9
  344. data/rdoc/RubyXL/RichTextRun.html +9 -7
  345. data/rdoc/RubyXL/Row.html +57 -39
  346. data/rdoc/RubyXL/RowExt.html +3 -3
  347. data/rdoc/RubyXL/RunProperties.html +3 -3
  348. data/rdoc/RubyXL/Scenario.html +3 -3
  349. data/rdoc/RubyXL/Scenarios.html +3 -3
  350. data/rdoc/RubyXL/Selection.html +9 -7
  351. data/rdoc/RubyXL/ShapeGuide.html +3 -3
  352. data/rdoc/RubyXL/ShapeTextRectangle.html +3 -3
  353. data/rdoc/RubyXL/SharedStringsTable.html +46 -32
  354. data/rdoc/RubyXL/Sheet.html +3 -3
  355. data/rdoc/RubyXL/SheetCalculationProperties.html +3 -3
  356. data/rdoc/RubyXL/SheetData.html +15 -11
  357. data/rdoc/RubyXL/SheetDataExt.html +3 -3
  358. data/rdoc/RubyXL/SheetDataSet.html +3 -3
  359. data/rdoc/RubyXL/SheetMetadata.html +3 -3
  360. data/rdoc/RubyXL/SheetName.html +3 -3
  361. data/rdoc/RubyXL/SheetNames.html +3 -3
  362. data/rdoc/RubyXL/Sheets.html +3 -3
  363. data/rdoc/RubyXL/SlicerCacheFile.html +3 -3
  364. data/rdoc/RubyXL/SlicerFile.html +3 -3
  365. data/rdoc/RubyXL/SmartTagProperties.html +3 -3
  366. data/rdoc/RubyXL/SmartTagType.html +3 -3
  367. data/rdoc/RubyXL/SmartTagTypes.html +3 -3
  368. data/rdoc/RubyXL/SmartTags.html +3 -3
  369. data/rdoc/RubyXL/SortCondition.html +3 -3
  370. data/rdoc/RubyXL/SortState.html +3 -3
  371. data/rdoc/RubyXL/Sqref.html +18 -14
  372. data/rdoc/RubyXL/Stop.html +3 -3
  373. data/rdoc/RubyXL/StringNode.html +3 -3
  374. data/rdoc/RubyXL/StringNodeW3C.html +15 -11
  375. data/rdoc/RubyXL/StringValue.html +3 -3
  376. data/rdoc/RubyXL/Stylesheet.html +38 -28
  377. data/rdoc/RubyXL/TableFile.html +3 -3
  378. data/rdoc/RubyXL/TableParts.html +3 -3
  379. data/rdoc/RubyXL/TableStyle.html +3 -3
  380. data/rdoc/RubyXL/TableStyles.html +3 -3
  381. data/rdoc/RubyXL/Text.html +16 -12
  382. data/rdoc/RubyXL/TextImportSettings.html +3 -3
  383. data/rdoc/RubyXL/Theme.html +39 -33
  384. data/rdoc/RubyXL/ThemeElements.html +3 -3
  385. data/rdoc/RubyXL/ThumbnailFile.html +3 -3
  386. data/rdoc/RubyXL/Top10.html +3 -3
  387. data/rdoc/RubyXL/VMLDrawingFile.html +3 -3
  388. data/rdoc/RubyXL/Variant.html +3 -3
  389. data/rdoc/RubyXL/Vector.html +9 -7
  390. data/rdoc/RubyXL/VectorValue.html +3 -3
  391. data/rdoc/RubyXL/VisualProperties.html +3 -3
  392. data/rdoc/RubyXL/WebPublishObject.html +3 -3
  393. data/rdoc/RubyXL/WebPublishObjects.html +3 -3
  394. data/rdoc/RubyXL/WebPublishingItem.html +3 -3
  395. data/rdoc/RubyXL/WebPublishingItems.html +3 -3
  396. data/rdoc/RubyXL/WebPublishingProperties.html +3 -3
  397. data/rdoc/RubyXL/WebQueryProperties.html +3 -3
  398. data/rdoc/RubyXL/Workbook.html +202 -146
  399. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +124 -92
  400. data/rdoc/RubyXL/WorkbookProperties.html +3 -3
  401. data/rdoc/RubyXL/WorkbookProtection.html +3 -3
  402. data/rdoc/RubyXL/WorkbookRoot.html +33 -23
  403. data/rdoc/RubyXL/WorkbookView.html +3 -3
  404. data/rdoc/RubyXL/WorkbookViews.html +3 -3
  405. data/rdoc/RubyXL/Worksheet.html +45 -31
  406. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +443 -288
  407. data/rdoc/RubyXL/WorksheetDimensions.html +3 -3
  408. data/rdoc/RubyXL/WorksheetFormatProperties.html +3 -3
  409. data/rdoc/RubyXL/WorksheetProperties.html +3 -3
  410. data/rdoc/RubyXL/WorksheetProtection.html +3 -3
  411. data/rdoc/RubyXL/WorksheetView.html +3 -3
  412. data/rdoc/RubyXL/WorksheetViews.html +3 -3
  413. data/rdoc/RubyXL/XF.html +3 -3
  414. data/rdoc/RubyXL.html +9 -7
  415. data/rdoc/created.rid +35 -35
  416. data/rdoc/css/rdoc.css +55 -7
  417. data/rdoc/index.html +395 -388
  418. data/rdoc/js/darkfish.js +14 -1
  419. data/rdoc/js/navigation.js +8 -8
  420. data/rdoc/js/navigation.js.gz +0 -0
  421. data/rdoc/js/search.js +4 -4
  422. data/rdoc/js/search_index.js +1 -1
  423. data/rdoc/js/search_index.js.gz +0 -0
  424. data/rdoc/js/searcher.js.gz +0 -0
  425. data/rdoc/table_of_contents.html +14 -3
  426. data/rubyXL.gemspec +10 -5
  427. data/spec/lib/cell_spec.rb +30 -4
  428. data/spec/lib/color_spec.rb +7 -0
  429. data/spec/lib/parser_spec.rb +8 -5
  430. data/spec/lib/reference_spec.rb +35 -5
  431. data/spec/lib/rgb_color_spec.rb +2 -0
  432. data/spec/lib/stylesheet_spec.rb +2 -0
  433. data/spec/lib/text_spec.rb +3 -1
  434. data/spec/lib/workbook_spec.rb +6 -4
  435. data/spec/lib/worksheet_spec.rb +29 -17
  436. metadata +21 -4
  437. data/Gemfile.lock +0 -124
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69ceee765ae742ca18903f3db0a368782e581e8324941fd9671e6642fb8ba5d9
4
- data.tar.gz: 0bed16ef2323e2bd91e33d395a66c9a13b902e5e03cad2de415f4bafcbcb8b3b
3
+ metadata.gz: 14119a8af99822bbe1fd209a060d5374e92fe921750766cc83fa2cebdf586963
4
+ data.tar.gz: a3870a59650bd9b32c82bd6ad950aa720cb9f50370b96956eecb522d1c8e8fce
5
5
  SHA512:
6
- metadata.gz: d30a855437e79b15c975ad5e13148cfb72e4f2956449dcbc95d6ff691e60a668d729432e80909318010d473e75323c3c4f75c17b57f80c59f22f41bac43bfc35
7
- data.tar.gz: fe740718fd69d6a8131383d8b5b326df918820d67c08c708e8e80959a9a04ad3f0f18c2d0efb02e6e660dc66456578a8008e98781ee094658ac78fee9319d90b
6
+ metadata.gz: 27f8bf50de4801721703c78a73b156626998d37a7fa1ce76a05e2848d9bf233a29ed91044567b2b02a8cd29487872f2a5ed2eeeb65c45ae6b3fed8b4bfccea25
7
+ data.tar.gz: 7ba264f255d544ba9efb9bb5aaa272a2ba84442930bf41eb72c6a63571b0ed21a69255975c843b796725ce17ca29c81950b1784a0c027a54dc35e4801ea0870e
data/.circleci/config.yml CHANGED
@@ -7,7 +7,7 @@ jobs:
7
7
  build:
8
8
  docker:
9
9
  # specify the version you desire here
10
- - image: circleci/ruby:2.6.6-buster
10
+ - image: cimg/ruby:3.1.4
11
11
 
12
12
  # Specify service dependencies here if necessary
13
13
  # CircleCI maintains a library of pre-built images
data/.rubocop.yml ADDED
@@ -0,0 +1,124 @@
1
+ #inherit_from: .rubocop_todo.yml
2
+
3
+ #require:
4
+ # - rubocop-rspec
5
+
6
+ AllCops:
7
+ NewCops: enable
8
+ SuggestExtensions: false
9
+ TargetRubyVersion: 2.6
10
+ DisplayCopNames: true
11
+ DisplayStyleGuide: true
12
+ Exclude:
13
+ - test/**/*
14
+ - tmp/*
15
+ - vendor/**/*
16
+ - Gemfile
17
+ - rubyXL.gemspec
18
+
19
+ # "Excessive" parentheses are your friend. You will understand it in time, Luke.
20
+ Style/TernaryParentheses:
21
+ Enabled: false
22
+
23
+ # Implicity is evil. Unwilingness to type a couple extra characters is laziness.
24
+ Style/RedundantConstantBase:
25
+ Enabled: false
26
+
27
+ # I don't see a good reason in this. Unless you are paid per line.
28
+ Style/CommentedKeyword:
29
+ Enabled: false
30
+
31
+ # Yes, some things are "redundant" but they are there exactly to drive home some point...
32
+ Style/RedundantSelf:
33
+ Enabled: false
34
+
35
+ Naming/AccessorMethodName:
36
+ Enabled: false
37
+
38
+ Layout/FirstArrayElementIndentation:
39
+ Enabled: false
40
+
41
+ Style/Documentation:
42
+ Enabled: false
43
+
44
+ Layout/LeadingCommentSpace:
45
+ Enabled: false
46
+
47
+ Style/BlockDelimiters:
48
+ Enabled: false
49
+
50
+ Style/HashSyntax:
51
+ Enabled: false
52
+
53
+ Style/MultilineIfThen:
54
+ Enabled: false
55
+
56
+ Style/ParenthesesAroundCondition:
57
+ Enabled: false
58
+
59
+ Style/MultilineWhenThen:
60
+ Enabled: false
61
+
62
+ Style/RedundantPercentQ:
63
+ Enabled: false
64
+
65
+ Style/PercentLiteralDelimiters:
66
+ Enabled: false
67
+
68
+ Style/NumericLiterals:
69
+ Enabled: false
70
+
71
+ Style/ExponentialNotation:
72
+ Enabled: false
73
+
74
+ Layout/SpaceInsideArrayLiteralBrackets:
75
+ EnforcedStyle: space
76
+ Enabled: false
77
+
78
+ Layout/SpaceBeforeBlockBraces:
79
+ Enabled: false
80
+
81
+ Layout/EmptyLineAfterGuardClause:
82
+ Enabled: false
83
+
84
+ Naming/MethodParameterName:
85
+ Enabled: false
86
+
87
+ Naming/ClassAndModuleCamelCase:
88
+ Enabled: false
89
+
90
+ Naming/ConstantName:
91
+ Enabled: false
92
+
93
+
94
+
95
+ Layout/HashAlignment:
96
+ EnforcedHashRocketStyle: table
97
+
98
+ Layout/SpaceInsidePercentLiteralDelimiters:
99
+ Enabled: false
100
+
101
+
102
+
103
+ Metrics/BlockLength:
104
+ Enabled: false
105
+
106
+ Metrics/ClassLength:
107
+ Enabled: false
108
+
109
+ Metrics/MethodLength:
110
+ Enabled: false
111
+
112
+
113
+
114
+ Metrics/PerceivedComplexity:
115
+ Enabled: false
116
+
117
+ Metrics/ParameterLists:
118
+ Enabled: false
119
+
120
+ Metrics/CyclomaticComplexity:
121
+ Enabled: false
122
+
123
+ Metrics/ModuleLength:
124
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # v3.4.25 (May 19, 2022)
2
+
3
+ * Improve code style and consistently (@weshatheleopard)
4
+ * Update `Gemfile.lock`, dependency versions used when developing the gem (@weshatheleopard)
5
+
6
+ # v3.4.24 (May 16, 2022)
7
+
8
+ * Add `Cell#add_hyperlink` for adding a hyperlink to a cell (@weshatheleopard)
9
+ * Add `Reference#valid?` for checking if a cell reference is valid (@weshatheleopard)
10
+ * Add `Worksheet#cell_at` for finding a cell by its Excel-style reference (@weshatheleopard)
11
+ * Prevent creation of sheets with reserved names (specifically, `History`) (@weshatheleopard)
12
+ * Update `Gemfile.lock`, dependency versions used when developing the gem (@weshatheleopard)
data/Gemfile CHANGED
@@ -15,4 +15,6 @@ group :development, :test do
15
15
  # gem 'stackprof'
16
16
  gem 'ruby-prof'
17
17
  gem 'rspec_junit_formatter'
18
+
19
+ gem 'rubocop'
18
20
  end
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = rubyXL
2
- {<img src="https://badge.fury.io/rb/rubyXL.svg" alt="Gem Version" />}[http://badge.fury.io/rb/rubyXL]
3
- {<img src="https://codeclimate.com/github/weshatheleopard/rubyXL.png" alt="Code Climate" />}[https://codeclimate.com/github/weshatheleopard/rubyXL]
4
- {<img src="https://circleci.com/gh/weshatheleopard/rubyXL.svg?style=svg" alt="CircleCI" />}[https://circleci.com/gh/weshatheleopard/rubyXL]
2
+ {rdoc-image:https://badge.fury.io/rb/rubyXL.svg}[http://badge.fury.io/rb/rubyXL]
3
+ {rdoc-image:https://codeclimate.com/github/weshatheleopard/rubyXL.png}[https://codeclimate.com/github/weshatheleopard/rubyXL]
4
+ {rdoc-image:https://circleci.com/gh/weshatheleopard/rubyXL.svg?style=svg}[https://circleci.com/gh/weshatheleopard/rubyXL]
5
5
 
6
6
  This gem supports operating on +xlsx+ files (Open XML format). While it is capable
7
7
  of properly parsing the entire OOXML structure, its current main emphasis is on
@@ -168,7 +168,9 @@ Please note: these methods are being phased out in favor of the OOXML object mod
168
168
  worksheet.change_column_width(0, 30) # Sets first column width to 30
169
169
 
170
170
  ==== Merging Cells
171
- worksheet.merge_cells(0, 0, 1, 1) # Merges A1:B2
171
+ worksheet.merge_cells(0, 1, 2, 3) # Merges B1:D3
172
+ worksheet.merge_cells('A2:C4') # Merges A2:C4
173
+ worksheet.merge_cells(row_from: 0, row_to: 1, col_from 2:, col_to: 3) # Merges C1:D2
172
174
 
173
175
  ==== Insert Row
174
176
  This method will insert a row at specified index, pushing all rows below it down. It also copies styles from row above.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.25
1
+ 3.4.33
@@ -116,7 +116,7 @@ module RubyXL
116
116
 
117
117
  def fill_color
118
118
  validate_worksheet
119
- return workbook.get_fill_color(get_cell_xf)
119
+ workbook.get_fill_color(get_cell_xf)
120
120
  end
121
121
 
122
122
  def horizontal_alignment
@@ -48,8 +48,8 @@ module RubyXL
48
48
  end
49
49
 
50
50
  hls_color.h = (g - b) / delta if (r == max)
51
- hls_color.h = 2.0 + (b - r) / delta if (g == max)
52
- hls_color.h = 4.0 + (r - g) / delta if (b == max)
51
+ hls_color.h = 2.0 + ((b - r) / delta) if (g == max)
52
+ hls_color.h = 4.0 + ((r - g) / delta) if (b == max)
53
53
 
54
54
  hls_color.h *= 60;
55
55
  hls_color.h += 360 if hls_color.h < 0
@@ -95,7 +95,7 @@ module RubyXL
95
95
  t1 = l + s - (l * s)
96
96
  end
97
97
 
98
- t2 = 2.0 * l - t1;
98
+ t2 = (2.0 * l) - t1;
99
99
  h = self.h / 360.0
100
100
 
101
101
  t_r = h + (1.0 / 3.0)
@@ -124,11 +124,11 @@ module RubyXL
124
124
  t3 -= 1.0 if (t3 > 1)
125
125
 
126
126
  if (6.0 * t3 < 1) then
127
- color = t2 + (t1 - t2) * 6.0 * t3;
127
+ color = t2 + ((t1 - t2) * 6.0 * t3);
128
128
  elsif (2.0 * t3 < 1) then
129
129
  color = t1;
130
130
  elsif (3.0 * t3 < 2) then
131
- color = t2 + (t1 - t2) * ((2.0 / 3.0) - t3) * 6.0;
131
+ color = t2 + ((t1 - t2) * ((2.0 / 3.0) - t3) * 6.0);
132
132
  else
133
133
  color = t2;
134
134
  end
@@ -143,7 +143,7 @@ module RubyXL
143
143
  if tint < 0 then
144
144
  self.l = l * (1.0 + tint);
145
145
  else
146
- self.l = l * (1.0 - tint) + tint;
146
+ self.l = (l * (1.0 - tint)) + tint;
147
147
  end
148
148
 
149
149
  self
@@ -21,11 +21,7 @@ module RubyXL
21
21
  end
22
22
 
23
23
  def get_fill_color(xf)
24
- fill = fills[xf.fill_id]
25
- pattern = fill && fill.pattern_fill
26
- color = pattern && pattern.fg_color
27
- color = color && color.get_rgb(self)
28
- color && color.to_s || 'ffffff'
24
+ fills[xf.fill_id]&.pattern_fill&.fg_color&.get_rgb(self)&.to_s || 'ffffff'
29
25
  end
30
26
 
31
27
  def register_new_fill(new_fill, old_xf)
@@ -206,10 +206,10 @@ module RubyXL
206
206
  validate_nonnegative(column_index)
207
207
 
208
208
  # Delete column
209
- sheet_data.rows.each { |row| row && row.cells.delete_at(column_index) }
209
+ sheet_data.rows.each { |row| row&.cells&.delete_at(column_index) }
210
210
 
211
211
  # Update column numbers for cells to the right of the deleted column
212
- sheet_data.rows.each_with_index { |row, row_index|
212
+ sheet_data.rows.each { |row|
213
213
  next if row.nil?
214
214
  row.cells.each_with_index { |c, ci|
215
215
  c.column = ci if c.is_a?(Cell)
@@ -280,7 +280,7 @@ module RubyXL
280
280
  validate_workbook
281
281
  validate_nonnegative(row)
282
282
  row = sheet_data.rows[row]
283
- row && row.ht || RubyXL::Row::DEFAULT_HEIGHT
283
+ (row && row.ht) || RubyXL::Row::DEFAULT_HEIGHT
284
284
  end
285
285
 
286
286
  def get_row_border(row, border_direction)
@@ -382,7 +382,7 @@ module RubyXL
382
382
  # Get column width measured in number of digits, as per
383
383
  # http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column%28v=office.14%29.aspx
384
384
  def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)
385
- change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)
385
+ change_column_width_raw(column_index, RubyXL::ColumnRange::chars2raw(width_in_chars))
386
386
  end
387
387
 
388
388
  # Helper method to get the style index for a column
@@ -689,12 +689,32 @@ module RubyXL
689
689
  end
690
690
 
691
691
  # Merges cells within a rectangular area
692
- def merge_cells(start_row, start_col, end_row, end_col)
692
+ # #merge_cells(row_from, col_from, row_to, col_to)
693
+ # #merge_cells(reference_string)
694
+ # #merge_cells(row_from:, row_to:, col_from:, col_to:)
695
+ def merge_cells(*params)
693
696
  validate_workbook
694
697
 
698
+ row_from = col_from = row_to = col_to = nil
699
+ case params.size
700
+ when 4 then row_from, col_from, row_to, col_to = params
701
+ when 1 then
702
+ case params.first
703
+ when Hash then
704
+ row_from, row_to, col_from, col_to = params.first.fetch_values(:row_from, :row_to, :col_from, :col_to)
705
+ when String then
706
+ from, to = params[0].split(':')
707
+ raise ArgumentError.new("reference for merging cells must be a range") if to.nil?
708
+ row_from, col_from = RubyXL::Reference.ref2ind(from)
709
+ row_to, col_to = RubyXL::Reference.ref2ind(to)
710
+ else
711
+ raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
712
+ end
713
+ end
714
+
695
715
  self.merged_cells ||= RubyXL::MergedCells.new
696
716
  # TODO: add validation to make sure ranges are not intersecting with existing ones
697
- merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(start_row, end_row, start_col, end_col))
717
+ merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(row_from, row_to, col_from, col_to))
698
718
  end
699
719
 
700
720
  def add_validation_list(ref, list_arr)
@@ -4,7 +4,7 @@ require 'rubyXL/objects/simple_types'
4
4
  module RubyXL
5
5
  # http://www.datypic.com/sc/ooxml/e-ssml_color-4.html
6
6
  class Color < OOXMLObject
7
- COLOR_REGEXP = /\A([a-f]|[A-F]|[0-9]){6}\Z/
7
+ COLOR_REGEXP = /\A(?:[a-f0-9]{6}|[a-f0-9]{8})\Z/i
8
8
 
9
9
  define_attribute(:auto, :bool)
10
10
  define_attribute(:indexed, :uint)
@@ -17,21 +17,25 @@ module RubyXL
17
17
 
18
18
  def delete_column(col_index)
19
19
  col = col_index + 1
20
- self.min -=1 if min >= col
21
- self.max -=1 if max >= col
20
+ self.min -= 1 if min >= col
21
+ self.max -= 1 if max >= col
22
22
  end
23
23
 
24
24
  def insert_column(col_index)
25
25
  col = col_index + 1
26
- self.min +=1 if min >= col
27
- self.max +=1 if max >= col - 1
26
+ self.min += 1 if min >= col
27
+ self.max += 1 if max >= col - 1
28
28
  end
29
29
 
30
30
  def include?(col_index)
31
- ((min-1)..(max-1)).include?(col_index)
31
+ ((min - 1)..(max - 1)).include?(col_index)
32
32
  end
33
33
 
34
- DEFAULT_WIDTH = 9
34
+ def self.chars2raw(width_in_chars)
35
+ ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0
36
+ end
37
+
38
+ DEFAULT_WIDTH = 8
35
39
  end
36
40
 
37
41
  class ColumnRanges < OOXMLContainerObject
@@ -47,7 +51,7 @@ module RubyXL
47
51
  old_range = self.locate_range(col_index)
48
52
 
49
53
  if old_range.nil? then
50
- new_range = RubyXL::ColumnRange.new
54
+ new_range = RubyXL::ColumnRange.new(width: RubyXL::ColumnRange.chars2raw(RubyXL::ColumnRange::DEFAULT_WIDTH))
51
55
  else
52
56
  if old_range.min == col_num && old_range.max == col_num then
53
57
  return old_range # Single column range, OK to change in place
@@ -58,9 +62,9 @@ module RubyXL
58
62
  new_range = old_range.dup
59
63
  old_range.max -= 1
60
64
  else
61
- range_before = old_range.dup
62
- range_before.max = col_index # col_num - 1
63
- self << range_before
65
+ prior_range = old_range.dup
66
+ prior_range.max = col_index # col_num - 1
67
+ self << prior_range
64
68
 
65
69
  old_range.min = col_num + 1
66
70
 
@@ -82,8 +86,8 @@ module RubyXL
82
86
  end
83
87
 
84
88
  def before_write_xml
85
- self.sort_by!{ |r| r.min }
86
- !(self.empty?)
89
+ self.sort_by!(&:min)
90
+ !self.empty?
87
91
  end
88
92
  end
89
93
  end
@@ -69,6 +69,7 @@ module RubyXL
69
69
  when RubyXL::Chartsheet then chartsheets += 1
70
70
  end
71
71
  }
72
+
72
73
  add_parts_count('Worksheets', worksheets) if worksheets > 0
73
74
  add_parts_count('Charts', chartsheets) if chartsheets > 0
74
75
 
@@ -55,11 +55,19 @@ module RubyXL
55
55
  define_element_name 'sheetDataSet'
56
56
  end
57
57
 
58
+ # https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/452524b4-b22f-45a9-aac1-81fdd1f1db6c
59
+ class AlternateUrls < OOXMLObject
60
+ define_attribute(:absoluteUrl, :string, :required => false)
61
+ define_attribute(:relativeUrl, :string, :required => false)
62
+ define_element_name 'xxl21:alternateUrls'
63
+ end
64
+
58
65
  # http://www.datypic.com/sc/ooxml/e-ssml_externalBook-1.html
59
66
  class ExternalBook < OOXMLObject
60
67
  define_child_node(RubyXL::SheetNames)
61
68
  define_child_node(RubyXL::DefinedNamesExt)
62
69
  define_child_node(RubyXL::SheetDataSet)
70
+ define_child_node(RubyXL::AlternateUrls)
63
71
  define_relationship(:required => true)
64
72
  define_element_name 'externalBook'
65
73
  end
@@ -21,7 +21,7 @@ module RubyXL
21
21
  # Defines an attribute of OOXML object.
22
22
  # === Parameters
23
23
  # * +attribute_name+ - Name of the element attribute as seen in the source XML. Can be either <tt>"String"</tt> or <tt>:Symbol</tt>
24
- # * Special attibute name <tt>'_'</tt> (underscore) denotes the value of the element rather than attribute.
24
+ # * Special attribute name <tt>'_'</tt> (underscore) denotes the value of the element rather than attribute.
25
25
  # * +attribute_type+ - Specifies the conversion type for the attribute when parsing. Available options are:
26
26
  # * +:int+ - <tt>Integer</tt>
27
27
  # * +:uint+ - Unsigned <tt>Integer</tt>
@@ -123,7 +123,9 @@ module RubyXL
123
123
  end
124
124
 
125
125
  obj = self.new
126
- obj.local_namespaces = node.namespace_definitions
126
+ hsh = {}
127
+ node.namespace_definitions.each { |ns| hsh[ns.href] = ns.prefix }
128
+ obj.local_namespaces = hsh
127
129
 
128
130
  known_attributes = obtain_class_variable(:@@ooxml_attributes)
129
131
 
@@ -149,8 +151,9 @@ module RubyXL
149
151
 
150
152
  node.element_children.each { |child_node|
151
153
  ns = child_node.namespace
152
- prefix = if known_namespaces.has_key?(ns.href) then known_namespaces[ns.href]
153
- else ns.prefix
154
+
155
+ prefix = if known_namespaces.has_key?(ns&.href) then known_namespaces[ns&.href]
156
+ else ns&.prefix
154
157
  end
155
158
 
156
159
  child_node_name = case prefix
@@ -254,8 +257,8 @@ module RubyXL
254
257
 
255
258
  def ==(other)
256
259
  other.is_a?(self.class) &&
257
- obtain_class_variable(:@@ooxml_attributes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) } &&
258
- obtain_class_variable(:@@ooxml_child_nodes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) }
260
+ obtain_class_variable(:@@ooxml_attributes).all? { |_k, v| self.send(v[:accessor]) == other.send(v[:accessor]) } &&
261
+ obtain_class_variable(:@@ooxml_child_nodes).all? { |_k, v| self.send(v[:accessor]) == other.send(v[:accessor]) }
259
262
  end
260
263
 
261
264
  # Recursively write the OOXML object and all its children out as Nokogiri::XML. Immediately before the actual
@@ -312,12 +315,11 @@ module RubyXL
312
315
  element_text = attrs.delete('_')
313
316
  elem = xml.create_element(node_name_override || obtain_class_variable(:@@ooxml_tag_name), attrs, element_text)
314
317
 
315
- if @local_namespaces.nil? || @local_namespaces.empty? then # If no local namespaces provided in the original document,
316
- # use the defaults
317
- obtain_class_variable(:@@ooxml_namespaces).each_pair { |k, v| elem.add_namespace_definition(v, k) }
318
- else # otherwise preserve the original ones
319
- @local_namespaces.each { |ns| elem.add_namespace_definition(ns.prefix, ns.href) }
320
- end
318
+ # First, populate namespaces from the original document
319
+ @local_namespaces&.each_pair { |href, prefix| elem.add_namespace_definition(prefix, href) }
320
+
321
+ # Then, add defaults. Note that if some namespace prefix was already set, Nokogiri will NOT change that namespace.
322
+ obtain_class_variable(:@@ooxml_namespaces).each_pair { |href, prefix| elem.add_namespace_definition(prefix, href) }
321
323
 
322
324
  child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
323
325
  child_nodes.each_pair { |child_node_name, child_node_params|
@@ -355,7 +357,7 @@ module RubyXL
355
357
  def before_write_xml
356
358
  #TODO# This will go away once containers are fully implemented.
357
359
  child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
358
- child_nodes.each_pair { |child_node_name, child_node_params|
360
+ child_nodes.each_pair { |_child_node_name, child_node_params|
359
361
  self.count = self.send(child_node_params[:accessor]).size if child_node_params[:is_array] == :with_count
360
362
  }
361
363
  true
@@ -369,7 +371,7 @@ module RubyXL
369
371
  include OOXMLObjectInstanceMethods
370
372
  end
371
373
 
372
- # Parent class for OOXML conainer objects (for example,
374
+ # Parent class for OOXML container objects (for example,
373
375
  # <tt>&lt;fonts&gt;&lt;font&gt;...&lt;/font&gt;&lt;font&gt;...&lt;/font&gt;&lt;/fonts&gt;</tt>
374
376
  # that obscures the top-level container, allowing direct access to the contents as +Array+.
375
377
  class OOXMLContainerObject < Array
@@ -25,7 +25,8 @@ module RubyXL
25
25
 
26
26
  # http://www.datypic.com/sc/ooxml/e-ssml_queryTableFields-1.html
27
27
  class QueryTableFields < OOXMLObject
28
- define_child_node(RubyXL::QueryTableField, :collection => :with_count, :accessor => :fields, :node_name => :queryTableField)
28
+ define_child_node(RubyXL::QueryTableField, :collection => :with_count,
29
+ :accessor => :fields, :node_name => :queryTableField)
29
30
  define_element_name 'queryTableFields'
30
31
  end
31
32
 
@@ -38,7 +39,8 @@ module RubyXL
38
39
 
39
40
  # http://www.datypic.com/sc/ooxml/e-ssml_queryTableDeletedFields-1.html
40
41
  class QueryTableDeletedFields < OOXMLObject
41
- define_child_node(RubyXL::QueryTableDeletedField, :collection => :with_count, :accessor => :deleted_fields, :node_name => :deletedField)
42
+ define_child_node(RubyXL::QueryTableDeletedField, :collection => :with_count,
43
+ :accessor => :deleted_fields, :node_name => :deletedField)
42
44
  define_element_name 'queryTableDeletedFields'
43
45
  end
44
46
 
@@ -1,6 +1,6 @@
1
1
  module RubyXL
2
2
  class Reference
3
- ROW_MAX = 1024*1024
3
+ ROW_MAX = 1024 * 1024
4
4
  COL_MAX = 16393
5
5
 
6
6
  attr_reader :row_range, :col_range
@@ -8,6 +8,7 @@ module RubyXL
8
8
  # RubyXL::Reference.new(row, col)
9
9
  # RubyXL::Reference.new(row_from, row_to, col_from, col_to)
10
10
  # RubyXL::Reference.new(reference_string)
11
+ # RubyXL::Reference.new(row_from:, row_to:, col_from:, col_to:)
11
12
  def initialize(*params)
12
13
  row_from = row_to = col_from = col_to = nil
13
14
 
@@ -15,10 +16,16 @@ module RubyXL
15
16
  when 4 then row_from, row_to, col_from, col_to = params
16
17
  when 2 then row_from, col_from = params
17
18
  when 1 then
18
- raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
19
- from, to = params[0].split(':')
20
- row_from, col_from = self.class.ref2ind(from)
21
- row_to, col_to = self.class.ref2ind(to) unless to.nil?
19
+ case params.first
20
+ when Hash then
21
+ row_from, row_to, col_from, col_to = params.first.fetch_values(:row_from, :row_to, :col_from, :col_to)
22
+ when String then
23
+ from, to = params[0].split(':')
24
+ row_from, col_from = self.class.ref2ind(from)
25
+ row_to, col_to = self.class.ref2ind(to) unless to.nil?
26
+ else
27
+ raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String)
28
+ end
22
29
  end
23
30
 
24
31
  @row_range = Range.new(row_from || 0, row_to || row_from || ROW_MAX)
@@ -54,15 +61,18 @@ module RubyXL
54
61
  end
55
62
 
56
63
  def cover?(other)
57
- !other.nil? && (@row_range.cover?(other.row_range.begin) && @row_range.cover?(other.row_range.end) &&
58
- @col_range.cover?(other.col_range.begin) && @col_range.cover?(other.col_range.end))
64
+ !other.nil? && (@row_range.cover?(other.row_range.begin) &&
65
+ @row_range.cover?(other.row_range.end) &&
66
+ @col_range.cover?(other.col_range.begin) &&
67
+ @col_range.cover?(other.col_range.end))
59
68
  end
60
69
 
61
70
  def to_s
62
71
  if single_cell? then
63
72
  self.class.ind2ref(@row_range.begin, @col_range.begin)
64
73
  else
65
- self.class.ind2ref(@row_range.begin, @col_range.begin) + ':' + self.class.ind2ref(@row_range.end, @col_range.end)
74
+ self.class.ind2ref(@row_range.begin, @col_range.begin) + ':' +
75
+ self.class.ind2ref(@row_range.end, @col_range.end)
66
76
  end
67
77
  end
68
78
 
@@ -92,7 +102,8 @@ module RubyXL
92
102
  # Converts Excel-style cell reference to +row+ and +col+ zero-based indices.
93
103
  def self.ref2ind(str)
94
104
  return [ -1, -1 ] unless str =~ /\A([A-Z]+)(\d+)\Z/
95
- [ Regexp.last_match(2).to_i - 1, Regexp.last_match(1).each_byte.inject(0) { |col, chr| col * 26 + (chr - 64) } - 1 ]
105
+ [ Regexp.last_match(2).to_i - 1,
106
+ Regexp.last_match(1).each_byte.inject(0) { |col, chr| (col * 26) + (chr - 64) } - 1 ]
96
107
  end
97
108
  end
98
109
 
@@ -102,7 +113,7 @@ module RubyXL
102
113
  end
103
114
 
104
115
  def to_s
105
- self.collect{ |ref| ref.to_s }.join(' ')
116
+ self.collect(&:to_s).join(' ')
106
117
  end
107
118
  end
108
119
  end
@@ -95,7 +95,7 @@ module RubyXL
95
95
  self.related_files[rel.id] = obj
96
96
  }
97
97
 
98
- @@debug_indent -=2 if @@debug_indent
98
+ @@debug_indent -= 2 if @@debug_indent
99
99
 
100
100
  related_files
101
101
  end
@@ -20,7 +20,7 @@ module RubyXL
20
20
  super
21
21
  # So far, going by the structure that the original creator had in mind. However,
22
22
  # since the actual implementation is now extracted into a separate class,
23
- # we will be able to transparrently change it later if needs be.
23
+ # we will be able to transparently change it later if needs be.
24
24
  @index_by_content = {}
25
25
  end
26
26