rubyXL 3.3.29 → 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 (466) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +60 -0
  3. data/.rubocop.yml +124 -0
  4. data/CHANGELOG.md +12 -0
  5. data/Gemfile +11 -8
  6. data/LICENSE.txt +1 -1
  7. data/README.rdoc +57 -19
  8. data/Rakefile +29 -29
  9. data/VERSION +1 -1
  10. data/lib/rubyXL/cell.rb +2 -29
  11. data/lib/rubyXL/convenience_methods/cell.rb +276 -0
  12. data/lib/rubyXL/convenience_methods/color.rb +156 -0
  13. data/lib/rubyXL/convenience_methods/font.rb +63 -0
  14. data/lib/rubyXL/convenience_methods/workbook.rb +137 -0
  15. data/lib/rubyXL/convenience_methods/worksheet.rb +734 -0
  16. data/lib/rubyXL/convenience_methods.rb +5 -1122
  17. data/lib/rubyXL/objects/border.rb +0 -3
  18. data/lib/rubyXL/objects/calculation_chain.rb +2 -2
  19. data/lib/rubyXL/objects/cell_style.rb +4 -6
  20. data/lib/rubyXL/objects/chartsheet.rb +8 -12
  21. data/lib/rubyXL/objects/color.rb +4 -6
  22. data/lib/rubyXL/objects/column_range.rb +16 -15
  23. data/lib/rubyXL/objects/comments.rb +1 -4
  24. data/lib/rubyXL/objects/connection.rb +175 -0
  25. data/lib/rubyXL/objects/container_nodes.rb +1 -5
  26. data/lib/rubyXL/objects/content_types.rb +3 -6
  27. data/lib/rubyXL/objects/data_validation.rb +2 -2
  28. data/lib/rubyXL/objects/document_properties.rb +12 -15
  29. data/lib/rubyXL/objects/extensions.rb +0 -2
  30. data/lib/rubyXL/objects/external_links.rb +38 -8
  31. data/lib/rubyXL/objects/fill.rb +2 -5
  32. data/lib/rubyXL/objects/filters.rb +5 -7
  33. data/lib/rubyXL/objects/font.rb +2 -7
  34. data/lib/rubyXL/objects/formula.rb +3 -5
  35. data/lib/rubyXL/objects/ooxml_object.rb +40 -31
  36. data/lib/rubyXL/objects/query_table.rb +106 -0
  37. data/lib/rubyXL/objects/reference.rb +26 -17
  38. data/lib/rubyXL/objects/relationships.rb +14 -14
  39. data/lib/rubyXL/objects/root.rb +0 -2
  40. data/lib/rubyXL/objects/shared_strings.rb +4 -7
  41. data/lib/rubyXL/objects/sheet_common.rb +1 -3
  42. data/lib/rubyXL/objects/sheet_data.rb +44 -17
  43. data/lib/rubyXL/objects/simple_types.rb +19 -2
  44. data/lib/rubyXL/objects/storage.rb +60 -49
  45. data/lib/rubyXL/objects/stylesheet.rb +9 -17
  46. data/lib/rubyXL/objects/text.rb +6 -8
  47. data/lib/rubyXL/objects/theme.rb +23 -9
  48. data/lib/rubyXL/objects/workbook.rb +144 -36
  49. data/lib/rubyXL/objects/worksheet.rb +48 -34
  50. data/lib/rubyXL/parser.rb +1 -3
  51. data/lib/rubyXL/worksheet.rb +86 -86
  52. data/lib/rubyXL.rb +1 -1
  53. data/rdoc/README_rdoc.html +212 -153
  54. data/rdoc/RubyXL/AExtension.html +33 -69
  55. data/rdoc/RubyXL/AExtensionStorageArea.html +12 -18
  56. data/rdoc/RubyXL/ActiveX.html +26 -52
  57. data/rdoc/RubyXL/ActiveXBinary.html +12 -23
  58. data/rdoc/RubyXL/AdjustHandleList.html +13 -20
  59. data/rdoc/RubyXL/Alignment.html +13 -20
  60. data/rdoc/RubyXL/AlternateContent.html +12 -18
  61. data/rdoc/RubyXL/AlternateUrls.html +99 -0
  62. data/rdoc/RubyXL/Authors.html +13 -20
  63. data/rdoc/RubyXL/AutoFilter.html +13 -20
  64. data/rdoc/RubyXL/AutoFilterColumn.html +13 -20
  65. data/rdoc/RubyXL/BinaryImageFile.html +12 -26
  66. data/rdoc/RubyXL/BodyProperties.html +13 -20
  67. data/rdoc/RubyXL/BooleanNode.html +12 -18
  68. data/rdoc/RubyXL/BooleanValue.html +12 -18
  69. data/rdoc/RubyXL/Border.html +49 -101
  70. data/rdoc/RubyXL/BorderEdge.html +32 -61
  71. data/rdoc/RubyXL/Borders.html +25 -44
  72. data/rdoc/RubyXL/Break.html +13 -20
  73. data/rdoc/RubyXL/BreakList.html +13 -20
  74. data/rdoc/RubyXL/CT_AdjPoint2D.html +13 -20
  75. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +13 -20
  76. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +13 -20
  77. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +13 -20
  78. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +13 -20
  79. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +13 -20
  80. data/rdoc/RubyXL/CT_Backdrop.html +13 -20
  81. data/rdoc/RubyXL/CT_Bevel.html +13 -20
  82. data/rdoc/RubyXL/CT_BiLevelEffect.html +13 -20
  83. data/rdoc/RubyXL/CT_BlendEffect.html +13 -20
  84. data/rdoc/RubyXL/CT_Blip.html +13 -20
  85. data/rdoc/RubyXL/CT_BlipFillProperties.html +13 -20
  86. data/rdoc/RubyXL/CT_BlurEffect.html +13 -20
  87. data/rdoc/RubyXL/CT_Camera.html +13 -20
  88. data/rdoc/RubyXL/CT_Color.html +13 -20
  89. data/rdoc/RubyXL/CT_ColorChangeEffect.html +13 -20
  90. data/rdoc/RubyXL/CT_ColorMapping.html +13 -20
  91. data/rdoc/RubyXL/CT_ColorScheme.html +13 -20
  92. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +13 -20
  93. data/rdoc/RubyXL/CT_ConnectionSite.html +13 -20
  94. data/rdoc/RubyXL/CT_ConnectionSiteList.html +13 -20
  95. data/rdoc/RubyXL/CT_DashStop.html +13 -20
  96. data/rdoc/RubyXL/CT_DashStopList.html +13 -20
  97. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +13 -20
  98. data/rdoc/RubyXL/CT_DuotoneEffect.html +13 -20
  99. data/rdoc/RubyXL/CT_EffectContainer.html +13 -20
  100. data/rdoc/RubyXL/CT_EffectList.html +13 -20
  101. data/rdoc/RubyXL/CT_EffectReference.html +13 -20
  102. data/rdoc/RubyXL/CT_EffectStyleItem.html +13 -20
  103. data/rdoc/RubyXL/CT_EffectStyleList.html +13 -20
  104. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +13 -20
  105. data/rdoc/RubyXL/CT_FillEffect.html +13 -20
  106. data/rdoc/RubyXL/CT_FillOverlayEffect.html +13 -20
  107. data/rdoc/RubyXL/CT_FillStyleList.html +13 -20
  108. data/rdoc/RubyXL/CT_FlatText.html +13 -20
  109. data/rdoc/RubyXL/CT_FontCollection.html +13 -20
  110. data/rdoc/RubyXL/CT_FontReference.html +13 -20
  111. data/rdoc/RubyXL/CT_GeomGuideList.html +13 -20
  112. data/rdoc/RubyXL/CT_GlowEffect.html +13 -20
  113. data/rdoc/RubyXL/CT_GradientFillProperties.html +13 -20
  114. data/rdoc/RubyXL/CT_GradientStop.html +13 -20
  115. data/rdoc/RubyXL/CT_GradientStopList.html +13 -20
  116. data/rdoc/RubyXL/CT_HSLEffect.html +13 -20
  117. data/rdoc/RubyXL/CT_HslColor.html +13 -20
  118. data/rdoc/RubyXL/CT_Hyperlink.html +13 -20
  119. data/rdoc/RubyXL/CT_InnerShadowEffect.html +13 -20
  120. data/rdoc/RubyXL/CT_LightRig.html +13 -20
  121. data/rdoc/RubyXL/CT_LineEndProperties.html +13 -20
  122. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +13 -20
  123. data/rdoc/RubyXL/CT_LineProperties.html +13 -20
  124. data/rdoc/RubyXL/CT_LineStyleList.html +13 -20
  125. data/rdoc/RubyXL/CT_LinearShadeProperties.html +13 -20
  126. data/rdoc/RubyXL/CT_LuminanceEffect.html +13 -20
  127. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +13 -20
  128. data/rdoc/RubyXL/CT_OuterShadowEffect.html +13 -20
  129. data/rdoc/RubyXL/CT_Path2D.html +13 -20
  130. data/rdoc/RubyXL/CT_Path2DArcTo.html +13 -20
  131. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +13 -20
  132. data/rdoc/RubyXL/CT_Path2DList.html +13 -20
  133. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +13 -20
  134. data/rdoc/RubyXL/CT_Path2DTo.html +13 -20
  135. data/rdoc/RubyXL/CT_PathShadeProperties.html +13 -20
  136. data/rdoc/RubyXL/CT_PatternFillProperties.html +13 -20
  137. data/rdoc/RubyXL/CT_Point3D.html +13 -20
  138. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +13 -20
  139. data/rdoc/RubyXL/CT_PresetColor.html +13 -20
  140. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +13 -20
  141. data/rdoc/RubyXL/CT_PresetShadowEffect.html +13 -20
  142. data/rdoc/RubyXL/CT_PresetTextShape.html +13 -20
  143. data/rdoc/RubyXL/CT_ReflectionEffect.html +13 -20
  144. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +13 -20
  145. data/rdoc/RubyXL/CT_RelativeRect.html +13 -20
  146. data/rdoc/RubyXL/CT_SRgbColor.html +13 -20
  147. data/rdoc/RubyXL/CT_ScRgbColor.html +13 -20
  148. data/rdoc/RubyXL/CT_Scene3D.html +13 -20
  149. data/rdoc/RubyXL/CT_SchemeColor.html +13 -20
  150. data/rdoc/RubyXL/CT_Shape3D.html +13 -20
  151. data/rdoc/RubyXL/CT_ShapeStyle.html +13 -20
  152. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +13 -20
  153. data/rdoc/RubyXL/CT_SphereCoords.html +13 -20
  154. data/rdoc/RubyXL/CT_StretchInfoProperties.html +13 -20
  155. data/rdoc/RubyXL/CT_StyleMatrix.html +13 -20
  156. data/rdoc/RubyXL/CT_StyleMatrixReference.html +13 -20
  157. data/rdoc/RubyXL/CT_SupplementalFont.html +13 -20
  158. data/rdoc/RubyXL/CT_SystemColor.html +13 -20
  159. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +13 -20
  160. data/rdoc/RubyXL/CT_TextBlipBullet.html +13 -20
  161. data/rdoc/RubyXL/CT_TextCharBullet.html +13 -20
  162. data/rdoc/RubyXL/CT_TextCharacterProperties.html +13 -20
  163. data/rdoc/RubyXL/CT_TextFont.html +13 -20
  164. data/rdoc/RubyXL/CT_TextListStyle.html +13 -20
  165. data/rdoc/RubyXL/CT_TextNormalAutofit.html +13 -20
  166. data/rdoc/RubyXL/CT_TextParagraphProperties.html +13 -20
  167. data/rdoc/RubyXL/CT_TextSpacing.html +13 -20
  168. data/rdoc/RubyXL/CT_TextTabStop.html +13 -20
  169. data/rdoc/RubyXL/CT_TextTabStopList.html +13 -20
  170. data/rdoc/RubyXL/CT_TileInfoProperties.html +13 -20
  171. data/rdoc/RubyXL/CT_TintEffect.html +13 -20
  172. data/rdoc/RubyXL/CT_Transform2D.html +13 -20
  173. data/rdoc/RubyXL/CT_TransformEffect.html +13 -20
  174. data/rdoc/RubyXL/CT_Vector3D.html +13 -20
  175. data/rdoc/RubyXL/CT_XYAdjustHandle.html +13 -20
  176. data/rdoc/RubyXL/CalculationChain.html +23 -50
  177. data/rdoc/RubyXL/CalculationChainCell.html +13 -20
  178. data/rdoc/RubyXL/CalculationProperties.html +13 -20
  179. data/rdoc/RubyXL/Cell.html +210 -258
  180. data/rdoc/RubyXL/CellConvenienceMethods.html +438 -572
  181. data/rdoc/RubyXL/CellExt.html +13 -20
  182. data/rdoc/RubyXL/CellSmartTag.html +13 -20
  183. data/rdoc/RubyXL/CellSmartTagProperty.html +13 -20
  184. data/rdoc/RubyXL/CellSmartTags.html +13 -20
  185. data/rdoc/RubyXL/CellStyle.html +13 -20
  186. data/rdoc/RubyXL/CellStyleXFs.html +25 -44
  187. data/rdoc/RubyXL/CellStyles.html +25 -44
  188. data/rdoc/RubyXL/CellValue.html +24 -43
  189. data/rdoc/RubyXL/CellWatch.html +13 -20
  190. data/rdoc/RubyXL/CellWatches.html +13 -20
  191. data/rdoc/RubyXL/CellXFs.html +26 -48
  192. data/rdoc/RubyXL/ChartColorsFile.html +12 -26
  193. data/rdoc/RubyXL/ChartFile.html +25 -54
  194. data/rdoc/RubyXL/ChartStyleFile.html +12 -26
  195. data/rdoc/RubyXL/ChartUserShapesFile.html +12 -26
  196. data/rdoc/RubyXL/Chartsheet.html +26 -73
  197. data/rdoc/RubyXL/ChartsheetPageSetup.html +13 -20
  198. data/rdoc/RubyXL/ChartsheetProperties.html +13 -20
  199. data/rdoc/RubyXL/ChartsheetProtection.html +13 -20
  200. data/rdoc/RubyXL/ChartsheetView.html +13 -20
  201. data/rdoc/RubyXL/ChartsheetViews.html +13 -20
  202. data/rdoc/RubyXL/Color.html +24 -48
  203. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +246 -0
  204. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +285 -0
  205. data/rdoc/RubyXL/ColorConvenienceClasses.html +91 -0
  206. data/rdoc/RubyXL/ColorConvenienceMethods.html +139 -0
  207. data/rdoc/RubyXL/ColorFilter.html +13 -20
  208. data/rdoc/RubyXL/ColorScale.html +13 -20
  209. data/rdoc/RubyXL/ColorSet.html +13 -20
  210. data/rdoc/RubyXL/Colors.html +13 -20
  211. data/rdoc/RubyXL/ColumnRange.html +76 -91
  212. data/rdoc/RubyXL/ColumnRanges.html +54 -106
  213. data/rdoc/RubyXL/Comment.html +13 -20
  214. data/rdoc/RubyXL/CommentList.html +13 -20
  215. data/rdoc/RubyXL/CommentsFile.html +24 -56
  216. data/rdoc/RubyXL/ConditionalFormatValue.html +13 -20
  217. data/rdoc/RubyXL/ConditionalFormatting.html +13 -20
  218. data/rdoc/RubyXL/ConditionalFormattingRule.html +13 -20
  219. data/rdoc/RubyXL/Connection.html +99 -0
  220. data/rdoc/RubyXL/ConnectionTable.html +99 -0
  221. data/rdoc/RubyXL/ConnectionTables.html +99 -0
  222. data/rdoc/RubyXL/ConnectionTextField.html +99 -0
  223. data/rdoc/RubyXL/ConnectionTextFields.html +99 -0
  224. data/rdoc/RubyXL/Connections.html +149 -0
  225. data/rdoc/RubyXL/ContentTypeDefault.html +12 -18
  226. data/rdoc/RubyXL/ContentTypeOverride.html +12 -18
  227. data/rdoc/RubyXL/ContentTypes.html +35 -72
  228. data/rdoc/RubyXL/ControlPropertiesFile.html +14 -23
  229. data/rdoc/RubyXL/CorePropertiesFile.html +89 -208
  230. data/rdoc/RubyXL/CustomColor.html +13 -20
  231. data/rdoc/RubyXL/CustomColorList.html +13 -20
  232. data/rdoc/RubyXL/CustomFilter.html +13 -20
  233. data/rdoc/RubyXL/CustomFilters.html +13 -20
  234. data/rdoc/RubyXL/CustomGeometry.html +13 -20
  235. data/rdoc/RubyXL/CustomProperties.html +13 -20
  236. data/rdoc/RubyXL/CustomPropertiesFile.html +12 -26
  237. data/rdoc/RubyXL/CustomProperty.html +13 -20
  238. data/rdoc/RubyXL/CustomPropertyFile.html +108 -0
  239. data/rdoc/RubyXL/CustomSheetView.html +13 -20
  240. data/rdoc/RubyXL/CustomSheetViews.html +13 -20
  241. data/rdoc/RubyXL/CustomWorkbookView.html +13 -20
  242. data/rdoc/RubyXL/CustomWorkbookViews.html +13 -20
  243. data/rdoc/RubyXL/CustomXMLFile.html +12 -23
  244. data/rdoc/RubyXL/DXF.html +13 -20
  245. data/rdoc/RubyXL/DXFs.html +13 -20
  246. data/rdoc/RubyXL/DataBar.html +13 -20
  247. data/rdoc/RubyXL/DataConsolidate.html +13 -20
  248. data/rdoc/RubyXL/DataConsolidationReference.html +13 -20
  249. data/rdoc/RubyXL/DataConsolidationReferences.html +13 -20
  250. data/rdoc/RubyXL/DataType.html +11 -40
  251. data/rdoc/RubyXL/DataValidation.html +13 -20
  252. data/rdoc/RubyXL/DataValidations.html +13 -20
  253. data/rdoc/RubyXL/DateGroupItem.html +13 -20
  254. data/rdoc/RubyXL/DefinedName.html +13 -20
  255. data/rdoc/RubyXL/DefinedNameExt.html +13 -20
  256. data/rdoc/RubyXL/DefinedNames.html +13 -20
  257. data/rdoc/RubyXL/DefinedNamesExt.html +13 -20
  258. data/rdoc/RubyXL/DocumentPropertiesFile.html +34 -76
  259. data/rdoc/RubyXL/DrawingFile.html +25 -54
  260. data/rdoc/RubyXL/DynamicFilter.html +13 -20
  261. data/rdoc/RubyXL/EmbeddedControl.html +13 -20
  262. data/rdoc/RubyXL/EmbeddedControls.html +13 -20
  263. data/rdoc/RubyXL/Extension.html +13 -20
  264. data/rdoc/RubyXL/ExtensionStorageArea.html +13 -20
  265. data/rdoc/RubyXL/Extents.html +13 -20
  266. data/rdoc/RubyXL/ExternalBook.html +13 -20
  267. data/rdoc/RubyXL/ExternalLinksFile.html +25 -54
  268. data/rdoc/RubyXL/ExternalReference.html +13 -20
  269. data/rdoc/RubyXL/ExternalReferences.html +13 -20
  270. data/rdoc/RubyXL/ExtraColorSchemeList.html +13 -20
  271. data/rdoc/RubyXL/FieldItem.html +13 -20
  272. data/rdoc/RubyXL/FileRecoveryProperties.html +13 -20
  273. data/rdoc/RubyXL/FileSharing.html +13 -20
  274. data/rdoc/RubyXL/FileVersion.html +13 -20
  275. data/rdoc/RubyXL/Fill.html +25 -44
  276. data/rdoc/RubyXL/Fills.html +25 -44
  277. data/rdoc/RubyXL/FilterContainer.html +13 -20
  278. data/rdoc/RubyXL/FloatNode.html +12 -18
  279. data/rdoc/RubyXL/FloatValue.html +12 -18
  280. data/rdoc/RubyXL/Font.html +28 -64
  281. data/rdoc/RubyXL/FontConvenienceMethods.html +133 -294
  282. data/rdoc/RubyXL/FontScheme.html +13 -20
  283. data/rdoc/RubyXL/Fonts.html +25 -44
  284. data/rdoc/RubyXL/Formula.html +13 -20
  285. data/rdoc/RubyXL/FunctionGroup.html +13 -20
  286. data/rdoc/RubyXL/FunctionGroups.html +13 -20
  287. data/rdoc/RubyXL/GenericStorageObject.html +41 -98
  288. data/rdoc/RubyXL/GradientFill.html +13 -20
  289. data/rdoc/RubyXL/HeaderFooterSettings.html +13 -20
  290. data/rdoc/RubyXL/Hyperlink.html +13 -20
  291. data/rdoc/RubyXL/HyperlinkRelFile.html +12 -23
  292. data/rdoc/RubyXL/Hyperlinks.html +13 -20
  293. data/rdoc/RubyXL/IconFilter.html +13 -20
  294. data/rdoc/RubyXL/IconSet.html +13 -20
  295. data/rdoc/RubyXL/IgnoredError.html +13 -20
  296. data/rdoc/RubyXL/IgnoredErrors.html +13 -20
  297. data/rdoc/RubyXL/IndexedColors.html +13 -20
  298. data/rdoc/RubyXL/InputCells.html +13 -20
  299. data/rdoc/RubyXL/IntegerNode.html +12 -18
  300. data/rdoc/RubyXL/IntegerValue.html +12 -18
  301. data/rdoc/RubyXL/LegacyCell.html +20 -71
  302. data/rdoc/RubyXL/LegacyWorksheet.html +77 -126
  303. data/rdoc/RubyXL/MRUColors.html +13 -20
  304. data/rdoc/RubyXL/MacrosFile.html +12 -26
  305. data/rdoc/RubyXL/MergedCell.html +13 -20
  306. data/rdoc/RubyXL/MergedCells.html +13 -20
  307. data/rdoc/RubyXL/NumFmt.html +13 -20
  308. data/rdoc/RubyXL/NumberFormat.html +25 -44
  309. data/rdoc/RubyXL/NumberFormats.html +25 -50
  310. data/rdoc/RubyXL/OLEObject.html +13 -20
  311. data/rdoc/RubyXL/OLEObjectFile.html +12 -26
  312. data/rdoc/RubyXL/OLEObjects.html +13 -20
  313. data/rdoc/RubyXL/OLESize.html +13 -20
  314. data/rdoc/RubyXL/OOXMLContainerObject.html +72 -157
  315. data/rdoc/RubyXL/OOXMLIgnored.html +32 -62
  316. data/rdoc/RubyXL/OOXMLObject.html +15 -26
  317. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +126 -203
  318. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +104 -226
  319. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +109 -242
  320. data/rdoc/RubyXL/OOXMLTopLevelObject.html +67 -154
  321. data/rdoc/RubyXL/OdbcOleDbProperties.html +99 -0
  322. data/rdoc/RubyXL/Offset.html +13 -20
  323. data/rdoc/RubyXL/OlapProperties.html +99 -0
  324. data/rdoc/RubyXL/OleItem.html +99 -0
  325. data/rdoc/RubyXL/OleItems.html +99 -0
  326. data/rdoc/RubyXL/OleLink.html +99 -0
  327. data/rdoc/RubyXL/OutlineProperties.html +13 -20
  328. data/rdoc/RubyXL/PageMargins.html +13 -20
  329. data/rdoc/RubyXL/PageSetup.html +13 -20
  330. data/rdoc/RubyXL/PageSetupProperties.html +13 -20
  331. data/rdoc/RubyXL/Pane.html +13 -20
  332. data/rdoc/RubyXL/Parser.html +35 -65
  333. data/rdoc/RubyXL/PatternFill.html +13 -20
  334. data/rdoc/RubyXL/PersonMetadata.html +108 -0
  335. data/rdoc/RubyXL/PhoneticProperties.html +13 -20
  336. data/rdoc/RubyXL/PhoneticRun.html +13 -20
  337. data/rdoc/RubyXL/PivotArea.html +13 -20
  338. data/rdoc/RubyXL/PivotCache.html +13 -20
  339. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +14 -31
  340. data/rdoc/RubyXL/PivotCacheRecordsFile.html +12 -26
  341. data/rdoc/RubyXL/PivotCaches.html +13 -20
  342. data/rdoc/RubyXL/PivotReference.html +13 -20
  343. data/rdoc/RubyXL/PivotReferences.html +13 -20
  344. data/rdoc/RubyXL/PivotTableFile.html +14 -31
  345. data/rdoc/RubyXL/PivotTableSelection.html +13 -20
  346. data/rdoc/RubyXL/PresetGeometry.html +13 -20
  347. data/rdoc/RubyXL/PrintOptions.html +13 -20
  348. data/rdoc/RubyXL/PrinterSettingsFile.html +12 -26
  349. data/rdoc/RubyXL/ProtectedRange.html +13 -20
  350. data/rdoc/RubyXL/ProtectedRanges.html +13 -20
  351. data/rdoc/RubyXL/Protection.html +13 -20
  352. data/rdoc/RubyXL/QueryParameter.html +99 -0
  353. data/rdoc/RubyXL/QueryParameters.html +99 -0
  354. data/rdoc/RubyXL/QueryTable.html +157 -0
  355. data/rdoc/RubyXL/QueryTableDeletedField.html +99 -0
  356. data/rdoc/RubyXL/QueryTableDeletedFields.html +99 -0
  357. data/rdoc/RubyXL/QueryTableField.html +99 -0
  358. data/rdoc/RubyXL/QueryTableFields.html +99 -0
  359. data/rdoc/RubyXL/QueryTableRefresh.html +99 -0
  360. data/rdoc/RubyXL/RID.html +12 -18
  361. data/rdoc/RubyXL/RawOOXML.html +33 -69
  362. data/rdoc/RubyXL/Reference.html +156 -286
  363. data/rdoc/RubyXL/Relationship.html +12 -18
  364. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +20 -37
  365. data/rdoc/RubyXL/RelationshipSupport.html +62 -145
  366. data/rdoc/RubyXL/RevisionPointer.html +13 -23
  367. data/rdoc/RubyXL/RichText.html +27 -45
  368. data/rdoc/RubyXL/RichTextRun.html +24 -43
  369. data/rdoc/RubyXL/Row.html +88 -205
  370. data/rdoc/RubyXL/RowExt.html +13 -20
  371. data/rdoc/RubyXL/RunProperties.html +13 -20
  372. data/rdoc/RubyXL/Scenario.html +13 -20
  373. data/rdoc/RubyXL/Scenarios.html +13 -20
  374. data/rdoc/RubyXL/Selection.html +23 -42
  375. data/rdoc/RubyXL/ShapeGuide.html +13 -20
  376. data/rdoc/RubyXL/ShapeTextRectangle.html +13 -20
  377. data/rdoc/RubyXL/SharedStringsTable.html +81 -177
  378. data/rdoc/RubyXL/Sheet.html +13 -20
  379. data/rdoc/RubyXL/SheetCalculationProperties.html +13 -20
  380. data/rdoc/RubyXL/SheetData.html +32 -62
  381. data/rdoc/RubyXL/SheetDataExt.html +13 -20
  382. data/rdoc/RubyXL/SheetDataSet.html +13 -20
  383. data/rdoc/RubyXL/SheetMetadata.html +108 -0
  384. data/rdoc/RubyXL/SheetName.html +13 -20
  385. data/rdoc/RubyXL/SheetNames.html +13 -20
  386. data/rdoc/RubyXL/Sheets.html +13 -20
  387. data/rdoc/RubyXL/SlicerCacheFile.html +12 -26
  388. data/rdoc/RubyXL/SlicerFile.html +12 -26
  389. data/rdoc/RubyXL/SmartTagProperties.html +13 -20
  390. data/rdoc/RubyXL/SmartTagType.html +13 -20
  391. data/rdoc/RubyXL/SmartTagTypes.html +13 -20
  392. data/rdoc/RubyXL/SmartTags.html +13 -20
  393. data/rdoc/RubyXL/SortCondition.html +13 -20
  394. data/rdoc/RubyXL/SortState.html +13 -20
  395. data/rdoc/RubyXL/Sqref.html +33 -63
  396. data/rdoc/RubyXL/Stop.html +13 -20
  397. data/rdoc/RubyXL/StringNode.html +12 -18
  398. data/rdoc/RubyXL/StringNodeW3C.html +33 -63
  399. data/rdoc/RubyXL/StringValue.html +12 -18
  400. data/rdoc/RubyXL/Stylesheet.html +65 -138
  401. data/rdoc/RubyXL/TableFile.html +12 -26
  402. data/rdoc/RubyXL/TableParts.html +12 -18
  403. data/rdoc/RubyXL/TableStyle.html +13 -20
  404. data/rdoc/RubyXL/TableStyles.html +13 -20
  405. data/rdoc/RubyXL/Text.html +35 -76
  406. data/rdoc/RubyXL/TextImportSettings.html +99 -0
  407. data/rdoc/RubyXL/Theme.html +72 -72
  408. data/rdoc/RubyXL/ThemeElements.html +13 -20
  409. data/rdoc/RubyXL/ThumbnailFile.html +12 -26
  410. data/rdoc/RubyXL/Top10.html +13 -20
  411. data/rdoc/RubyXL/VMLDrawingFile.html +15 -33
  412. data/rdoc/RubyXL/Variant.html +13 -20
  413. data/rdoc/RubyXL/Vector.html +24 -43
  414. data/rdoc/RubyXL/VectorValue.html +12 -18
  415. data/rdoc/RubyXL/VisualProperties.html +13 -20
  416. data/rdoc/RubyXL/WebPublishObject.html +13 -20
  417. data/rdoc/RubyXL/WebPublishObjects.html +13 -20
  418. data/rdoc/RubyXL/WebPublishingItem.html +13 -20
  419. data/rdoc/RubyXL/WebPublishingItems.html +13 -20
  420. data/rdoc/RubyXL/WebPublishingProperties.html +13 -20
  421. data/rdoc/RubyXL/WebQueryProperties.html +99 -0
  422. data/rdoc/RubyXL/Workbook.html +581 -266
  423. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +226 -951
  424. data/rdoc/RubyXL/WorkbookProperties.html +13 -20
  425. data/rdoc/RubyXL/WorkbookProtection.html +13 -20
  426. data/rdoc/RubyXL/WorkbookRoot.html +58 -135
  427. data/rdoc/RubyXL/WorkbookView.html +13 -20
  428. data/rdoc/RubyXL/WorkbookViews.html +13 -20
  429. data/rdoc/RubyXL/Worksheet.html +122 -137
  430. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +717 -1373
  431. data/rdoc/RubyXL/WorksheetDimensions.html +13 -20
  432. data/rdoc/RubyXL/WorksheetFormatProperties.html +12 -18
  433. data/rdoc/RubyXL/WorksheetProperties.html +13 -20
  434. data/rdoc/RubyXL/WorksheetProtection.html +13 -20
  435. data/rdoc/RubyXL/WorksheetView.html +13 -20
  436. data/rdoc/RubyXL/WorksheetViews.html +13 -20
  437. data/rdoc/RubyXL/XF.html +13 -20
  438. data/rdoc/RubyXL.html +46 -306
  439. data/rdoc/created.rid +45 -38
  440. data/rdoc/css/rdoc.css +109 -12
  441. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  442. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  443. data/rdoc/index.html +403 -726
  444. data/rdoc/js/darkfish.js +33 -97
  445. data/rdoc/js/navigation.js +12 -49
  446. data/rdoc/js/navigation.js.gz +0 -0
  447. data/rdoc/js/search.js +35 -34
  448. data/rdoc/js/search_index.js +1 -1
  449. data/rdoc/js/search_index.js.gz +0 -0
  450. data/rdoc/js/searcher.js +6 -6
  451. data/rdoc/js/searcher.js.gz +0 -0
  452. data/rdoc/table_of_contents.html +287 -45
  453. data/rubyXL.gemspec +77 -43
  454. data/spec/lib/cell_spec.rb +119 -6
  455. data/spec/lib/color_spec.rb +9 -1
  456. data/spec/lib/parser_spec.rb +28 -28
  457. data/spec/lib/reference_spec.rb +41 -5
  458. data/spec/lib/rgb_color_spec.rb +29 -0
  459. data/spec/lib/stylesheet_spec.rb +10 -11
  460. data/spec/lib/text_spec.rb +4 -6
  461. data/spec/lib/workbook_spec.rb +31 -8
  462. data/spec/lib/worksheet_spec.rb +886 -480
  463. data/spec/spec_helper.rb +2 -0
  464. data/test/test_parse_write.rb +15 -15
  465. metadata +76 -10
  466. data/rdoc/js/jquery.js +0 -4
@@ -1,5 +1,4 @@
1
1
  module RubyXL
2
-
3
2
  # http://www.datypic.com/sc/ooxml/e-ssml_sheetName-1.html
4
3
  class SheetName < OOXMLObject
5
4
  define_attribute(:val, :string)
@@ -16,7 +15,7 @@ module RubyXL
16
15
  class DefinedNameExt < OOXMLObject
17
16
  define_attribute(:name, :string, :required => true)
18
17
  define_attribute(:refersTo, :string)
19
- define_attribute(:sheetId, :uint)
18
+ define_attribute(:sheetId, :uint)
20
19
  define_element_name 'definedName'
21
20
  end
22
21
 
@@ -56,30 +55,61 @@ module RubyXL
56
55
  define_element_name 'sheetDataSet'
57
56
  end
58
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
+
59
65
  # http://www.datypic.com/sc/ooxml/e-ssml_externalBook-1.html
60
66
  class ExternalBook < OOXMLObject
61
67
  define_child_node(RubyXL::SheetNames)
62
68
  define_child_node(RubyXL::DefinedNamesExt)
63
69
  define_child_node(RubyXL::SheetDataSet)
64
- define_attribute(:'r:id', :string, :required => true)
70
+ define_child_node(RubyXL::AlternateUrls)
71
+ define_relationship(:required => true)
65
72
  define_element_name 'externalBook'
66
73
  end
67
74
 
75
+ # http://www.datypic.com/sc/ooxml/e-ssml_oleItem-1.html
76
+ class OleItem < OOXMLObject
77
+ define_attribute(:name, :string, :required => true)
78
+ define_attribute(:icon, :bool)
79
+ define_attribute(:advise, :bool)
80
+ define_attribute(:preferPic, :bool)
81
+ define_element_name 'oleItem'
82
+ end
83
+
84
+ # http://www.datypic.com/sc/ooxml/e-ssml_oleItems-1.html
85
+ class OleItems < OOXMLContainerObject
86
+ define_child_node(RubyXL::OleItem)
87
+ define_element_name 'oleItems'
88
+ end
89
+
90
+ # http://www.datypic.com/sc/ooxml/t-ssml_CT_OleLink.html
91
+ class OleLink < OOXMLObject
92
+ define_child_node(RubyXL::OleItems, :collection => true)
93
+ define_relationship(:required => true)
94
+ define_attribute(:progId, :string, :required => true)
95
+ define_element_name 'oleLink'
96
+ end
97
+
68
98
  class ExternalLinksFile < OOXMLTopLevelObject
69
- CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml'
70
- REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink'
99
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml'.freeze
100
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink'.freeze
71
101
 
72
102
  include RubyXL::RelationshipSupport
73
103
  define_child_node(RubyXL::ExternalBook)
104
+ define_child_node(RubyXL::OleLink)
74
105
 
75
106
  define_element_name 'externalLink'
76
- set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
77
- 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
107
+ set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
108
+ 'http://schemas.openxmlformats.org/markup-compatibility/2006' => 'mc',
78
109
  'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r')
79
110
 
80
111
  def xlsx_path
81
112
  ROOT.join('xl', 'externalLinks', "externalLink#{file_index}.xml")
82
113
  end
83
114
  end
84
-
85
115
  end
@@ -2,7 +2,6 @@ require 'rubyXL/objects/ooxml_object'
2
2
  require 'rubyXL/objects/simple_types'
3
3
 
4
4
  module RubyXL
5
-
6
5
  # http://www.datypic.com/sc/ooxml/e-ssml_stop-1.html
7
6
  class Stop < OOXMLObject
8
7
  define_attribute(:position, :double, :required => true)
@@ -13,8 +12,8 @@ module RubyXL
13
12
  # http://www.datypic.com/sc/ooxml/e-ssml_patternFill-1.html
14
13
  class PatternFill < OOXMLObject
15
14
  define_attribute(:patternType, RubyXL::ST_PatternType)
16
- define_child_node(RubyXL::Color, :node_name => :fgColor )
17
- define_child_node(RubyXL::Color, :node_name => :bgColor )
15
+ define_child_node(RubyXL::Color, :node_name => :fgColor)
16
+ define_child_node(RubyXL::Color, :node_name => :bgColor)
18
17
  define_element_name 'patternFill'
19
18
  end
20
19
 
@@ -39,7 +38,6 @@ module RubyXL
39
38
  def self.default(pattern_type)
40
39
  self.new(:pattern_fill => RubyXL::PatternFill.new(:pattern_type => pattern_type))
41
40
  end
42
-
43
41
  end
44
42
 
45
43
  # http://www.datypic.com/sc/ooxml/e-ssml_fills-1.html
@@ -51,5 +49,4 @@ module RubyXL
51
49
  self.new(:_ => [ RubyXL::Fill.default('none'), RubyXL::Fill.default('gray125') ])
52
50
  end
53
51
  end
54
-
55
52
  end
@@ -3,7 +3,6 @@ require 'rubyXL/objects/simple_types'
3
3
  require 'rubyXL/objects/extensions'
4
4
 
5
5
  module RubyXL
6
-
7
6
  # http://www.datypic.com/sc/ooxml/e-ssml_dateGroupItem-1.html
8
7
  class DateGroupItem < OOXMLObject
9
8
  define_attribute(:year, :int, :required => true)
@@ -18,7 +17,7 @@ module RubyXL
18
17
 
19
18
  # http://www.datypic.com/sc/ooxml/e-ssml_filters-1.html
20
19
  class FilterContainer < OOXMLObject
21
- define_attribute(:blank, :bool, :default => false)
20
+ define_attribute(:blank, :bool, :default => false)
22
21
  define_attribute(:calendarType, RubyXL::ST_CalendarType, :default => 'none')
23
22
  define_child_node(RubyXL::StringValue, :collection => true, :accessor => :filters, :node_name => :filter)
24
23
  define_child_node(RubyXL::DateGroupItem, :collection => true, :accessor => :date_group_items)
@@ -43,7 +42,7 @@ module RubyXL
43
42
 
44
43
  # http://www.datypic.com/sc/ooxml/e-ssml_customFilters-1.html
45
44
  class CustomFilters < OOXMLContainerObject
46
- define_attribute(:and, :bool, :default => false)
45
+ define_attribute(:and, :bool, :default => false)
47
46
  define_child_node(RubyXL::CustomFilter, :collection => true)
48
47
  define_element_name 'customFilters'
49
48
  end
@@ -87,9 +86,9 @@ module RubyXL
87
86
 
88
87
  # http://www.datypic.com/sc/ooxml/e-ssml_sortCondition-1.html
89
88
  class SortCondition < OOXMLObject
90
- define_attribute(:descending, :bool, :default => false)
89
+ define_attribute(:descending, :bool, :default => false)
91
90
  define_attribute(:sortBy, RubyXL::ST_SortBy, :default => 'value')
92
- define_attribute(:ref, :ref, :required => true)
91
+ define_attribute(:ref, :ref, :required => true)
93
92
  define_attribute(:customList, :string)
94
93
  define_attribute(:dxfId, :int)
95
94
  define_attribute(:iconSet, RubyXL::ST_IconSetType, :required => true, :default => '3Arrows')
@@ -116,5 +115,4 @@ module RubyXL
116
115
  define_child_node(RubyXL::ExtensionStorageArea)
117
116
  define_element_name 'autoFilter'
118
117
  end
119
-
120
- end
118
+ end
@@ -1,10 +1,8 @@
1
1
  require 'rubyXL/objects/ooxml_object'
2
2
  require 'rubyXL/objects/container_nodes'
3
3
  require 'rubyXL/objects/color'
4
- require 'rubyXL/convenience_methods'
5
4
 
6
5
  module RubyXL
7
-
8
6
  # http://www.datypic.com/sc/ooxml/e-ssml_font-1.html
9
7
  class Font < OOXMLObject
10
8
  # Since we have no capability to load the actual fonts, we'll have to live with the default.
@@ -22,17 +20,15 @@ module RubyXL
22
20
  define_child_node(RubyXL::BooleanValue, :node_name => :extend)
23
21
  define_child_node(RubyXL::Color)
24
22
  define_child_node(RubyXL::FloatValue, :node_name => :sz)
25
- define_child_node(RubyXL::BooleanValue, :node_name => :u)
23
+ define_child_node(RubyXL::StringValue, :node_name => :u) # ST_UnderlineValues (http://www.datypic.com/sc/ooxml/e-ssml_u-1.html)
26
24
  define_child_node(RubyXL::StringValue, :node_name => :vertAlign)
27
25
  define_child_node(RubyXL::StringValue, :node_name => :scheme)
28
26
  define_element_name 'font'
29
27
 
30
28
  def self.default(size = 10)
31
29
  self.new(:name => RubyXL::StringValue.new(:val => 'Verdana'),
32
- :sz => RubyXL::FloatValue.new(:val => size) )
30
+ :sz => RubyXL::FloatValue.new(:val => size))
33
31
  end
34
-
35
- include FontConvenienceMethods
36
32
  end
37
33
 
38
34
  # http://www.datypic.com/sc/ooxml/e-ssml_fonts-1.html
@@ -44,5 +40,4 @@ module RubyXL
44
40
  self.new(:_ => [ RubyXL::Font.default(10), RubyXL::Font.default(8) ])
45
41
  end
46
42
  end
47
-
48
43
  end
@@ -2,12 +2,11 @@ require 'rubyXL/objects/ooxml_object'
2
2
  require 'rubyXL/objects/simple_types'
3
3
 
4
4
  module RubyXL
5
-
6
5
  # http://www.datypic.com/sc/ooxml/e-ssml_f-1.html
7
6
  class Formula < OOXMLObject
8
7
  define_attribute(:_, :string, :accessor => :expression)
9
8
  define_attribute(:t, RubyXL::ST_CellFormulaType, :default => 'normal')
10
- define_attribute(:aca, :bool, :default => false)
9
+ define_attribute(:aca, :bool, :default => false)
11
10
  define_attribute(:ref, :ref)
12
11
  define_attribute(:dt2D, :bool, :default => false)
13
12
  define_attribute(:dtr, :bool, :default => false)
@@ -15,10 +14,9 @@ module RubyXL
15
14
  define_attribute(:del2, :bool, :default => false)
16
15
  define_attribute(:r1, :ref)
17
16
  define_attribute(:r2, :ref)
18
- define_attribute(:ca, :bool, :default => false)
17
+ define_attribute(:ca, :bool, :default => false)
19
18
  define_attribute(:si, :int)
20
- define_attribute(:bx, :bool, :default => false)
19
+ define_attribute(:bx, :bool, :default => false)
21
20
  define_element_name 'f'
22
21
  end
23
-
24
22
  end
@@ -12,16 +12,16 @@ module RubyXL
12
12
  # addressing variable by name creates it in the context of defining class, while calling
13
13
  # the setter/getter method addresses it in the context of descendant class,
14
14
  # which is what we need.
15
- def obtain_class_variable(var_name, default = {})
15
+ def obtain_class_variable(var_name, default = nil)
16
16
  self.class_variable_get(var_name)
17
17
  rescue NameError
18
- self.class_variable_set(var_name, default)
18
+ self.class_variable_set(var_name, default || {})
19
19
  end
20
20
 
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>
@@ -45,14 +45,20 @@ module RubyXL
45
45
  # The value of the element will be accessible as a <tt>String</tt> by calling +obj.expression+
46
46
  # define_attribute(:errorStyle, %w{ stop warning information }, :default => 'stop',)
47
47
  # A <tt>String</tt> attribute named 'errorStyle' will be accessible as +obj.error_style+, valid values are <tt>"stop"</tt>, <tt>"warning"</tt>, <tt>"information"</tt>
48
- def define_attribute(attr_name, attr_type, extra_params = {})
48
+ def define_attribute(attr_name, attr_type, extra_params = nil)
49
49
  attrs = obtain_class_variable(:@@ooxml_attributes)
50
- attr_hash = extra_params.merge({ :attr_type => attr_type })
50
+ attr_hash = { :attr_type => attr_type }
51
+ attr_hash.merge!(extra_params) if extra_params
51
52
  attr_hash[:accessor] ||= accessorize(attr_name)
52
53
  attrs[attr_name.to_s] = attr_hash
53
54
  self.send(:attr_accessor, attr_hash[:accessor]) unless attr_hash[:computed]
54
55
  end
55
56
 
57
+ # Defines a `r:id` attribute
58
+ def define_relationship(extra_params = {})
59
+ define_attribute(:'r:id', :string, extra_params)
60
+ end
61
+
56
62
  # Defines a child node of OOXML object.
57
63
  # === Parameters
58
64
  # * +klass+ - Class (descendant of RubyXL::OOXMLObject) of the child nodes. Child node objects will be produced by calling +parse+ method of that class.
@@ -79,7 +85,7 @@ module RubyXL
79
85
  accessor = (extra_params[:accessor] || accessorize(child_node_name)).to_sym
80
86
 
81
87
  child_nodes[child_node_name] = {
82
- :class => klass,
88
+ :class => klass,
83
89
  :is_array => extra_params[:collection],
84
90
  :accessor => accessor
85
91
  }
@@ -117,7 +123,9 @@ module RubyXL
117
123
  end
118
124
 
119
125
  obj = self.new
120
- obj.local_namespaces = node.namespace_definitions
126
+ hsh = {}
127
+ node.namespace_definitions.each { |ns| hsh[ns.href] = ns.prefix }
128
+ obj.local_namespaces = hsh
121
129
 
122
130
  known_attributes = obtain_class_variable(:@@ooxml_attributes)
123
131
 
@@ -142,9 +150,11 @@ module RubyXL
142
150
  known_namespaces ||= obtain_class_variable(:@@ooxml_namespaces)
143
151
 
144
152
  node.element_children.each { |child_node|
145
-
146
153
  ns = child_node.namespace
147
- prefix = known_namespaces[ns.href] || ns.prefix
154
+
155
+ prefix = if known_namespaces.has_key?(ns&.href) then known_namespaces[ns&.href]
156
+ else ns&.prefix
157
+ end
148
158
 
149
159
  child_node_name = case prefix
150
160
  when '', nil then child_node.name
@@ -178,21 +188,21 @@ module RubyXL
178
188
  private
179
189
  def accessorize(str)
180
190
  acc = str.to_s.dup
181
- acc.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
182
- acc.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
183
- acc.gsub!(':','_')
191
+ acc.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
192
+ acc.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
193
+ acc.gsub!(':', '_')
184
194
  acc.downcase.to_sym
185
195
  end
186
196
 
187
197
  def process_attribute(obj, raw_value, params)
188
198
  val = raw_value &&
189
199
  case params[:attr_type]
190
- when :double then Float(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_double.html
200
+ when :double then Float(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_double.html
191
201
  when :string then raw_value
192
202
  when Array then raw_value # Case of Simple Types
193
203
  when :sqref then RubyXL::Sqref.new(raw_value)
194
204
  when :ref then RubyXL::Reference.new(raw_value)
195
- when :bool then ['1', 'true'].include?(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_boolean.html
205
+ when :bool then ['1', 'true'].include?(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_boolean.html
196
206
  when :int then Integer(raw_value)
197
207
  when :uint then
198
208
  v = Integer(raw_value)
@@ -201,7 +211,6 @@ module RubyXL
201
211
  end
202
212
  obj.send("#{params[:accessor]}=", val)
203
213
  end
204
-
205
214
  end
206
215
 
207
216
 
@@ -217,8 +226,9 @@ module RubyXL
217
226
  end
218
227
  private :obtain_class_variable
219
228
 
220
- def initialize(params = {})
229
+ def initialize(params = nil)
221
230
  @local_namespaces = nil
231
+ params ||= {}
222
232
 
223
233
  obtain_class_variable(:@@ooxml_attributes).each_value { |v|
224
234
  instance_variable_set("@#{v[:accessor]}", params[v[:accessor]]) unless v[:computed]
@@ -229,7 +239,6 @@ module RubyXL
229
239
 
230
240
  def init_child_nodes(params)
231
241
  obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
232
-
233
242
  initial_value =
234
243
  if params.has_key?(v[:accessor]) then params[v[:accessor]]
235
244
  elsif v[:is_array] then []
@@ -248,8 +257,8 @@ module RubyXL
248
257
 
249
258
  def ==(other)
250
259
  other.is_a?(self.class) &&
251
- obtain_class_variable(:@@ooxml_attributes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) } &&
252
- 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]) }
253
262
  end
254
263
 
255
264
  # Recursively write the OOXML object and all its children out as Nokogiri::XML. Immediately before the actual
@@ -270,6 +279,11 @@ module RubyXL
270
279
  if xml.nil? then
271
280
  seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
272
281
  seed_xml.encoding = 'UTF-8'
282
+
283
+ if Nokogiri.jruby? then # Issue 188 workaround for JRuby
284
+ seed_xml.to_java.strict_error_checking = false
285
+ end
286
+
273
287
  result = self.write_xml(seed_xml)
274
288
  return result if result == ''
275
289
  seed_xml << result
@@ -301,12 +315,11 @@ module RubyXL
301
315
  element_text = attrs.delete('_')
302
316
  elem = xml.create_element(node_name_override || obtain_class_variable(:@@ooxml_tag_name), attrs, element_text)
303
317
 
304
- if @local_namespaces.nil? || @local_namespaces.empty? then # If no local namespaces provided in the original document,
305
- # use the defaults
306
- obtain_class_variable(:@@ooxml_namespaces).each_pair { |k, v| elem.add_namespace_definition(v, k) }
307
- else # otherwise preserve the original ones
308
- @local_namespaces.each { |ns| elem.add_namespace_definition(ns.prefix, ns.href) }
309
- 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) }
310
323
 
311
324
  child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
312
325
  child_nodes.each_pair { |child_node_name, child_node_params|
@@ -344,12 +357,11 @@ module RubyXL
344
357
  def before_write_xml
345
358
  #TODO# This will go away once containers are fully implemented.
346
359
  child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
347
- child_nodes.each_pair { |child_node_name, child_node_params|
360
+ child_nodes.each_pair { |_child_node_name, child_node_params|
348
361
  self.count = self.send(child_node_params[:accessor]).size if child_node_params[:is_array] == :with_count
349
362
  }
350
363
  true
351
364
  end
352
-
353
365
  end
354
366
 
355
367
  # Parent class for defining OOXML based objects (not unlike Rails' +ActiveRecord+!)
@@ -359,7 +371,7 @@ module RubyXL
359
371
  include OOXMLObjectInstanceMethods
360
372
  end
361
373
 
362
- # Parent class for OOXML conainer objects (for example,
374
+ # Parent class for OOXML container objects (for example,
363
375
  # <tt>&lt;fonts&gt;&lt;font&gt;...&lt;/font&gt;&lt;font&gt;...&lt;/font&gt;&lt;/fonts&gt;</tt>
364
376
  # that obscures the top-level container, allowing direct access to the contents as +Array+.
365
377
  class OOXMLContainerObject < Array
@@ -403,7 +415,6 @@ module RubyXL
403
415
  end
404
416
  protected :define_count_attribute
405
417
  end
406
-
407
418
  end
408
419
 
409
420
  # Extension class providing functionality for top-level OOXML objects that are represented by
@@ -454,7 +465,5 @@ module RubyXL
454
465
  def file_index
455
466
  root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
456
467
  end
457
-
458
468
  end
459
-
460
469
  end
@@ -0,0 +1,106 @@
1
+ require 'rubyXL/objects/ooxml_object'
2
+ require 'rubyXL/objects/simple_types'
3
+ require 'rubyXL/objects/extensions'
4
+ require 'rubyXL/objects/relationships'
5
+ require 'rubyXL/objects/sheet_common'
6
+
7
+ # Query Tables
8
+ # https://msdn.microsoft.com/en-us/library/hh643563(v=office.12).aspx
9
+
10
+ module RubyXL
11
+ # http://www.datypic.com/sc/ooxml/e-ssml_queryTableField-1.html
12
+ class QueryTableField < OOXMLObject
13
+ define_attribute(:id, :uint, :required => true)
14
+ define_attribute(:name, RubyXL::ST_Xstring)
15
+ define_attribute(:dataBound, :bool, :default => true)
16
+ define_attribute(:rowNumbers, :bool, :default => false)
17
+ define_attribute(:fillFormulas, :bool, :default => false)
18
+ define_attribute(:clipped, :bool, :default => false)
19
+ define_attribute(:tableColumnId, :uint, :default => 0)
20
+
21
+ define_child_node(RubyXL::ExtensionStorageArea)
22
+
23
+ define_element_name 'queryTableField'
24
+ end
25
+
26
+ # http://www.datypic.com/sc/ooxml/e-ssml_queryTableFields-1.html
27
+ class QueryTableFields < OOXMLObject
28
+ define_child_node(RubyXL::QueryTableField, :collection => :with_count,
29
+ :accessor => :fields, :node_name => :queryTableField)
30
+ define_element_name 'queryTableFields'
31
+ end
32
+
33
+ # http://www.datypic.com/sc/ooxml/e-ssml_deletedField-1.html
34
+ class QueryTableDeletedField < OOXMLObject
35
+ define_attribute(:name, RubyXL::ST_Xstring, :required => true)
36
+
37
+ define_element_name 'deletedField'
38
+ end
39
+
40
+ # http://www.datypic.com/sc/ooxml/e-ssml_queryTableDeletedFields-1.html
41
+ class QueryTableDeletedFields < OOXMLObject
42
+ define_child_node(RubyXL::QueryTableDeletedField, :collection => :with_count,
43
+ :accessor => :deleted_fields, :node_name => :deletedField)
44
+ define_element_name 'queryTableDeletedFields'
45
+ end
46
+
47
+ # http://www.datypic.com/sc/ooxml/e-ssml_queryTableRefresh-1.html
48
+ class QueryTableRefresh < OOXMLObject
49
+ define_attribute(:preserveSortFilterLayout, :bool, :default => true)
50
+ define_attribute(:fieldIdWrapped, :bool, :default => false)
51
+ define_attribute(:headersInLastRefresh, :bool, :default => true)
52
+ define_attribute(:minimumVersion, :uint, :default => 0)
53
+ define_attribute(:nextId, :uint, :default => 1)
54
+ define_attribute(:unboundColumnsLeft, :uint, :default => 0)
55
+ define_attribute(:unboundColumnsRight, :uint, :default => 0)
56
+
57
+ define_child_node(RubyXL::QueryTableFields) # [1..1]
58
+ define_child_node(RubyXL::QueryTableDeletedFields)
59
+ define_child_node(RubyXL::SortState)
60
+ define_child_node(RubyXL::ExtensionStorageArea)
61
+
62
+ define_element_name 'queryTableRefresh'
63
+ end
64
+
65
+ # http://www.datypic.com/sc/ooxml/e-ssml_queryTable.html
66
+ class QueryTable < OOXMLTopLevelObject
67
+ CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml'.freeze
68
+ REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable'.freeze
69
+
70
+ include RubyXL::RelationshipSupport
71
+
72
+ define_attribute(:name, RubyXL::ST_Xstring, :required => true)
73
+ define_attribute(:headers, :bool, :default => true)
74
+ define_attribute(:rowNumbers, :bool, :default => false)
75
+ define_attribute(:disableRefresh, :bool, :default => false)
76
+ define_attribute(:backgroundRefresh, :bool, :default => true)
77
+ define_attribute(:firstBackgroundRefresh, :bool, :default => false)
78
+ define_attribute(:refreshOnLoad, :bool, :default => false)
79
+ define_attribute(:growShrinkType, RubyXL::ST_GrowShrinkType, :default => 'insertDelete')
80
+ define_attribute(:fillFormulas, :bool, :default => false)
81
+ define_attribute(:removeDataOnSave, :bool, :default => false)
82
+ define_attribute(:disableEdit, :bool, :default => false)
83
+ define_attribute(:preserveFormatting, :bool, :default => true)
84
+ define_attribute(:adjustColumnWidth, :bool, :default => true)
85
+ define_attribute(:intermediate, :bool, :default => false)
86
+ define_attribute(:connectionId, :uint, :required => true)
87
+ define_attribute(:autoFormatId, :uint)
88
+ define_attribute(:applyNumberFormats, :bool)
89
+ define_attribute(:applyBorderFormats, :bool)
90
+ define_attribute(:applyFontFormats, :bool)
91
+ define_attribute(:applyPatternFormats, :bool)
92
+ define_attribute(:applyAlignmentFormats, :bool)
93
+ define_attribute(:applyWidthHeightFormats, :bool)
94
+
95
+ define_child_node(RubyXL::QueryTableRefresh)
96
+ define_child_node(RubyXL::ExtensionStorageArea)
97
+
98
+ define_element_name 'queryTable'
99
+ set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => nil,
100
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r')
101
+
102
+ def xlsx_path
103
+ ROOT.join('xl', 'queryTables', "queryTable#{file_index}.xml")
104
+ end
105
+ end
106
+ end
@@ -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)
@@ -29,6 +36,10 @@ module RubyXL
29
36
  (@row_range.begin == @row_range.end) && (@col_range.begin == @col_range.end)
30
37
  end
31
38
 
39
+ def valid?
40
+ !(row_range.begin.negative? || col_range.begin.negative?)
41
+ end
42
+
32
43
  def first_row
33
44
  @row_range.begin
34
45
  end
@@ -50,15 +61,18 @@ module RubyXL
50
61
  end
51
62
 
52
63
  def cover?(other)
53
- !other.nil? && (@row_range.cover?(other.row_range.begin) && @row_range.cover?(other.row_range.end) &&
54
- @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))
55
68
  end
56
69
 
57
70
  def to_s
58
71
  if single_cell? then
59
72
  self.class.ind2ref(@row_range.begin, @col_range.begin)
60
73
  else
61
- 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)
62
76
  end
63
77
  end
64
78
 
@@ -71,7 +85,7 @@ module RubyXL
71
85
  end
72
86
 
73
87
  # Converts +row+ and +col+ zero-based indices to Excel-style cell reference
74
- # (0) A...Z, AA...AZ, BA... ...ZZ, AAA... ...AZZ, BAA... ...XFD (16383)
88
+ # <0> A...Z, AA...AZ, BA... ...ZZ, AAA... ...AZZ, BAA... ...XFD <16383>
75
89
  def self.ind2ref(row = 0, col = 0)
76
90
  str = ''
77
91
 
@@ -88,23 +102,18 @@ module RubyXL
88
102
  # Converts Excel-style cell reference to +row+ and +col+ zero-based indices.
89
103
  def self.ref2ind(str)
90
104
  return [ -1, -1 ] unless str =~ /\A([A-Z]+)(\d+)\Z/
91
-
92
- col = 0
93
- $1.each_byte { |chr| col = col * 26 + (chr - 64) }
94
- [ $2.to_i - 1, col - 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 ]
95
107
  end
96
-
97
108
  end
98
109
 
99
110
  class Sqref < Array
100
-
101
111
  def initialize(str)
102
112
  str.split.each { |ref_str| self << RubyXL::Reference.new(ref_str) }
103
113
  end
104
114
 
105
115
  def to_s
106
- self.collect{ |ref| ref.to_s }.join(' ')
116
+ self.collect(&:to_s).join(' ')
107
117
  end
108
-
109
118
  end
110
119
  end