rubyXL 3.3.21 → 3.4.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (456) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +60 -0
  3. data/.codeclimate.yml +3 -0
  4. data/Gemfile +3 -2
  5. data/Gemfile.lock +96 -0
  6. data/LICENSE.txt +1 -1
  7. data/README.rdoc +47 -16
  8. data/Rakefile +3 -2
  9. data/VERSION +1 -1
  10. data/lib/rubyXL.rb +1 -0
  11. data/lib/rubyXL/cell.rb +1 -26
  12. data/lib/rubyXL/convenience_methods.rb +5 -982
  13. data/lib/rubyXL/convenience_methods/cell.rb +272 -0
  14. data/lib/rubyXL/convenience_methods/color.rb +160 -0
  15. data/lib/rubyXL/convenience_methods/font.rb +63 -0
  16. data/lib/rubyXL/convenience_methods/workbook.rb +136 -0
  17. data/lib/rubyXL/convenience_methods/worksheet.rb +710 -0
  18. data/lib/rubyXL/objects/border.rb +31 -3
  19. data/lib/rubyXL/objects/calculation_chain.rb +2 -2
  20. data/lib/rubyXL/objects/cell_style.rb +8 -8
  21. data/lib/rubyXL/objects/chartsheet.rb +10 -10
  22. data/lib/rubyXL/objects/color.rb +6 -4
  23. data/lib/rubyXL/objects/column_range.rb +10 -10
  24. data/lib/rubyXL/objects/comments.rb +6 -6
  25. data/lib/rubyXL/objects/connection.rb +175 -0
  26. data/lib/rubyXL/objects/container_nodes.rb +2 -2
  27. data/lib/rubyXL/objects/content_types.rb +2 -2
  28. data/lib/rubyXL/objects/data_validation.rb +4 -2
  29. data/lib/rubyXL/objects/document_properties.rb +3 -3
  30. data/lib/rubyXL/objects/extensions.rb +20 -3
  31. data/lib/rubyXL/objects/external_links.rb +26 -2
  32. data/lib/rubyXL/objects/fill.rb +4 -4
  33. data/lib/rubyXL/objects/filters.rb +12 -12
  34. data/lib/rubyXL/objects/font.rb +2 -60
  35. data/lib/rubyXL/objects/formula.rb +1 -1
  36. data/lib/rubyXL/objects/ooxml_object.rb +15 -3
  37. data/lib/rubyXL/objects/query_table.rb +104 -0
  38. data/lib/rubyXL/objects/relationships.rb +8 -3
  39. data/lib/rubyXL/objects/shared_strings.rb +1 -1
  40. data/lib/rubyXL/objects/sheet_common.rb +4 -4
  41. data/lib/rubyXL/objects/sheet_data.rb +48 -11
  42. data/lib/rubyXL/objects/simple_types.rb +18 -0
  43. data/lib/rubyXL/objects/storage.rb +25 -1
  44. data/lib/rubyXL/objects/stylesheet.rb +14 -14
  45. data/lib/rubyXL/objects/text.rb +8 -8
  46. data/lib/rubyXL/objects/theme.rb +138 -119
  47. data/lib/rubyXL/objects/workbook.rb +153 -43
  48. data/lib/rubyXL/objects/worksheet.rb +118 -107
  49. data/lib/rubyXL/worksheet.rb +19 -13
  50. data/rdoc/README_rdoc.html +109 -103
  51. data/rdoc/RubyXL.html +39 -296
  52. data/rdoc/RubyXL/AExtension.html +21 -60
  53. data/rdoc/RubyXL/AExtensionStorageArea.html +12 -17
  54. data/rdoc/RubyXL/ActiveX.html +154 -0
  55. data/rdoc/RubyXL/ActiveXBinary.html +106 -0
  56. data/rdoc/RubyXL/AdjustHandleList.html +13 -19
  57. data/rdoc/RubyXL/Alignment.html +13 -19
  58. data/rdoc/RubyXL/AlternateContent.html +12 -17
  59. data/rdoc/RubyXL/Authors.html +13 -19
  60. data/rdoc/RubyXL/AutoFilter.html +13 -19
  61. data/rdoc/RubyXL/AutoFilterColumn.html +13 -19
  62. data/rdoc/RubyXL/BinaryImageFile.html +12 -25
  63. data/rdoc/RubyXL/BodyProperties.html +13 -19
  64. data/rdoc/RubyXL/BooleanNode.html +12 -17
  65. data/rdoc/RubyXL/BooleanValue.html +12 -17
  66. data/rdoc/RubyXL/Border.html +76 -53
  67. data/rdoc/RubyXL/BorderEdge.html +71 -17
  68. data/rdoc/RubyXL/Borders.html +19 -39
  69. data/rdoc/RubyXL/Break.html +13 -19
  70. data/rdoc/RubyXL/BreakList.html +13 -19
  71. data/rdoc/RubyXL/CT_AdjPoint2D.html +13 -19
  72. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +13 -19
  73. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +13 -19
  74. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +13 -19
  75. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +13 -19
  76. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +13 -19
  77. data/rdoc/RubyXL/CT_Backdrop.html +13 -19
  78. data/rdoc/RubyXL/CT_Bevel.html +13 -19
  79. data/rdoc/RubyXL/CT_BiLevelEffect.html +13 -19
  80. data/rdoc/RubyXL/CT_BlendEffect.html +13 -19
  81. data/rdoc/RubyXL/CT_Blip.html +13 -19
  82. data/rdoc/RubyXL/CT_BlipFillProperties.html +13 -19
  83. data/rdoc/RubyXL/CT_BlurEffect.html +13 -19
  84. data/rdoc/RubyXL/CT_Camera.html +13 -19
  85. data/rdoc/RubyXL/CT_Color.html +13 -19
  86. data/rdoc/RubyXL/CT_ColorChangeEffect.html +13 -19
  87. data/rdoc/RubyXL/CT_ColorMapping.html +13 -19
  88. data/rdoc/RubyXL/CT_ColorScheme.html +13 -19
  89. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +13 -19
  90. data/rdoc/RubyXL/CT_ConnectionSite.html +13 -19
  91. data/rdoc/RubyXL/CT_ConnectionSiteList.html +13 -19
  92. data/rdoc/RubyXL/CT_DashStop.html +13 -19
  93. data/rdoc/RubyXL/CT_DashStopList.html +13 -19
  94. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +13 -19
  95. data/rdoc/RubyXL/CT_DuotoneEffect.html +13 -19
  96. data/rdoc/RubyXL/CT_EffectContainer.html +13 -19
  97. data/rdoc/RubyXL/CT_EffectList.html +13 -19
  98. data/rdoc/RubyXL/CT_EffectReference.html +13 -19
  99. data/rdoc/RubyXL/CT_EffectStyleItem.html +13 -19
  100. data/rdoc/RubyXL/CT_EffectStyleList.html +13 -19
  101. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +13 -19
  102. data/rdoc/RubyXL/CT_FillEffect.html +13 -19
  103. data/rdoc/RubyXL/CT_FillOverlayEffect.html +13 -19
  104. data/rdoc/RubyXL/CT_FillStyleList.html +13 -19
  105. data/rdoc/RubyXL/CT_FlatText.html +13 -19
  106. data/rdoc/RubyXL/CT_FontCollection.html +13 -19
  107. data/rdoc/RubyXL/CT_FontReference.html +13 -19
  108. data/rdoc/RubyXL/CT_GeomGuideList.html +13 -19
  109. data/rdoc/RubyXL/CT_GlowEffect.html +13 -19
  110. data/rdoc/RubyXL/CT_GradientFillProperties.html +13 -19
  111. data/rdoc/RubyXL/CT_GradientStop.html +13 -19
  112. data/rdoc/RubyXL/CT_GradientStopList.html +13 -19
  113. data/rdoc/RubyXL/CT_HSLEffect.html +13 -19
  114. data/rdoc/RubyXL/CT_HslColor.html +13 -19
  115. data/rdoc/RubyXL/CT_Hyperlink.html +13 -19
  116. data/rdoc/RubyXL/CT_InnerShadowEffect.html +13 -19
  117. data/rdoc/RubyXL/CT_LightRig.html +13 -19
  118. data/rdoc/RubyXL/CT_LineEndProperties.html +13 -19
  119. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +13 -19
  120. data/rdoc/RubyXL/CT_LineProperties.html +13 -19
  121. data/rdoc/RubyXL/CT_LineStyleList.html +13 -19
  122. data/rdoc/RubyXL/CT_LinearShadeProperties.html +13 -19
  123. data/rdoc/RubyXL/CT_LuminanceEffect.html +13 -19
  124. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +13 -19
  125. data/rdoc/RubyXL/CT_OuterShadowEffect.html +13 -19
  126. data/rdoc/RubyXL/CT_Path2D.html +13 -19
  127. data/rdoc/RubyXL/CT_Path2DArcTo.html +13 -19
  128. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +13 -19
  129. data/rdoc/RubyXL/CT_Path2DList.html +13 -19
  130. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +13 -19
  131. data/rdoc/RubyXL/CT_Path2DTo.html +13 -19
  132. data/rdoc/RubyXL/CT_PathShadeProperties.html +13 -19
  133. data/rdoc/RubyXL/CT_PatternFillProperties.html +13 -19
  134. data/rdoc/RubyXL/CT_Point3D.html +13 -19
  135. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +13 -19
  136. data/rdoc/RubyXL/CT_PresetColor.html +13 -19
  137. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +13 -19
  138. data/rdoc/RubyXL/CT_PresetShadowEffect.html +13 -19
  139. data/rdoc/RubyXL/CT_PresetTextShape.html +13 -19
  140. data/rdoc/RubyXL/CT_ReflectionEffect.html +13 -19
  141. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +13 -19
  142. data/rdoc/RubyXL/CT_RelativeRect.html +13 -19
  143. data/rdoc/RubyXL/CT_SRgbColor.html +13 -19
  144. data/rdoc/RubyXL/CT_ScRgbColor.html +13 -19
  145. data/rdoc/RubyXL/CT_Scene3D.html +13 -19
  146. data/rdoc/RubyXL/CT_SchemeColor.html +13 -19
  147. data/rdoc/RubyXL/CT_Shape3D.html +13 -19
  148. data/rdoc/RubyXL/CT_ShapeStyle.html +13 -19
  149. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +13 -19
  150. data/rdoc/RubyXL/CT_SphereCoords.html +13 -19
  151. data/rdoc/RubyXL/CT_StretchInfoProperties.html +13 -19
  152. data/rdoc/RubyXL/CT_StyleMatrix.html +13 -19
  153. data/rdoc/RubyXL/CT_StyleMatrixReference.html +13 -19
  154. data/rdoc/RubyXL/CT_SupplementalFont.html +13 -19
  155. data/rdoc/RubyXL/CT_SystemColor.html +13 -19
  156. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +13 -19
  157. data/rdoc/RubyXL/CT_TextBlipBullet.html +13 -19
  158. data/rdoc/RubyXL/CT_TextCharBullet.html +13 -19
  159. data/rdoc/RubyXL/CT_TextCharacterProperties.html +13 -19
  160. data/rdoc/RubyXL/CT_TextFont.html +13 -19
  161. data/rdoc/RubyXL/CT_TextListStyle.html +13 -19
  162. data/rdoc/RubyXL/CT_TextNormalAutofit.html +13 -19
  163. data/rdoc/RubyXL/CT_TextParagraphProperties.html +13 -19
  164. data/rdoc/RubyXL/CT_TextSpacing.html +13 -19
  165. data/rdoc/RubyXL/CT_TextTabStop.html +13 -19
  166. data/rdoc/RubyXL/CT_TextTabStopList.html +13 -19
  167. data/rdoc/RubyXL/CT_TileInfoProperties.html +13 -19
  168. data/rdoc/RubyXL/CT_TintEffect.html +13 -19
  169. data/rdoc/RubyXL/CT_Transform2D.html +13 -19
  170. data/rdoc/RubyXL/CT_TransformEffect.html +13 -19
  171. data/rdoc/RubyXL/CT_Vector3D.html +13 -19
  172. data/rdoc/RubyXL/CT_XYAdjustHandle.html +13 -19
  173. data/rdoc/RubyXL/CalculationChain.html +17 -45
  174. data/rdoc/RubyXL/CalculationChainCell.html +13 -19
  175. data/rdoc/RubyXL/CalculationProperties.html +13 -19
  176. data/rdoc/RubyXL/Cell.html +144 -204
  177. data/rdoc/RubyXL/CellConvenienceMethods.html +240 -426
  178. data/rdoc/RubyXL/CellExt.html +13 -19
  179. data/rdoc/RubyXL/CellSmartTag.html +13 -19
  180. data/rdoc/RubyXL/CellSmartTagProperty.html +13 -19
  181. data/rdoc/RubyXL/CellSmartTags.html +13 -19
  182. data/rdoc/RubyXL/CellStyle.html +13 -19
  183. data/rdoc/RubyXL/CellStyleXFs.html +18 -38
  184. data/rdoc/RubyXL/CellStyles.html +18 -38
  185. data/rdoc/RubyXL/CellValue.html +18 -38
  186. data/rdoc/RubyXL/CellWatch.html +13 -19
  187. data/rdoc/RubyXL/CellWatches.html +13 -19
  188. data/rdoc/RubyXL/CellXFs.html +19 -39
  189. data/rdoc/RubyXL/ChartColorsFile.html +12 -25
  190. data/rdoc/RubyXL/ChartFile.html +19 -49
  191. data/rdoc/RubyXL/ChartStyleFile.html +12 -25
  192. data/rdoc/RubyXL/ChartUserShapesFile.html +12 -25
  193. data/rdoc/RubyXL/Chartsheet.html +19 -67
  194. data/rdoc/RubyXL/ChartsheetPageSetup.html +13 -19
  195. data/rdoc/RubyXL/ChartsheetProperties.html +13 -19
  196. data/rdoc/RubyXL/ChartsheetProtection.html +13 -19
  197. data/rdoc/RubyXL/ChartsheetView.html +13 -19
  198. data/rdoc/RubyXL/ChartsheetViews.html +13 -19
  199. data/rdoc/RubyXL/Color.html +28 -39
  200. data/rdoc/RubyXL/ColorConvenienceClasses.html +91 -0
  201. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +242 -0
  202. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +279 -0
  203. data/rdoc/RubyXL/ColorConvenienceMethods.html +137 -0
  204. data/rdoc/RubyXL/ColorFilter.html +13 -19
  205. data/rdoc/RubyXL/ColorScale.html +13 -19
  206. data/rdoc/RubyXL/ColorSet.html +13 -19
  207. data/rdoc/RubyXL/Colors.html +13 -19
  208. data/rdoc/RubyXL/ColumnRange.html +20 -71
  209. data/rdoc/RubyXL/ColumnRanges.html +20 -79
  210. data/rdoc/RubyXL/Comment.html +13 -19
  211. data/rdoc/RubyXL/CommentList.html +13 -19
  212. data/rdoc/RubyXL/CommentsFile.html +17 -50
  213. data/rdoc/RubyXL/ConditionalFormatValue.html +13 -19
  214. data/rdoc/RubyXL/ConditionalFormatting.html +13 -19
  215. data/rdoc/RubyXL/ConditionalFormattingRule.html +13 -19
  216. data/rdoc/RubyXL/Connection.html +99 -0
  217. data/rdoc/RubyXL/ConnectionTable.html +99 -0
  218. data/rdoc/RubyXL/ConnectionTables.html +99 -0
  219. data/rdoc/RubyXL/ConnectionTextField.html +99 -0
  220. data/rdoc/RubyXL/ConnectionTextFields.html +99 -0
  221. data/rdoc/RubyXL/Connections.html +147 -0
  222. data/rdoc/RubyXL/ContentTypeDefault.html +12 -17
  223. data/rdoc/RubyXL/ContentTypeOverride.html +12 -17
  224. data/rdoc/RubyXL/ContentTypes.html +23 -63
  225. data/rdoc/RubyXL/ControlPropertiesFile.html +14 -22
  226. data/rdoc/RubyXL/CorePropertiesFile.html +26 -162
  227. data/rdoc/RubyXL/CustomColor.html +13 -19
  228. data/rdoc/RubyXL/CustomColorList.html +13 -19
  229. data/rdoc/RubyXL/CustomFilter.html +13 -19
  230. data/rdoc/RubyXL/CustomFilters.html +13 -19
  231. data/rdoc/RubyXL/CustomGeometry.html +13 -19
  232. data/rdoc/RubyXL/CustomProperties.html +13 -19
  233. data/rdoc/RubyXL/CustomPropertiesFile.html +12 -25
  234. data/rdoc/RubyXL/CustomProperty.html +13 -19
  235. data/rdoc/RubyXL/CustomPropertyFile.html +108 -0
  236. data/rdoc/RubyXL/CustomSheetView.html +13 -19
  237. data/rdoc/RubyXL/CustomSheetViews.html +13 -19
  238. data/rdoc/RubyXL/CustomWorkbookView.html +13 -19
  239. data/rdoc/RubyXL/CustomWorkbookViews.html +13 -19
  240. data/rdoc/RubyXL/CustomXMLFile.html +12 -22
  241. data/rdoc/RubyXL/DXF.html +13 -19
  242. data/rdoc/RubyXL/DXFs.html +13 -19
  243. data/rdoc/RubyXL/DataBar.html +13 -19
  244. data/rdoc/RubyXL/DataConsolidate.html +13 -19
  245. data/rdoc/RubyXL/DataConsolidationReference.html +13 -19
  246. data/rdoc/RubyXL/DataConsolidationReferences.html +13 -19
  247. data/rdoc/RubyXL/DataType.html +11 -39
  248. data/rdoc/RubyXL/DataValidation.html +13 -19
  249. data/rdoc/RubyXL/DataValidations.html +13 -19
  250. data/rdoc/RubyXL/DateGroupItem.html +13 -19
  251. data/rdoc/RubyXL/DefinedName.html +13 -19
  252. data/rdoc/RubyXL/DefinedNameExt.html +13 -19
  253. data/rdoc/RubyXL/DefinedNames.html +13 -19
  254. data/rdoc/RubyXL/DefinedNamesExt.html +13 -19
  255. data/rdoc/RubyXL/DocumentPropertiesFile.html +20 -66
  256. data/rdoc/RubyXL/DrawingFile.html +19 -49
  257. data/rdoc/RubyXL/DynamicFilter.html +13 -19
  258. data/rdoc/RubyXL/EmbeddedControl.html +13 -19
  259. data/rdoc/RubyXL/EmbeddedControls.html +13 -19
  260. data/rdoc/RubyXL/Extension.html +13 -19
  261. data/rdoc/RubyXL/ExtensionStorageArea.html +13 -19
  262. data/rdoc/RubyXL/Extents.html +13 -19
  263. data/rdoc/RubyXL/ExternalBook.html +13 -19
  264. data/rdoc/RubyXL/ExternalLinksFile.html +19 -49
  265. data/rdoc/RubyXL/ExternalReference.html +13 -19
  266. data/rdoc/RubyXL/ExternalReferences.html +13 -19
  267. data/rdoc/RubyXL/ExtraColorSchemeList.html +13 -19
  268. data/rdoc/RubyXL/FieldItem.html +13 -19
  269. data/rdoc/RubyXL/FileRecoveryProperties.html +13 -19
  270. data/rdoc/RubyXL/FileSharing.html +13 -19
  271. data/rdoc/RubyXL/FileVersion.html +13 -19
  272. data/rdoc/RubyXL/Fill.html +18 -38
  273. data/rdoc/RubyXL/Fills.html +18 -38
  274. data/rdoc/RubyXL/FilterContainer.html +13 -19
  275. data/rdoc/RubyXL/FloatNode.html +12 -17
  276. data/rdoc/RubyXL/FloatValue.html +12 -17
  277. data/rdoc/RubyXL/Font.html +20 -544
  278. data/rdoc/RubyXL/FontConvenienceMethods.html +414 -0
  279. data/rdoc/RubyXL/FontScheme.html +13 -19
  280. data/rdoc/RubyXL/Fonts.html +19 -39
  281. data/rdoc/RubyXL/Formula.html +13 -19
  282. data/rdoc/RubyXL/FunctionGroup.html +13 -19
  283. data/rdoc/RubyXL/FunctionGroups.html +13 -19
  284. data/rdoc/RubyXL/GenericStorageObject.html +19 -81
  285. data/rdoc/RubyXL/GradientFill.html +13 -19
  286. data/rdoc/RubyXL/HeaderFooterSettings.html +13 -19
  287. data/rdoc/RubyXL/Hyperlink.html +13 -19
  288. data/rdoc/RubyXL/HyperlinkRelFile.html +12 -22
  289. data/rdoc/RubyXL/Hyperlinks.html +13 -19
  290. data/rdoc/RubyXL/IconFilter.html +13 -19
  291. data/rdoc/RubyXL/IconSet.html +13 -19
  292. data/rdoc/RubyXL/IgnoredError.html +13 -19
  293. data/rdoc/RubyXL/IgnoredErrors.html +13 -19
  294. data/rdoc/RubyXL/IndexedColors.html +13 -19
  295. data/rdoc/RubyXL/InputCells.html +13 -19
  296. data/rdoc/RubyXL/IntegerNode.html +12 -17
  297. data/rdoc/RubyXL/IntegerValue.html +12 -17
  298. data/rdoc/RubyXL/LegacyCell.html +14 -66
  299. data/rdoc/RubyXL/LegacyWorksheet.html +40 -100
  300. data/rdoc/RubyXL/MRUColors.html +13 -19
  301. data/rdoc/RubyXL/MacrosFile.html +12 -25
  302. data/rdoc/RubyXL/MergedCell.html +13 -19
  303. data/rdoc/RubyXL/MergedCells.html +13 -19
  304. data/rdoc/RubyXL/NumFmt.html +13 -19
  305. data/rdoc/RubyXL/NumberFormat.html +18 -38
  306. data/rdoc/RubyXL/NumberFormats.html +18 -44
  307. data/rdoc/RubyXL/OLEObject.html +13 -19
  308. data/rdoc/RubyXL/OLEObjectFile.html +12 -25
  309. data/rdoc/RubyXL/OLEObjects.html +13 -19
  310. data/rdoc/RubyXL/OLESize.html +13 -19
  311. data/rdoc/RubyXL/OOXMLContainerObject.html +36 -132
  312. data/rdoc/RubyXL/OOXMLIgnored.html +163 -0
  313. data/rdoc/RubyXL/OOXMLObject.html +15 -25
  314. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +88 -179
  315. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +47 -183
  316. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +42 -194
  317. data/rdoc/RubyXL/OOXMLTopLevelObject.html +37 -133
  318. data/rdoc/RubyXL/OdbcOleDbProperties.html +99 -0
  319. data/rdoc/RubyXL/Offset.html +13 -19
  320. data/rdoc/RubyXL/OlapProperties.html +99 -0
  321. data/rdoc/RubyXL/OleItem.html +99 -0
  322. data/rdoc/RubyXL/OleItems.html +99 -0
  323. data/rdoc/RubyXL/OleLink.html +99 -0
  324. data/rdoc/RubyXL/OutlineProperties.html +13 -19
  325. data/rdoc/RubyXL/PageMargins.html +13 -19
  326. data/rdoc/RubyXL/PageSetup.html +13 -19
  327. data/rdoc/RubyXL/PageSetupProperties.html +13 -19
  328. data/rdoc/RubyXL/Pane.html +13 -19
  329. data/rdoc/RubyXL/Parser.html +20 -53
  330. data/rdoc/RubyXL/PatternFill.html +13 -19
  331. data/rdoc/RubyXL/PhoneticProperties.html +13 -19
  332. data/rdoc/RubyXL/PhoneticRun.html +13 -19
  333. data/rdoc/RubyXL/PivotArea.html +13 -19
  334. data/rdoc/RubyXL/PivotCache.html +13 -19
  335. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +14 -30
  336. data/rdoc/RubyXL/PivotCacheRecordsFile.html +12 -25
  337. data/rdoc/RubyXL/PivotCaches.html +13 -19
  338. data/rdoc/RubyXL/PivotReference.html +13 -19
  339. data/rdoc/RubyXL/PivotReferences.html +13 -19
  340. data/rdoc/RubyXL/PivotTableFile.html +14 -30
  341. data/rdoc/RubyXL/PivotTableSelection.html +13 -19
  342. data/rdoc/RubyXL/PresetGeometry.html +13 -19
  343. data/rdoc/RubyXL/PrintOptions.html +13 -19
  344. data/rdoc/RubyXL/PrinterSettingsFile.html +12 -25
  345. data/rdoc/RubyXL/ProtectedRange.html +13 -19
  346. data/rdoc/RubyXL/ProtectedRanges.html +13 -19
  347. data/rdoc/RubyXL/Protection.html +13 -19
  348. data/rdoc/RubyXL/QueryParameter.html +99 -0
  349. data/rdoc/RubyXL/QueryParameters.html +99 -0
  350. data/rdoc/RubyXL/QueryTable.html +155 -0
  351. data/rdoc/RubyXL/QueryTableDeletedField.html +99 -0
  352. data/rdoc/RubyXL/QueryTableDeletedFields.html +99 -0
  353. data/rdoc/RubyXL/QueryTableField.html +99 -0
  354. data/rdoc/RubyXL/QueryTableFields.html +99 -0
  355. data/rdoc/RubyXL/QueryTableRefresh.html +99 -0
  356. data/rdoc/RubyXL/RID.html +12 -17
  357. data/rdoc/RubyXL/RawOOXML.html +19 -58
  358. data/rdoc/RubyXL/Reference.html +31 -215
  359. data/rdoc/RubyXL/Relationship.html +12 -17
  360. data/rdoc/RubyXL/RelationshipSupport.html +32 -126
  361. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +15 -33
  362. data/rdoc/RubyXL/RevisionPointer.html +99 -0
  363. data/rdoc/RubyXL/RichText.html +18 -38
  364. data/rdoc/RubyXL/RichTextRun.html +17 -37
  365. data/rdoc/RubyXL/Row.html +53 -152
  366. data/rdoc/RubyXL/RowExt.html +13 -19
  367. data/rdoc/RubyXL/RunProperties.html +13 -19
  368. data/rdoc/RubyXL/Scenario.html +13 -19
  369. data/rdoc/RubyXL/Scenarios.html +13 -19
  370. data/rdoc/RubyXL/Selection.html +20 -40
  371. data/rdoc/RubyXL/ShapeGuide.html +13 -19
  372. data/rdoc/RubyXL/ShapeTextRectangle.html +13 -19
  373. data/rdoc/RubyXL/SharedStringsTable.html +31 -140
  374. data/rdoc/RubyXL/Sheet.html +13 -19
  375. data/rdoc/RubyXL/SheetCalculationProperties.html +13 -19
  376. data/rdoc/RubyXL/SheetData.html +20 -53
  377. data/rdoc/RubyXL/SheetDataExt.html +13 -19
  378. data/rdoc/RubyXL/SheetDataSet.html +13 -19
  379. data/rdoc/RubyXL/SheetName.html +13 -19
  380. data/rdoc/RubyXL/SheetNames.html +13 -19
  381. data/rdoc/RubyXL/Sheets.html +13 -19
  382. data/rdoc/RubyXL/SlicerCacheFile.html +12 -25
  383. data/rdoc/RubyXL/SlicerFile.html +12 -25
  384. data/rdoc/RubyXL/SmartTagProperties.html +13 -19
  385. data/rdoc/RubyXL/SmartTagType.html +13 -19
  386. data/rdoc/RubyXL/SmartTagTypes.html +13 -19
  387. data/rdoc/RubyXL/SmartTags.html +13 -19
  388. data/rdoc/RubyXL/SortCondition.html +13 -19
  389. data/rdoc/RubyXL/SortState.html +13 -19
  390. data/rdoc/RubyXL/Sqref.html +18 -51
  391. data/rdoc/RubyXL/Stop.html +13 -19
  392. data/rdoc/RubyXL/StringNode.html +12 -17
  393. data/rdoc/RubyXL/StringNodeW3C.html +19 -52
  394. data/rdoc/RubyXL/StringValue.html +12 -17
  395. data/rdoc/RubyXL/Stylesheet.html +30 -112
  396. data/rdoc/RubyXL/TableFile.html +12 -25
  397. data/rdoc/RubyXL/TableParts.html +12 -17
  398. data/rdoc/RubyXL/TableStyle.html +13 -19
  399. data/rdoc/RubyXL/TableStyles.html +13 -19
  400. data/rdoc/RubyXL/Text.html +19 -63
  401. data/rdoc/RubyXL/TextImportSettings.html +99 -0
  402. data/rdoc/RubyXL/Theme.html +58 -63
  403. data/rdoc/RubyXL/ThemeElements.html +13 -19
  404. data/rdoc/RubyXL/ThumbnailFile.html +12 -25
  405. data/rdoc/RubyXL/Top10.html +13 -19
  406. data/rdoc/RubyXL/VMLDrawingFile.html +15 -32
  407. data/rdoc/RubyXL/Variant.html +13 -19
  408. data/rdoc/RubyXL/Vector.html +17 -37
  409. data/rdoc/RubyXL/VectorValue.html +12 -17
  410. data/rdoc/RubyXL/VisualProperties.html +13 -19
  411. data/rdoc/RubyXL/WebPublishObject.html +13 -19
  412. data/rdoc/RubyXL/WebPublishObjects.html +13 -19
  413. data/rdoc/RubyXL/WebPublishingItem.html +13 -19
  414. data/rdoc/RubyXL/WebPublishingItems.html +13 -19
  415. data/rdoc/RubyXL/WebPublishingProperties.html +13 -19
  416. data/rdoc/RubyXL/WebQueryProperties.html +99 -0
  417. data/rdoc/RubyXL/Workbook.html +483 -226
  418. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +149 -857
  419. data/rdoc/RubyXL/WorkbookProperties.html +13 -19
  420. data/rdoc/RubyXL/WorkbookProtection.html +13 -19
  421. data/rdoc/RubyXL/WorkbookRoot.html +23 -109
  422. data/rdoc/RubyXL/WorkbookView.html +13 -19
  423. data/rdoc/RubyXL/WorkbookViews.html +13 -19
  424. data/rdoc/RubyXL/Worksheet.html +70 -122
  425. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +398 -1049
  426. data/rdoc/RubyXL/WorksheetDimensions.html +13 -19
  427. data/rdoc/RubyXL/WorksheetFormatProperties.html +12 -17
  428. data/rdoc/RubyXL/WorksheetProperties.html +13 -19
  429. data/rdoc/RubyXL/WorksheetProtection.html +13 -19
  430. data/rdoc/RubyXL/WorksheetView.html +13 -19
  431. data/rdoc/RubyXL/WorksheetViews.html +13 -19
  432. data/rdoc/RubyXL/XF.html +13 -19
  433. data/rdoc/created.rid +45 -38
  434. data/rdoc/css/fonts.css +6 -6
  435. data/rdoc/css/rdoc.css +35 -6
  436. data/rdoc/index.html +43 -363
  437. data/rdoc/js/darkfish.js +23 -100
  438. data/rdoc/js/navigation.js +4 -41
  439. data/rdoc/js/navigation.js.gz +0 -0
  440. data/rdoc/js/search.js +32 -31
  441. data/rdoc/js/search_index.js +1 -1
  442. data/rdoc/js/search_index.js.gz +0 -0
  443. data/rdoc/js/searcher.js +7 -6
  444. data/rdoc/js/searcher.js.gz +0 -0
  445. data/rdoc/table_of_contents.html +368 -75
  446. data/rubyXL.gemspec +60 -26
  447. data/spec/lib/cell_spec.rb +147 -2
  448. data/spec/lib/color_spec.rb +1 -0
  449. data/spec/lib/parser_spec.rb +1 -1
  450. data/spec/lib/rgb_color_spec.rb +16 -0
  451. data/spec/lib/text_spec.rb +8 -0
  452. data/spec/lib/workbook_spec.rb +12 -1
  453. data/spec/lib/worksheet_spec.rb +353 -37
  454. data/test/test_parse_write.rb +15 -15
  455. metadata +63 -9
  456. data/rdoc/js/jquery.js +0 -4
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require 'rubyXL/convenience_methods/color'
3
+
4
+ describe RubyXL::RgbColor do
5
+ describe '.to_s' do
6
+ it 'should properly translate the color to string' do
7
+ rgb_color = RubyXL::RgbColor.new
8
+
9
+ rgb_color.r = 1
10
+ rgb_color.g = 2
11
+ rgb_color.b = 255
12
+
13
+ expect(rgb_color.to_s).to eq("0102ff")
14
+ end
15
+ end
16
+ end
@@ -16,6 +16,14 @@ describe RubyXL::Text do
16
16
  expect(str).to be
17
17
  end
18
18
 
19
+ it 'should not escape valid XML extended UNICODE characters' do
20
+ t = RubyXL::Text.new(:value => "\u{10000}\u{10FFFF}")
21
+
22
+ xml = t.write_xml[/<t>[^<]+<\/t>/]
23
+
24
+ expect(xml).to eq("<t>\u{10000}\u{10FFFF}</t>")
25
+ end
26
+
19
27
  end
20
28
 
21
29
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'rubyXL/convenience_methods/workbook'
2
3
 
3
4
  describe RubyXL::Workbook do
4
5
  before do
@@ -136,7 +137,7 @@ describe RubyXL::Workbook do
136
137
  it "It should not be confused by missing sheet_id" do
137
138
  workbook = RubyXL::Workbook.new
138
139
  workbook[0].sheet_id = 1
139
- sheet = workbook.add_worksheet('Sheet2')
140
+ workbook.add_worksheet('Sheet2')
140
141
  workbook.stream
141
142
  end
142
143
 
@@ -169,6 +170,16 @@ describe RubyXL::Workbook do
169
170
  end
170
171
  end
171
172
 
173
+ describe 'defined names' do
174
+ it 'should add and access defined names properly' do
175
+ wb = RubyXL::Workbook.new
176
+ wb.define_new_name('TEST', 'Sheet1!$A$2')
172
177
 
178
+ wb2 = RubyXL::Parser.parse_buffer(wb.stream)
179
+ expect(wb2.get_defined_name('TEST')).to_not be_nil
180
+ expect(wb2.get_defined_name('TEST').reference).to eq('Sheet1!$A$2')
181
+ expect(wb2.get_defined_name('TEST2')).to be_nil
182
+ end
183
+ end
173
184
 
174
185
  end
@@ -1,12 +1,16 @@
1
1
  require 'spec_helper'
2
+ require 'rubyXL/convenience_methods/worksheet'
3
+
4
+ SKIP_ROW_COL = 3
2
5
 
3
6
  describe RubyXL::Worksheet do
4
- before do
7
+ before(:each) do
5
8
  @workbook = RubyXL::Workbook.new
6
9
  @worksheet = @workbook.add_worksheet
7
10
 
8
11
  (0..10).each do |i|
9
12
  (0..10).each do |j|
13
+ next if i == SKIP_ROW_COL || j == SKIP_ROW_COL # Skip some rows/cells
10
14
  @worksheet.add_cell(i, j, "#{i}:#{j}", "F#{i}:#{j}")
11
15
  end
12
16
  end
@@ -633,14 +637,111 @@ describe RubyXL::Worksheet do
633
637
  }.to raise_error(RuntimeError)
634
638
  end
635
639
 
636
- it 'should properly reindex the cells' do
640
+ it 'should properly reindex the cells' do
637
641
  @worksheet.sheet_data.rows.each_with_index { |row, r|
638
- row.cells.each_with_index { |cell, c|
639
- expect(cell.row).to eq(r)
640
- expect(cell.column).to eq(c)
641
- }
642
+ if (SKIP_ROW_COL == r) then
643
+ expect(row).to be_nil
644
+ else
645
+ row.cells.each_with_index { |cell, c|
646
+ if (SKIP_ROW_COL == c) then
647
+ expect(cell).to be_nil
648
+ else
649
+ expect(cell.row).to eq(r)
650
+ expect(cell.column).to eq(c)
651
+ end
652
+ }
653
+ end
642
654
  }
643
655
  end
656
+
657
+ describe 'merged_cells updating' do
658
+ context 'merged cells in the row' do
659
+ # | A1 | B1 | C1 | D1 | E1 |
660
+ # | A2 | MERGED | E2 |
661
+ # | A3 | B3 | C3 | D3 | E3 |
662
+ before do
663
+ @worksheet.merge_cells(1, 1, 1, 3)
664
+ expect(@worksheet.merged_cells.size).to eq 1
665
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D2"
666
+ end
667
+ it 'should delete merged cell' do
668
+ @worksheet.delete_row(1)
669
+ expect(@worksheet.merged_cells.size).to eq 0
670
+ end
671
+ end
672
+ context 'merged vertical two cells' do
673
+ # | A1 | B1 | C1 |
674
+ # | A2 | MERGED | C2 |
675
+ # | A3 | | C3 |
676
+ # | A4 | B4 | C4 |
677
+ before do
678
+ @worksheet.merge_cells(1, 1, 2, 1)
679
+ expect(@worksheet.merged_cells.size).to eq 1
680
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:B3"
681
+ end
682
+ it 'should delete merged cell' do
683
+ @worksheet.delete_row(1)
684
+ expect(@worksheet.merged_cells.size).to eq 0
685
+ end
686
+ end
687
+ context 'merged three or more rows' do
688
+ # | A1 | B1 | C1 | D1 | E1 |
689
+ # | A2 | | E2 |
690
+ # | A3 | MERGED | E3 |
691
+ # | A4 | | E4 |
692
+ # | A5 | B5 | C5 | D5 | E5 |
693
+ before do
694
+ @worksheet.merge_cells(1, 1, 3, 3)
695
+ expect(@worksheet.merged_cells.size).to eq 1
696
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D4"
697
+ end
698
+ # | A2 | | E2 |
699
+ # | A3 | MERGED | E3 |
700
+ # | A4 | | E4 |
701
+ # | A5 | B5 | C5 | D5 | E5 |
702
+ it 'should updates merged cell when delete above the cell' do
703
+ @worksheet.delete_row(0)
704
+ expect(@worksheet.merged_cells.size).to eq 1
705
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B1:D3"
706
+ end
707
+ # | A1 | B1 | C1 | D1 | E1 |
708
+ # | A3 | MERGED | E3 |
709
+ # | A4 | | E4 |
710
+ # | A5 | B5 | C5 | D5 | E5 |
711
+ it 'should updates merged cell when delete top of the cell' do
712
+ @worksheet.delete_row(1)
713
+ expect(@worksheet.merged_cells.size).to eq 1
714
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D3"
715
+ end
716
+ # | A1 | B1 | C1 | D1 | E1 |
717
+ # | A2 | MERGED | E2 |
718
+ # | A4 | | E4 |
719
+ # | A5 | B5 | C5 | D5 | E5 |
720
+ it 'should updates merged cell when delete middle of the cell' do
721
+ @worksheet.delete_row(2)
722
+ expect(@worksheet.merged_cells.size).to eq 1
723
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D3"
724
+ end
725
+ # | A1 | B1 | C1 | D1 | E1 |
726
+ # | A2 | MERGED | E2 |
727
+ # | A3 | | E3 |
728
+ # | A5 | B5 | C5 | D5 | E5 |
729
+ it 'should updates merged cell when delete bottom of the cell' do
730
+ @worksheet.delete_row(3)
731
+ expect(@worksheet.merged_cells.size).to eq 1
732
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D3"
733
+ end
734
+ # | A1 | B1 | C1 | D1 | E1 |
735
+ # | A2 | | E2 |
736
+ # | A3 | MERGED | E3 |
737
+ # | A4 | | E4 |
738
+ it 'should not updates merged cell when ldelete below the cell' do
739
+ @worksheet.delete_row(4)
740
+ expect(@worksheet.merged_cells.size).to eq 1
741
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D4"
742
+ end
743
+ end
744
+ end
644
745
  end
645
746
 
646
747
  describe '.insert_row' do
@@ -650,8 +751,8 @@ describe RubyXL::Worksheet do
650
751
  expect(@worksheet[1][0].value).to eq(@old_cell_value)
651
752
  expect(@worksheet[1][0].formula.expression.to_s).to eq(@old_cell_formula)
652
753
 
653
- @worksheet.insert_row(5)
654
- expect(@worksheet[5][0].is_underlined).to be_nil
754
+ @worksheet.insert_row(7)
755
+ expect(@worksheet[7][0].is_underlined).to be_nil
655
756
  end
656
757
 
657
758
  it 'should insert a row skipping nil rows that might exist' do
@@ -687,12 +788,62 @@ describe RubyXL::Worksheet do
687
788
 
688
789
  it 'should properly reindex the cells' do
689
790
  @worksheet.sheet_data.rows.each_with_index { |row, r|
690
- row.cells.each_with_index { |cell, c|
691
- expect(cell.row).to eq(r)
692
- expect(cell.column).to eq(c)
693
- }
791
+ if (SKIP_ROW_COL == r) then
792
+ expect(row).to be_nil
793
+ else
794
+ row.cells.each_with_index { |cell, c|
795
+ if (SKIP_ROW_COL == c) then
796
+ expect(cell).to be_nil
797
+ else
798
+ expect(cell.row).to eq(r)
799
+ expect(cell.column).to eq(c)
800
+ end
801
+ }
802
+ end
694
803
  }
695
804
  end
805
+
806
+ describe 'merged_cells updating' do
807
+ # | A1 | B1 | C1 | D1 |
808
+ # | A2 | MERGED | D2 |
809
+ # | A3 | | D3 |
810
+ # | A4 | B4 | C4 | D4 |
811
+ before do
812
+ @worksheet.merge_cells(1, 1, 2, 2)
813
+ expect(@worksheet.merged_cells.size).to eq 1
814
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C3"
815
+ end
816
+ # | A1 | B1 | C1 | D1 |
817
+ # | | | | |
818
+ # | A2 | MERGED | D2 |
819
+ # | A3 | | D3 |
820
+ # | A4 | B4 | C4 | D4 |
821
+ it 'should updates merged cell when insert above the cell' do
822
+ @worksheet.insert_row(1)
823
+ expect(@worksheet.merged_cells.size).to eq 1
824
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B3:C4"
825
+ end
826
+ # | A1 | B1 | C1 | D1 |
827
+ # | A2 | | D2 |
828
+ # | | MERGED | |
829
+ # | A3 | | D3 |
830
+ # | A4 | B4 | C4 | D4 |
831
+ it 'should updates merged cell when insert into the cell' do
832
+ @worksheet.insert_row(2)
833
+ expect(@worksheet.merged_cells.size).to eq 1
834
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C4"
835
+ end
836
+ # | A1 | B1 | C1 | D1 |
837
+ # | A2 | MERGED | D2 |
838
+ # | A3 | | D3 |
839
+ # | | | | |
840
+ # | A4 | B4 | C4 | D4 |
841
+ it 'should not updates merged cell when insert below the cell' do
842
+ @worksheet.insert_row(3)
843
+ expect(@worksheet.merged_cells.size).to eq 1
844
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C3"
845
+ end
846
+ end
696
847
  end
697
848
 
698
849
  describe '.delete_column' do
@@ -717,8 +868,20 @@ describe RubyXL::Worksheet do
717
868
 
718
869
  it 'should update cell indices after deleting the column' do
719
870
  @worksheet.delete_column(2)
720
- @worksheet[0].cells.each_with_index { |cell, i|
721
- expect(cell.column).to eq(i)
871
+
872
+ @worksheet.sheet_data.rows.each_with_index { |row, r|
873
+ if (SKIP_ROW_COL == r) then
874
+ expect(row).to be_nil
875
+ else
876
+ row.cells.each_with_index { |cell, c|
877
+ if (SKIP_ROW_COL - 1 == c) then
878
+ expect(cell).to be_nil
879
+ else
880
+ expect(cell.row).to eq(r)
881
+ expect(cell.column).to eq(c)
882
+ end
883
+ }
884
+ end
722
885
  }
723
886
  end
724
887
 
@@ -730,12 +893,115 @@ describe RubyXL::Worksheet do
730
893
 
731
894
  it 'should properly reindex the cells' do
732
895
  @worksheet.sheet_data.rows.each_with_index { |row, r|
733
- row.cells.each_with_index { |cell, c|
734
- expect(cell.row).to eq(r)
735
- expect(cell.column).to eq(c)
736
- }
896
+ if (SKIP_ROW_COL == r) then
897
+ expect(row).to be_nil
898
+ else
899
+ row.cells.each_with_index { |cell, c|
900
+ if (SKIP_ROW_COL == c) then
901
+ expect(cell).to be_nil
902
+ else
903
+ expect(cell.row).to eq(r)
904
+ expect(cell.column).to eq(c)
905
+ end
906
+ }
907
+ end
737
908
  }
738
909
  end
910
+
911
+ describe 'merged_cells updating' do
912
+ context 'merged cells in the column' do
913
+ # | A1 | B1 | C1 |
914
+ # | A2 | | C2 |
915
+ # | A3 | MERGED | C3 |
916
+ # | A4 | | C4 |
917
+ # | A5 | B5 | C5 |
918
+ before do
919
+ @worksheet.merge_cells(1, 1, 3, 1)
920
+ expect(@worksheet.merged_cells.size).to eq 1
921
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:B4"
922
+ end
923
+ it 'should delete merged cell' do
924
+ @worksheet.delete_column(1)
925
+ expect(@worksheet.merged_cells.size).to eq 0
926
+ end
927
+ end
928
+ context 'merged horizontal two cells' do
929
+ # | A1 | B1 | C1 | D1 |
930
+ # | A2 | MERGED | D2 |
931
+ # | A3 | B3 | C3 | D3 |
932
+ before do
933
+ @worksheet.merge_cells(1, 1, 1, 2)
934
+ expect(@worksheet.merged_cells.size).to eq 1
935
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C2"
936
+ end
937
+ it 'should delete merged cell' do
938
+ @worksheet.delete_column(1)
939
+ expect(@worksheet.merged_cells.size).to eq 0
940
+ end
941
+ end
942
+ context 'merged three or more columns' do
943
+ # | A1 | B1 | C1 | D1 | E1 |
944
+ # | A2 | | E2 |
945
+ # | A3 | MERGED | E3 |
946
+ # | A4 | | E4 |
947
+ # | A5 | B5 | C5 | D5 | E5 |
948
+ before do
949
+ @worksheet.merge_cells(1, 1, 3, 3)
950
+ expect(@worksheet.merged_cells.size).to eq 1
951
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D4"
952
+ end
953
+ # | B1 | C1 | D1 | E1 |
954
+ # | | E2 |
955
+ # | MERGED | E3 |
956
+ # | | E4 |
957
+ # | B5 | C5 | D5 | E5 |
958
+ it 'should updates merged cell when delete before the cell' do
959
+ @worksheet.delete_column(0)
960
+ expect(@worksheet.merged_cells.size).to eq 1
961
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "A2:C4"
962
+ end
963
+ # | A1 | C1 | D1 | E1 |
964
+ # | A2 | | E2 |
965
+ # | A3 | MERGED | E3 |
966
+ # | A4 | | E4 |
967
+ # | A5 | C5 | D5 | E5 |
968
+ it 'should updates merged cell when delete left of the cell' do
969
+ @worksheet.delete_column(1)
970
+ expect(@worksheet.merged_cells.size).to eq 1
971
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C4"
972
+ end
973
+ # | A1 | B1 | D1 | E1 |
974
+ # | A2 | | E2 |
975
+ # | A3 | MERGED | E3 |
976
+ # | A4 | | E4 |
977
+ # | A5 | B5 | D5 | E5 |
978
+ it 'should updates merged cell when delete center of the cell' do
979
+ @worksheet.delete_column(2)
980
+ expect(@worksheet.merged_cells.size).to eq 1
981
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C4"
982
+ end
983
+ # | A1 | B1 | C1 | E1 |
984
+ # | A2 | | E2 |
985
+ # | A3 | MERGED | E3 |
986
+ # | A4 | | E4 |
987
+ # | A5 | B5 | C5 | E5 |
988
+ it 'should updates merged cell when delete right of the cell' do
989
+ @worksheet.delete_column(3)
990
+ expect(@worksheet.merged_cells.size).to eq 1
991
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C4"
992
+ end
993
+ # | A1 | B1 | C1 | D1 |
994
+ # | A2 | |
995
+ # | A3 | MERGED |
996
+ # | A4 | |
997
+ # | A5 | B5 | C5 | D5 |
998
+ it 'should not updates merged cell when delete after the cell' do
999
+ @worksheet.delete_column(4)
1000
+ expect(@worksheet.merged_cells.size).to eq 1
1001
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D4"
1002
+ end
1003
+ end
1004
+ end
739
1005
  end
740
1006
 
741
1007
  describe '.insert_column' do
@@ -780,12 +1046,59 @@ describe RubyXL::Worksheet do
780
1046
 
781
1047
  it 'should properly reindex the cells' do
782
1048
  @worksheet.sheet_data.rows.each_with_index { |row, r|
783
- row.cells.each_with_index { |cell, c|
784
- expect(cell.row).to eq(r)
785
- expect(cell.column).to eq(c)
786
- }
1049
+ if (SKIP_ROW_COL == r) then
1050
+ expect(row).to be_nil
1051
+ else
1052
+ row.cells.each_with_index { |cell, c|
1053
+ if (SKIP_ROW_COL == c) then
1054
+ expect(cell).to be_nil
1055
+ else
1056
+ expect(cell.row).to eq(r)
1057
+ expect(cell.column).to eq(c)
1058
+ end
1059
+ }
1060
+ end
787
1061
  }
788
1062
  end
1063
+
1064
+ describe 'merged_cells updating' do
1065
+ # | A1 | B1 | C1 | D1 |
1066
+ # | A2 | MERGED | D2 |
1067
+ # | A3 | | D3 |
1068
+ # | A4 | B4 | C4 | D4 |
1069
+ before do
1070
+ @worksheet.merge_cells(1, 1, 2, 2)
1071
+ expect(@worksheet.merged_cells.size).to eq 1
1072
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C3"
1073
+ end
1074
+ # | A1 | | B1 | C1 | D1 |
1075
+ # | A2 | | MERGED | D2 |
1076
+ # | A3 | | | D3 |
1077
+ # | A4 | | B4 | C4 | D4 |
1078
+ it 'should updates merged cell when insert before the cell' do
1079
+ @worksheet.insert_column(1)
1080
+ expect(@worksheet.merged_cells.size).to eq 1
1081
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "C2:D3"
1082
+ end
1083
+ # | A1 | B1 | | C1 | D1 |
1084
+ # | A2 | MERGED | D2 |
1085
+ # | A3 | | D3 |
1086
+ # | A4 | B4 | | C4 | D4 |
1087
+ it 'should updates merged cell when insert into the cell' do
1088
+ @worksheet.insert_column(2)
1089
+ expect(@worksheet.merged_cells.size).to eq 1
1090
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:D3"
1091
+ end
1092
+ # | A1 | B1 | C1 | | D1 |
1093
+ # | A2 | MERGED | | D2 |
1094
+ # | A3 | | | D3 |
1095
+ # | A4 | B4 | C4 | | D4 |
1096
+ it 'should not updates merged cell when insert after the cell' do
1097
+ @worksheet.insert_column(3)
1098
+ expect(@worksheet.merged_cells.size).to eq 1
1099
+ expect(@worksheet.merged_cells.first.ref.to_s).to eq "B2:C3"
1100
+ end
1101
+ end
789
1102
  end
790
1103
 
791
1104
  describe '.insert_cell' do
@@ -805,8 +1118,19 @@ describe RubyXL::Worksheet do
805
1118
 
806
1119
  it 'should update cell indices after inserting the cell' do
807
1120
  @worksheet.insert_cell(0, 0, 'test', nil, :right)
808
- @worksheet[0].cells.each_with_index { |cell, i|
809
- expect(cell.column).to eq(i)
1121
+ @worksheet.sheet_data.rows.each_with_index { |row, r|
1122
+ if (SKIP_ROW_COL == r) then
1123
+ expect(row).to be_nil
1124
+ else
1125
+ row.cells.each_with_index { |cell, c|
1126
+ if ((r == 0) && (SKIP_ROW_COL + 1 == c)) || ((r != 0) && (SKIP_ROW_COL == c)) then
1127
+ expect(cell).to be_nil
1128
+ else
1129
+ expect(cell.row).to eq(r)
1130
+ expect(cell.column).to eq(c)
1131
+ end
1132
+ }
1133
+ end
810
1134
  }
811
1135
  end
812
1136
 
@@ -855,7 +1179,11 @@ describe RubyXL::Worksheet do
855
1179
  it 'should update cell indices after deleting the cell' do
856
1180
  @worksheet.delete_cell(4, 0, :left)
857
1181
  @worksheet[0].cells.each_with_index { |cell, i|
858
- expect(cell.column).to eq(i)
1182
+ if SKIP_ROW_COL == i then
1183
+ expect(cell).to be_nil
1184
+ else
1185
+ expect(cell.column).to eq(i)
1186
+ end
859
1187
  }
860
1188
  end
861
1189
 
@@ -985,12 +1313,6 @@ describe RubyXL::Worksheet do
985
1313
  end
986
1314
 
987
1315
  describe '.get_row_alignment' do
988
- it 'should cause error if a negative argument is passed in' do
989
- expect {
990
- @worksheet.get_row_alignment(-1, true)
991
- }.to raise_error(RuntimeError)
992
- end
993
-
994
1316
  it 'should return nil if no horizontal alignment specified for row' do
995
1317
  expect(@worksheet.get_row_alignment(0, true)).to be_nil
996
1318
  end
@@ -1028,12 +1350,6 @@ describe RubyXL::Worksheet do
1028
1350
  expect(@worksheet.get_row_border(0, :top)).to eq('thin')
1029
1351
  end
1030
1352
 
1031
- it 'should cause error if a negative argument is passed in' do
1032
- expect {
1033
- @worksheet.get_row_border(-1, :top)
1034
- }.to raise_error(RuntimeError)
1035
- end
1036
-
1037
1353
  it 'should return nil if a row which does not exist is passed in' do
1038
1354
  expect(@worksheet.get_row_border(11, :top)).to be_nil
1039
1355
  end