rubyXL 1.2.10 → 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 (518) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +60 -0
  3. data/.codeclimate.yml +3 -0
  4. data/.rubocop.yml +124 -0
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +18 -14
  7. data/LICENSE.txt +1 -1
  8. data/README.rdoc +170 -100
  9. data/Rakefile +76 -26
  10. data/VERSION +1 -1
  11. data/lib/rubyXL/cell.rb +13 -447
  12. data/lib/rubyXL/convenience_methods/cell.rb +276 -0
  13. data/lib/rubyXL/convenience_methods/color.rb +156 -0
  14. data/lib/rubyXL/convenience_methods/font.rb +63 -0
  15. data/lib/rubyXL/convenience_methods/workbook.rb +137 -0
  16. data/lib/rubyXL/convenience_methods/worksheet.rb +734 -0
  17. data/lib/rubyXL/convenience_methods.rb +5 -0
  18. data/lib/rubyXL/objects/border.rb +71 -0
  19. data/lib/rubyXL/objects/calculation_chain.rb +31 -0
  20. data/lib/rubyXL/objects/cell_style.rb +63 -0
  21. data/lib/rubyXL/objects/chartsheet.rb +88 -0
  22. data/lib/rubyXL/objects/color.rb +25 -0
  23. data/lib/rubyXL/objects/column_range.rb +93 -0
  24. data/lib/rubyXL/objects/comments.rb +44 -0
  25. data/lib/rubyXL/objects/connection.rb +175 -0
  26. data/lib/rubyXL/objects/container_nodes.rb +131 -0
  27. data/lib/rubyXL/objects/content_types.rb +74 -0
  28. data/lib/rubyXL/objects/data_validation.rb +37 -0
  29. data/lib/rubyXL/objects/document_properties.rb +156 -0
  30. data/lib/rubyXL/objects/extensions.rb +51 -0
  31. data/lib/rubyXL/objects/external_links.rb +115 -0
  32. data/lib/rubyXL/objects/fill.rb +52 -0
  33. data/lib/rubyXL/objects/filters.rb +118 -0
  34. data/lib/rubyXL/objects/font.rb +43 -0
  35. data/lib/rubyXL/objects/formula.rb +22 -0
  36. data/lib/rubyXL/objects/ooxml_object.rb +469 -0
  37. data/lib/rubyXL/objects/query_table.rb +106 -0
  38. data/lib/rubyXL/objects/reference.rb +119 -0
  39. data/lib/rubyXL/objects/relationships.rb +213 -0
  40. data/lib/rubyXL/objects/root.rb +84 -0
  41. data/lib/rubyXL/objects/shared_strings.rb +67 -0
  42. data/lib/rubyXL/objects/sheet_common.rb +49 -0
  43. data/lib/rubyXL/objects/sheet_data.rb +219 -0
  44. data/lib/rubyXL/objects/simple_types.rb +249 -0
  45. data/lib/rubyXL/objects/storage.rb +193 -0
  46. data/lib/rubyXL/objects/stylesheet.rb +224 -0
  47. data/lib/rubyXL/objects/text.rb +92 -0
  48. data/lib/rubyXL/objects/theme.rb +1730 -0
  49. data/lib/rubyXL/objects/workbook.rb +572 -0
  50. data/lib/rubyXL/objects/worksheet.rb +762 -0
  51. data/lib/rubyXL/parser.rb +18 -459
  52. data/lib/rubyXL/worksheet.rb +73 -1461
  53. data/lib/rubyXL.rb +9 -7
  54. data/rdoc/README_rdoc.html +534 -0
  55. data/rdoc/RubyXL/AExtension.html +187 -0
  56. data/rdoc/RubyXL/AExtensionStorageArea.html +97 -0
  57. data/rdoc/RubyXL/ActiveX.html +156 -0
  58. data/rdoc/RubyXL/ActiveXBinary.html +106 -0
  59. data/rdoc/RubyXL/AdjustHandleList.html +99 -0
  60. data/rdoc/RubyXL/Alignment.html +99 -0
  61. data/rdoc/RubyXL/AlternateContent.html +97 -0
  62. data/rdoc/RubyXL/AlternateUrls.html +99 -0
  63. data/rdoc/RubyXL/Authors.html +99 -0
  64. data/rdoc/RubyXL/AutoFilter.html +99 -0
  65. data/rdoc/RubyXL/AutoFilterColumn.html +99 -0
  66. data/rdoc/RubyXL/BinaryImageFile.html +108 -0
  67. data/rdoc/RubyXL/BodyProperties.html +99 -0
  68. data/rdoc/RubyXL/BooleanNode.html +97 -0
  69. data/rdoc/RubyXL/BooleanValue.html +97 -0
  70. data/rdoc/RubyXL/Border.html +223 -0
  71. data/rdoc/RubyXL/BorderEdge.html +160 -0
  72. data/rdoc/RubyXL/Borders.html +138 -0
  73. data/rdoc/RubyXL/Break.html +99 -0
  74. data/rdoc/RubyXL/BreakList.html +99 -0
  75. data/rdoc/RubyXL/CT_AdjPoint2D.html +99 -0
  76. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +99 -0
  77. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +99 -0
  78. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +99 -0
  79. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +99 -0
  80. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +99 -0
  81. data/rdoc/RubyXL/CT_Backdrop.html +99 -0
  82. data/rdoc/RubyXL/CT_Bevel.html +99 -0
  83. data/rdoc/RubyXL/CT_BiLevelEffect.html +99 -0
  84. data/rdoc/RubyXL/CT_BlendEffect.html +99 -0
  85. data/rdoc/RubyXL/CT_Blip.html +99 -0
  86. data/rdoc/RubyXL/CT_BlipFillProperties.html +99 -0
  87. data/rdoc/RubyXL/CT_BlurEffect.html +99 -0
  88. data/rdoc/RubyXL/CT_Camera.html +99 -0
  89. data/rdoc/RubyXL/CT_Color.html +99 -0
  90. data/rdoc/RubyXL/CT_ColorChangeEffect.html +99 -0
  91. data/rdoc/RubyXL/CT_ColorMapping.html +99 -0
  92. data/rdoc/RubyXL/CT_ColorScheme.html +99 -0
  93. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +99 -0
  94. data/rdoc/RubyXL/CT_ConnectionSite.html +99 -0
  95. data/rdoc/RubyXL/CT_ConnectionSiteList.html +99 -0
  96. data/rdoc/RubyXL/CT_DashStop.html +99 -0
  97. data/rdoc/RubyXL/CT_DashStopList.html +99 -0
  98. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +99 -0
  99. data/rdoc/RubyXL/CT_DuotoneEffect.html +99 -0
  100. data/rdoc/RubyXL/CT_EffectContainer.html +99 -0
  101. data/rdoc/RubyXL/CT_EffectList.html +99 -0
  102. data/rdoc/RubyXL/CT_EffectReference.html +99 -0
  103. data/rdoc/RubyXL/CT_EffectStyleItem.html +99 -0
  104. data/rdoc/RubyXL/CT_EffectStyleList.html +99 -0
  105. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +99 -0
  106. data/rdoc/RubyXL/CT_FillEffect.html +99 -0
  107. data/rdoc/RubyXL/CT_FillOverlayEffect.html +99 -0
  108. data/rdoc/RubyXL/CT_FillStyleList.html +99 -0
  109. data/rdoc/RubyXL/CT_FlatText.html +99 -0
  110. data/rdoc/RubyXL/CT_FontCollection.html +99 -0
  111. data/rdoc/RubyXL/CT_FontReference.html +99 -0
  112. data/rdoc/RubyXL/CT_GeomGuideList.html +99 -0
  113. data/rdoc/RubyXL/CT_GlowEffect.html +99 -0
  114. data/rdoc/RubyXL/CT_GradientFillProperties.html +99 -0
  115. data/rdoc/RubyXL/CT_GradientStop.html +99 -0
  116. data/rdoc/RubyXL/CT_GradientStopList.html +99 -0
  117. data/rdoc/RubyXL/CT_HSLEffect.html +99 -0
  118. data/rdoc/RubyXL/CT_HslColor.html +99 -0
  119. data/rdoc/RubyXL/CT_Hyperlink.html +99 -0
  120. data/rdoc/RubyXL/CT_InnerShadowEffect.html +99 -0
  121. data/rdoc/RubyXL/CT_LightRig.html +99 -0
  122. data/rdoc/RubyXL/CT_LineEndProperties.html +99 -0
  123. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +99 -0
  124. data/rdoc/RubyXL/CT_LineProperties.html +99 -0
  125. data/rdoc/RubyXL/CT_LineStyleList.html +99 -0
  126. data/rdoc/RubyXL/CT_LinearShadeProperties.html +99 -0
  127. data/rdoc/RubyXL/CT_LuminanceEffect.html +99 -0
  128. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +99 -0
  129. data/rdoc/RubyXL/CT_OuterShadowEffect.html +99 -0
  130. data/rdoc/RubyXL/CT_Path2D.html +99 -0
  131. data/rdoc/RubyXL/CT_Path2DArcTo.html +99 -0
  132. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +99 -0
  133. data/rdoc/RubyXL/CT_Path2DList.html +99 -0
  134. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +99 -0
  135. data/rdoc/RubyXL/CT_Path2DTo.html +99 -0
  136. data/rdoc/RubyXL/CT_PathShadeProperties.html +99 -0
  137. data/rdoc/RubyXL/CT_PatternFillProperties.html +99 -0
  138. data/rdoc/RubyXL/CT_Point3D.html +99 -0
  139. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +99 -0
  140. data/rdoc/RubyXL/CT_PresetColor.html +99 -0
  141. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +99 -0
  142. data/rdoc/RubyXL/CT_PresetShadowEffect.html +99 -0
  143. data/rdoc/RubyXL/CT_PresetTextShape.html +99 -0
  144. data/rdoc/RubyXL/CT_ReflectionEffect.html +99 -0
  145. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +99 -0
  146. data/rdoc/RubyXL/CT_RelativeRect.html +99 -0
  147. data/rdoc/RubyXL/CT_SRgbColor.html +99 -0
  148. data/rdoc/RubyXL/CT_ScRgbColor.html +99 -0
  149. data/rdoc/RubyXL/CT_Scene3D.html +99 -0
  150. data/rdoc/RubyXL/CT_SchemeColor.html +99 -0
  151. data/rdoc/RubyXL/CT_Shape3D.html +99 -0
  152. data/rdoc/RubyXL/CT_ShapeStyle.html +99 -0
  153. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +99 -0
  154. data/rdoc/RubyXL/CT_SphereCoords.html +99 -0
  155. data/rdoc/RubyXL/CT_StretchInfoProperties.html +99 -0
  156. data/rdoc/RubyXL/CT_StyleMatrix.html +99 -0
  157. data/rdoc/RubyXL/CT_StyleMatrixReference.html +99 -0
  158. data/rdoc/RubyXL/CT_SupplementalFont.html +99 -0
  159. data/rdoc/RubyXL/CT_SystemColor.html +99 -0
  160. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +99 -0
  161. data/rdoc/RubyXL/CT_TextBlipBullet.html +99 -0
  162. data/rdoc/RubyXL/CT_TextCharBullet.html +99 -0
  163. data/rdoc/RubyXL/CT_TextCharacterProperties.html +99 -0
  164. data/rdoc/RubyXL/CT_TextFont.html +99 -0
  165. data/rdoc/RubyXL/CT_TextListStyle.html +99 -0
  166. data/rdoc/RubyXL/CT_TextNormalAutofit.html +99 -0
  167. data/rdoc/RubyXL/CT_TextParagraphProperties.html +99 -0
  168. data/rdoc/RubyXL/CT_TextSpacing.html +99 -0
  169. data/rdoc/RubyXL/CT_TextTabStop.html +99 -0
  170. data/rdoc/RubyXL/CT_TextTabStopList.html +99 -0
  171. data/rdoc/RubyXL/CT_TileInfoProperties.html +99 -0
  172. data/rdoc/RubyXL/CT_TintEffect.html +99 -0
  173. data/rdoc/RubyXL/CT_Transform2D.html +99 -0
  174. data/rdoc/RubyXL/CT_TransformEffect.html +99 -0
  175. data/rdoc/RubyXL/CT_Vector3D.html +99 -0
  176. data/rdoc/RubyXL/CT_XYAdjustHandle.html +99 -0
  177. data/rdoc/RubyXL/CalculationChain.html +149 -0
  178. data/rdoc/RubyXL/CalculationChainCell.html +99 -0
  179. data/rdoc/RubyXL/CalculationProperties.html +99 -0
  180. data/rdoc/RubyXL/Cell.html +510 -0
  181. data/rdoc/RubyXL/CellConvenienceMethods.html +1077 -0
  182. data/rdoc/RubyXL/CellExt.html +99 -0
  183. data/rdoc/RubyXL/CellSmartTag.html +99 -0
  184. data/rdoc/RubyXL/CellSmartTagProperty.html +99 -0
  185. data/rdoc/RubyXL/CellSmartTags.html +99 -0
  186. data/rdoc/RubyXL/CellStyle.html +99 -0
  187. data/rdoc/RubyXL/CellStyleXFs.html +138 -0
  188. data/rdoc/RubyXL/CellStyles.html +138 -0
  189. data/rdoc/RubyXL/CellValue.html +139 -0
  190. data/rdoc/RubyXL/CellWatch.html +99 -0
  191. data/rdoc/RubyXL/CellWatches.html +99 -0
  192. data/rdoc/RubyXL/CellXFs.html +139 -0
  193. data/rdoc/RubyXL/ChartColorsFile.html +108 -0
  194. data/rdoc/RubyXL/ChartFile.html +160 -0
  195. data/rdoc/RubyXL/ChartStyleFile.html +108 -0
  196. data/rdoc/RubyXL/ChartUserShapesFile.html +108 -0
  197. data/rdoc/RubyXL/Chartsheet.html +213 -0
  198. data/rdoc/RubyXL/ChartsheetPageSetup.html +99 -0
  199. data/rdoc/RubyXL/ChartsheetProperties.html +99 -0
  200. data/rdoc/RubyXL/ChartsheetProtection.html +99 -0
  201. data/rdoc/RubyXL/ChartsheetView.html +99 -0
  202. data/rdoc/RubyXL/ChartsheetViews.html +99 -0
  203. data/rdoc/RubyXL/Color.html +151 -0
  204. data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +246 -0
  205. data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +285 -0
  206. data/rdoc/RubyXL/ColorConvenienceClasses.html +91 -0
  207. data/rdoc/RubyXL/ColorConvenienceMethods.html +139 -0
  208. data/rdoc/RubyXL/ColorFilter.html +99 -0
  209. data/rdoc/RubyXL/ColorScale.html +99 -0
  210. data/rdoc/RubyXL/ColorSet.html +99 -0
  211. data/rdoc/RubyXL/Colors.html +99 -0
  212. data/rdoc/RubyXL/ColumnRange.html +230 -0
  213. data/rdoc/RubyXL/ColumnRanges.html +237 -0
  214. data/rdoc/RubyXL/Comment.html +99 -0
  215. data/rdoc/RubyXL/CommentList.html +99 -0
  216. data/rdoc/RubyXL/CommentsFile.html +165 -0
  217. data/rdoc/RubyXL/ConditionalFormatValue.html +99 -0
  218. data/rdoc/RubyXL/ConditionalFormatting.html +99 -0
  219. data/rdoc/RubyXL/ConditionalFormattingRule.html +99 -0
  220. data/rdoc/RubyXL/Connection.html +99 -0
  221. data/rdoc/RubyXL/ConnectionTable.html +99 -0
  222. data/rdoc/RubyXL/ConnectionTables.html +99 -0
  223. data/rdoc/RubyXL/ConnectionTextField.html +99 -0
  224. data/rdoc/RubyXL/ConnectionTextFields.html +99 -0
  225. data/rdoc/RubyXL/Connections.html +149 -0
  226. data/rdoc/RubyXL/ContentTypeDefault.html +97 -0
  227. data/rdoc/RubyXL/ContentTypeOverride.html +97 -0
  228. data/rdoc/RubyXL/ContentTypes.html +211 -0
  229. data/rdoc/RubyXL/ControlPropertiesFile.html +108 -0
  230. data/rdoc/RubyXL/CorePropertiesFile.html +355 -0
  231. data/rdoc/RubyXL/CustomColor.html +99 -0
  232. data/rdoc/RubyXL/CustomColorList.html +99 -0
  233. data/rdoc/RubyXL/CustomFilter.html +99 -0
  234. data/rdoc/RubyXL/CustomFilters.html +99 -0
  235. data/rdoc/RubyXL/CustomGeometry.html +99 -0
  236. data/rdoc/RubyXL/CustomProperties.html +99 -0
  237. data/rdoc/RubyXL/CustomPropertiesFile.html +108 -0
  238. data/rdoc/RubyXL/CustomProperty.html +99 -0
  239. data/rdoc/RubyXL/CustomPropertyFile.html +108 -0
  240. data/rdoc/RubyXL/CustomSheetView.html +99 -0
  241. data/rdoc/RubyXL/CustomSheetViews.html +99 -0
  242. data/rdoc/RubyXL/CustomWorkbookView.html +99 -0
  243. data/rdoc/RubyXL/CustomWorkbookViews.html +99 -0
  244. data/rdoc/RubyXL/CustomXMLFile.html +106 -0
  245. data/rdoc/RubyXL/DXF.html +99 -0
  246. data/rdoc/RubyXL/DXFs.html +99 -0
  247. data/rdoc/RubyXL/DataBar.html +99 -0
  248. data/rdoc/RubyXL/DataConsolidate.html +99 -0
  249. data/rdoc/RubyXL/DataConsolidationReference.html +99 -0
  250. data/rdoc/RubyXL/DataConsolidationReferences.html +99 -0
  251. data/rdoc/RubyXL/DataType.html +114 -0
  252. data/rdoc/RubyXL/DataValidation.html +99 -0
  253. data/rdoc/RubyXL/DataValidations.html +99 -0
  254. data/rdoc/RubyXL/DateGroupItem.html +99 -0
  255. data/rdoc/RubyXL/DefinedName.html +99 -0
  256. data/rdoc/RubyXL/DefinedNameExt.html +99 -0
  257. data/rdoc/RubyXL/DefinedNames.html +99 -0
  258. data/rdoc/RubyXL/DefinedNamesExt.html +99 -0
  259. data/rdoc/RubyXL/DocumentPropertiesFile.html +213 -0
  260. data/rdoc/RubyXL/DrawingFile.html +159 -0
  261. data/rdoc/RubyXL/DynamicFilter.html +99 -0
  262. data/rdoc/RubyXL/EmbeddedControl.html +99 -0
  263. data/rdoc/RubyXL/EmbeddedControls.html +99 -0
  264. data/rdoc/RubyXL/Extension.html +99 -0
  265. data/rdoc/RubyXL/ExtensionStorageArea.html +99 -0
  266. data/rdoc/RubyXL/Extents.html +99 -0
  267. data/rdoc/RubyXL/ExternalBook.html +99 -0
  268. data/rdoc/RubyXL/ExternalLinksFile.html +155 -0
  269. data/rdoc/RubyXL/ExternalReference.html +99 -0
  270. data/rdoc/RubyXL/ExternalReferences.html +99 -0
  271. data/rdoc/RubyXL/ExtraColorSchemeList.html +99 -0
  272. data/rdoc/RubyXL/FieldItem.html +99 -0
  273. data/rdoc/RubyXL/FileRecoveryProperties.html +99 -0
  274. data/rdoc/RubyXL/FileSharing.html +99 -0
  275. data/rdoc/RubyXL/FileVersion.html +99 -0
  276. data/rdoc/RubyXL/Fill.html +138 -0
  277. data/rdoc/RubyXL/Fills.html +138 -0
  278. data/rdoc/RubyXL/FilterContainer.html +99 -0
  279. data/rdoc/RubyXL/FloatNode.html +97 -0
  280. data/rdoc/RubyXL/FloatValue.html +97 -0
  281. data/rdoc/RubyXL/Font.html +148 -0
  282. data/rdoc/RubyXL/FontConvenienceMethods.html +442 -0
  283. data/rdoc/RubyXL/FontScheme.html +99 -0
  284. data/rdoc/RubyXL/Fonts.html +138 -0
  285. data/rdoc/RubyXL/Formula.html +99 -0
  286. data/rdoc/RubyXL/FunctionGroup.html +99 -0
  287. data/rdoc/RubyXL/FunctionGroups.html +99 -0
  288. data/rdoc/RubyXL/GenericStorageObject.html +241 -0
  289. data/rdoc/RubyXL/GradientFill.html +99 -0
  290. data/rdoc/RubyXL/HeaderFooterSettings.html +99 -0
  291. data/rdoc/RubyXL/Hyperlink.html +99 -0
  292. data/rdoc/RubyXL/HyperlinkRelFile.html +106 -0
  293. data/rdoc/RubyXL/Hyperlinks.html +99 -0
  294. data/rdoc/RubyXL/IconFilter.html +99 -0
  295. data/rdoc/RubyXL/IconSet.html +99 -0
  296. data/rdoc/RubyXL/IgnoredError.html +99 -0
  297. data/rdoc/RubyXL/IgnoredErrors.html +99 -0
  298. data/rdoc/RubyXL/IndexedColors.html +99 -0
  299. data/rdoc/RubyXL/InputCells.html +99 -0
  300. data/rdoc/RubyXL/IntegerNode.html +97 -0
  301. data/rdoc/RubyXL/IntegerValue.html +97 -0
  302. data/rdoc/RubyXL/LegacyCell.html +130 -0
  303. data/rdoc/RubyXL/LegacyWorksheet.html +306 -0
  304. data/rdoc/RubyXL/MRUColors.html +99 -0
  305. data/rdoc/RubyXL/MacrosFile.html +108 -0
  306. data/rdoc/RubyXL/MergedCell.html +99 -0
  307. data/rdoc/RubyXL/MergedCells.html +99 -0
  308. data/rdoc/RubyXL/NumFmt.html +99 -0
  309. data/rdoc/RubyXL/NumberFormat.html +139 -0
  310. data/rdoc/RubyXL/NumberFormats.html +147 -0
  311. data/rdoc/RubyXL/OLEObject.html +99 -0
  312. data/rdoc/RubyXL/OLEObjectFile.html +108 -0
  313. data/rdoc/RubyXL/OLEObjects.html +99 -0
  314. data/rdoc/RubyXL/OLESize.html +99 -0
  315. data/rdoc/RubyXL/OOXMLContainerObject.html +309 -0
  316. data/rdoc/RubyXL/OOXMLIgnored.html +167 -0
  317. data/rdoc/RubyXL/OOXMLObject.html +107 -0
  318. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +455 -0
  319. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +442 -0
  320. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +470 -0
  321. data/rdoc/RubyXL/OOXMLTopLevelObject.html +297 -0
  322. data/rdoc/RubyXL/OdbcOleDbProperties.html +99 -0
  323. data/rdoc/RubyXL/Offset.html +99 -0
  324. data/rdoc/RubyXL/OlapProperties.html +99 -0
  325. data/rdoc/RubyXL/OleItem.html +99 -0
  326. data/rdoc/RubyXL/OleItems.html +99 -0
  327. data/rdoc/RubyXL/OleLink.html +99 -0
  328. data/rdoc/RubyXL/OutlineProperties.html +99 -0
  329. data/rdoc/RubyXL/PageMargins.html +99 -0
  330. data/rdoc/RubyXL/PageSetup.html +99 -0
  331. data/rdoc/RubyXL/PageSetupProperties.html +99 -0
  332. data/rdoc/RubyXL/Pane.html +99 -0
  333. data/rdoc/RubyXL/Parser.html +174 -0
  334. data/rdoc/RubyXL/PatternFill.html +99 -0
  335. data/rdoc/RubyXL/PersonMetadata.html +108 -0
  336. data/rdoc/RubyXL/PhoneticProperties.html +99 -0
  337. data/rdoc/RubyXL/PhoneticRun.html +99 -0
  338. data/rdoc/RubyXL/PivotArea.html +99 -0
  339. data/rdoc/RubyXL/PivotCache.html +99 -0
  340. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +116 -0
  341. data/rdoc/RubyXL/PivotCacheRecordsFile.html +108 -0
  342. data/rdoc/RubyXL/PivotCaches.html +99 -0
  343. data/rdoc/RubyXL/PivotReference.html +99 -0
  344. data/rdoc/RubyXL/PivotReferences.html +99 -0
  345. data/rdoc/RubyXL/PivotTableFile.html +116 -0
  346. data/rdoc/RubyXL/PivotTableSelection.html +99 -0
  347. data/rdoc/RubyXL/PresetGeometry.html +99 -0
  348. data/rdoc/RubyXL/PrintOptions.html +99 -0
  349. data/rdoc/RubyXL/PrinterSettingsFile.html +108 -0
  350. data/rdoc/RubyXL/ProtectedRange.html +99 -0
  351. data/rdoc/RubyXL/ProtectedRanges.html +99 -0
  352. data/rdoc/RubyXL/Protection.html +99 -0
  353. data/rdoc/RubyXL/QueryParameter.html +99 -0
  354. data/rdoc/RubyXL/QueryParameters.html +99 -0
  355. data/rdoc/RubyXL/QueryTable.html +157 -0
  356. data/rdoc/RubyXL/QueryTableDeletedField.html +99 -0
  357. data/rdoc/RubyXL/QueryTableDeletedFields.html +99 -0
  358. data/rdoc/RubyXL/QueryTableField.html +99 -0
  359. data/rdoc/RubyXL/QueryTableFields.html +99 -0
  360. data/rdoc/RubyXL/QueryTableRefresh.html +99 -0
  361. data/rdoc/RubyXL/RID.html +97 -0
  362. data/rdoc/RubyXL/RawOOXML.html +187 -0
  363. data/rdoc/RubyXL/Reference.html +510 -0
  364. data/rdoc/RubyXL/Relationship.html +97 -0
  365. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +131 -0
  366. data/rdoc/RubyXL/RelationshipSupport.html +336 -0
  367. data/rdoc/RubyXL/RevisionPointer.html +99 -0
  368. data/rdoc/RubyXL/RichText.html +141 -0
  369. data/rdoc/RubyXL/RichTextRun.html +138 -0
  370. data/rdoc/RubyXL/Row.html +357 -0
  371. data/rdoc/RubyXL/RowExt.html +99 -0
  372. data/rdoc/RubyXL/RunProperties.html +99 -0
  373. data/rdoc/RubyXL/Scenario.html +99 -0
  374. data/rdoc/RubyXL/Scenarios.html +99 -0
  375. data/rdoc/RubyXL/Selection.html +146 -0
  376. data/rdoc/RubyXL/ShapeGuide.html +99 -0
  377. data/rdoc/RubyXL/ShapeTextRectangle.html +99 -0
  378. data/rdoc/RubyXL/SharedStringsTable.html +328 -0
  379. data/rdoc/RubyXL/Sheet.html +99 -0
  380. data/rdoc/RubyXL/SheetCalculationProperties.html +99 -0
  381. data/rdoc/RubyXL/SheetData.html +162 -0
  382. data/rdoc/RubyXL/SheetDataExt.html +99 -0
  383. data/rdoc/RubyXL/SheetDataSet.html +99 -0
  384. data/rdoc/RubyXL/SheetMetadata.html +108 -0
  385. data/rdoc/RubyXL/SheetName.html +99 -0
  386. data/rdoc/RubyXL/SheetNames.html +99 -0
  387. data/rdoc/RubyXL/Sheets.html +99 -0
  388. data/rdoc/RubyXL/SlicerCacheFile.html +108 -0
  389. data/rdoc/RubyXL/SlicerFile.html +108 -0
  390. data/rdoc/RubyXL/SmartTagProperties.html +99 -0
  391. data/rdoc/RubyXL/SmartTagType.html +99 -0
  392. data/rdoc/RubyXL/SmartTagTypes.html +99 -0
  393. data/rdoc/RubyXL/SmartTags.html +99 -0
  394. data/rdoc/RubyXL/SortCondition.html +99 -0
  395. data/rdoc/RubyXL/SortState.html +99 -0
  396. data/rdoc/RubyXL/Sqref.html +167 -0
  397. data/rdoc/RubyXL/Stop.html +99 -0
  398. data/rdoc/RubyXL/StringNode.html +97 -0
  399. data/rdoc/RubyXL/StringNodeW3C.html +167 -0
  400. data/rdoc/RubyXL/StringValue.html +97 -0
  401. data/rdoc/RubyXL/Stylesheet.html +281 -0
  402. data/rdoc/RubyXL/TableFile.html +108 -0
  403. data/rdoc/RubyXL/TableParts.html +97 -0
  404. data/rdoc/RubyXL/TableStyle.html +99 -0
  405. data/rdoc/RubyXL/TableStyles.html +99 -0
  406. data/rdoc/RubyXL/Text.html +175 -0
  407. data/rdoc/RubyXL/TextImportSettings.html +99 -0
  408. data/rdoc/RubyXL/Theme.html +535 -0
  409. data/rdoc/RubyXL/ThemeElements.html +99 -0
  410. data/rdoc/RubyXL/ThumbnailFile.html +108 -0
  411. data/rdoc/RubyXL/Top10.html +99 -0
  412. data/rdoc/RubyXL/VMLDrawingFile.html +116 -0
  413. data/rdoc/RubyXL/Variant.html +99 -0
  414. data/rdoc/RubyXL/Vector.html +142 -0
  415. data/rdoc/RubyXL/VectorValue.html +97 -0
  416. data/rdoc/RubyXL/VisualProperties.html +99 -0
  417. data/rdoc/RubyXL/WebPublishObject.html +99 -0
  418. data/rdoc/RubyXL/WebPublishObjects.html +99 -0
  419. data/rdoc/RubyXL/WebPublishingItem.html +99 -0
  420. data/rdoc/RubyXL/WebPublishingItems.html +99 -0
  421. data/rdoc/RubyXL/WebPublishingProperties.html +99 -0
  422. data/rdoc/RubyXL/WebQueryProperties.html +99 -0
  423. data/rdoc/RubyXL/Workbook.html +948 -0
  424. data/rdoc/RubyXL/WorkbookConvenienceMethods.html +596 -0
  425. data/rdoc/RubyXL/WorkbookProperties.html +99 -0
  426. data/rdoc/RubyXL/WorkbookProtection.html +99 -0
  427. data/rdoc/RubyXL/WorkbookRoot.html +325 -0
  428. data/rdoc/RubyXL/WorkbookView.html +99 -0
  429. data/rdoc/RubyXL/WorkbookViews.html +99 -0
  430. data/rdoc/RubyXL/Worksheet.html +418 -0
  431. data/rdoc/RubyXL/WorksheetConvenienceMethods.html +2205 -0
  432. data/rdoc/RubyXL/WorksheetDimensions.html +99 -0
  433. data/rdoc/RubyXL/WorksheetFormatProperties.html +97 -0
  434. data/rdoc/RubyXL/WorksheetProperties.html +99 -0
  435. data/rdoc/RubyXL/WorksheetProtection.html +99 -0
  436. data/rdoc/RubyXL/WorksheetView.html +99 -0
  437. data/rdoc/RubyXL/WorksheetViews.html +99 -0
  438. data/rdoc/RubyXL/XF.html +99 -0
  439. data/rdoc/RubyXL.html +338 -0
  440. data/rdoc/created.rid +45 -0
  441. data/rdoc/css/fonts.css +167 -0
  442. data/rdoc/css/rdoc.css +687 -0
  443. data/rdoc/fonts/Lato-Light.ttf +0 -0
  444. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  445. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  446. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  447. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  448. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  449. data/rdoc/images/add.png +0 -0
  450. data/rdoc/images/arrow_up.png +0 -0
  451. data/rdoc/images/brick.png +0 -0
  452. data/rdoc/images/brick_link.png +0 -0
  453. data/rdoc/images/bug.png +0 -0
  454. data/rdoc/images/bullet_black.png +0 -0
  455. data/rdoc/images/bullet_toggle_minus.png +0 -0
  456. data/rdoc/images/bullet_toggle_plus.png +0 -0
  457. data/rdoc/images/date.png +0 -0
  458. data/rdoc/images/delete.png +0 -0
  459. data/rdoc/images/find.png +0 -0
  460. data/rdoc/images/loadingAnimation.gif +0 -0
  461. data/rdoc/images/macFFBgHack.png +0 -0
  462. data/rdoc/images/package.png +0 -0
  463. data/rdoc/images/page_green.png +0 -0
  464. data/rdoc/images/page_white_text.png +0 -0
  465. data/rdoc/images/page_white_width.png +0 -0
  466. data/rdoc/images/plugin.png +0 -0
  467. data/rdoc/images/ruby.png +0 -0
  468. data/rdoc/images/tag_blue.png +0 -0
  469. data/rdoc/images/tag_green.png +0 -0
  470. data/rdoc/images/transparent.png +0 -0
  471. data/rdoc/images/wrench.png +0 -0
  472. data/rdoc/images/wrench_orange.png +0 -0
  473. data/rdoc/images/zoom.png +0 -0
  474. data/rdoc/index.html +477 -0
  475. data/rdoc/js/darkfish.js +97 -0
  476. data/rdoc/js/navigation.js +105 -0
  477. data/rdoc/js/navigation.js.gz +0 -0
  478. data/rdoc/js/search.js +110 -0
  479. data/rdoc/js/search_index.js +1 -0
  480. data/rdoc/js/search_index.js.gz +0 -0
  481. data/rdoc/js/searcher.js +229 -0
  482. data/rdoc/js/searcher.js.gz +0 -0
  483. data/rdoc/table_of_contents.html +3021 -0
  484. data/rubyXL.gemspec +521 -60
  485. data/spec/lib/cell_spec.rb +386 -143
  486. data/spec/lib/color_spec.rb +11 -4
  487. data/spec/lib/parser_spec.rb +90 -38
  488. data/spec/lib/reference_spec.rb +64 -0
  489. data/spec/lib/rgb_color_spec.rb +29 -0
  490. data/spec/lib/stylesheet_spec.rb +27 -0
  491. data/spec/lib/text_spec.rb +27 -0
  492. data/spec/lib/workbook_spec.rb +168 -22
  493. data/spec/lib/worksheet_spec.rb +1207 -1220
  494. data/spec/spec_helper.rb +13 -0
  495. data/test/input/.gitkeep +0 -0
  496. data/test/output/.gitkeep +0 -0
  497. data/test/test_parse_write.rb +15 -0
  498. data/tmp/.gitignore +1 -0
  499. metadata +634 -168
  500. data/Gemfile.lock +0 -34
  501. data/lib/.DS_Store +0 -0
  502. data/lib/rubyXL/Hash.rb +0 -60
  503. data/lib/rubyXL/color.rb +0 -14
  504. data/lib/rubyXL/private_class.rb +0 -265
  505. data/lib/rubyXL/workbook.rb +0 -450
  506. data/lib/rubyXL/writer/app_writer.rb +0 -62
  507. data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
  508. data/lib/rubyXL/writer/content_types_writer.rb +0 -77
  509. data/lib/rubyXL/writer/core_writer.rb +0 -51
  510. data/lib/rubyXL/writer/root_rels_writer.rb +0 -25
  511. data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
  512. data/lib/rubyXL/writer/styles_writer.rb +0 -407
  513. data/lib/rubyXL/writer/theme_writer.rb +0 -343
  514. data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
  515. data/lib/rubyXL/writer/workbook_writer.rb +0 -77
  516. data/lib/rubyXL/writer/worksheet_writer.rb +0 -230
  517. data/lib/rubyXL/zip.rb +0 -20
  518. data/spec/lib/hash_spec.rb +0 -28
@@ -1,194 +1,299 @@
1
- require 'rubygems'
2
- require 'rubyXL'
1
+ # frozen_string_literal: true
3
2
 
4
- describe RubyXL::Cell do
3
+ require 'spec_helper'
4
+ require 'bigdecimal'
5
+ require 'rubyXL/convenience_methods/font'
6
+ require 'rubyXL/convenience_methods/cell'
5
7
 
8
+ describe RubyXL::Cell do
6
9
  before do
7
10
  @workbook = RubyXL::Workbook.new
8
- @worksheet = RubyXL::Worksheet.new(@workbook)
11
+ @worksheet = @workbook.add_worksheet('Test Worksheet')
9
12
  @workbook.worksheets << @worksheet
10
- (0..10).each do |i|
11
- (0..10).each do |j|
13
+ 11.times do |i|
14
+ 11.times do |j|
12
15
  @worksheet.add_cell(i, j, "#{i}:#{j}")
13
16
  end
14
17
  end
15
18
  @cell = @worksheet[0][0]
16
19
  end
17
20
 
21
+ describe '.add_cell' do
22
+ it 'should properly assign data types' do
23
+ r = 4
24
+ c = 4
25
+
26
+ cell = @worksheet.add_cell(r, c, 123)
27
+ expect(cell.datatype).to be_nil
28
+
29
+ cell = @worksheet.add_cell(r, c, "#{r}:#{c}")
30
+ expect(cell.datatype).to eq(RubyXL::DataType::RAW_STRING)
31
+
32
+ cell = @worksheet.add_cell(r, c, RubyXL::RichText.new(:t => RubyXL::Text.new(:value => 'Hello')))
33
+ expect(cell.datatype).to eq(RubyXL::DataType::INLINE_STRING)
34
+ end
35
+
36
+ it 'should properly handle dates' do
37
+ r = 3
38
+ c = 3
39
+
40
+ dt = Date.today
41
+ cell = @worksheet.add_cell(r, c, dt)
42
+ cell.set_number_format('ddd mmm dd, yyyy')
43
+ expect(cell.value).to eq(dt)
44
+
45
+ tm = DateTime.now
46
+ cell = @worksheet.add_cell(r, c, tm)
47
+ cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
48
+
49
+ # Due to rounding errors, we allow microsecond precision on DateTime.
50
+ expect((cell.value - tm).to_f).to be_within(1.0 / 86400e6).of(0)
51
+
52
+ tm = Time.now
53
+ cell = @worksheet.add_cell(r, c, tm)
54
+ cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
55
+
56
+ # Due to rounding errors, we allow microsecond precision on Time.
57
+ expect(cell.value - tm.to_datetime).to be_within(1.0 / 86400e6).of(0)
58
+
59
+ expected_date = '2020-10-15T14:00:00Z'
60
+ expected_datetime = Time.parse(expected_date).utc
61
+ raw_value = '44119.583333333328' # Obtained from parsing a xlsx file with the expected date
62
+ cell = @worksheet.add_cell(r, c, Time.now) # Force a date cell type
63
+ cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
64
+ cell.raw_value = raw_value
65
+ expect(cell.raw_value).to eq(raw_value), 'Wrong raw value'
66
+ cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
67
+
68
+ # We expect exactly the same date
69
+ expect(cell.value.to_time.utc.iso8601).to eq(expected_datetime.iso8601)
70
+ end
71
+
72
+ it 'should raise against too long String' do
73
+ ok_data = 'A' * 32767 # The limit is 32767
74
+
75
+ expect {
76
+ @worksheet.add_cell(0, 1, ok_data) # 32767 -> OK
77
+ }.not_to raise_error
78
+ expect {
79
+ # 1 longer than the limit, so an exception must be thrown.
80
+ @worksheet.add_cell(0, 2, "#{ok_data}x")
81
+ }.to raise_error(ArgumentError)
82
+ end
83
+
84
+ it 'should raise against too long RichText' do
85
+ ok_data = 'A' * 32767 # The limit is 32767
86
+
87
+ expect {
88
+ @worksheet.add_cell(0, 1, RubyXL::RichText.new(:t => RubyXL::Text.new(:value => ok_data))) # 32767 -> OK
89
+ }.not_to raise_error
90
+ expect {
91
+ # 1 longer than the limit, so an exception must be thrown.
92
+ @worksheet.add_cell(0, 2, RubyXL::RichText.new(:t => RubyXL::Text.new(:value => "#{ok_data}x")))
93
+ }.to raise_error(ArgumentError)
94
+ end
95
+ end
96
+
18
97
  describe '.change_fill' do
19
98
  it 'should cause an error if hex color code not passed' do
20
- lambda {
99
+ expect {
21
100
  @cell.change_fill('G')
22
- }.should raise_error
101
+ }.to raise_error(RuntimeError)
23
102
  end
24
103
 
25
104
  it 'should make cell fill color equal to hex color code passed' do
26
105
  @cell.change_fill('0f0f0f')
27
- @cell.fill_color.should == '0f0f0f'
106
+ expect(@cell.fill_color).to eq('0f0f0f')
28
107
  end
29
108
 
30
109
  it 'should cause an error if hex color code includes # character' do
31
- lambda {
110
+ expect {
32
111
  @cell.change_fill('#0f0f0f')
33
- }.should raise_error
112
+ }.to raise_error(RuntimeError)
34
113
  end
35
114
  end
36
115
 
37
116
  describe '.change_font_name' do
38
117
  it 'should make font name match font name passed' do
39
118
  @cell.change_font_name('Arial')
40
- @cell.font_name.should == 'Arial'
119
+ expect(@cell.font_name).to eq('Arial')
41
120
  end
42
121
  end
43
122
 
44
123
  describe '.change_font_size' do
45
124
  it 'should make font size match number passed' do
46
125
  @cell.change_font_size(30)
47
- @cell.font_size.should == 30
126
+ expect(@cell.font_size).to eq(30)
48
127
  end
49
128
 
50
129
  it 'should cause an error if a string passed' do
51
- lambda {
130
+ expect {
52
131
  @cell.change_font_size('20')
53
- }.should raise_error
132
+ }.to raise_error(RuntimeError)
54
133
  end
55
134
  end
56
135
 
57
136
  describe '.change_font_color' do
58
137
  it 'should cause an error if hex color code not passed' do
59
- lambda {
60
- @cell.change_font_color('G')
61
- }.should raise_error
62
- end
138
+ expect {
139
+ @cell.change_font_color('G')
140
+ }.to raise_error(RuntimeError)
141
+ end
63
142
 
64
- it 'should make cell font color equal to hex color code passed' do
65
- @cell.change_font_color('0f0f0f')
66
- @cell.font_color.should == '0f0f0f'
67
- end
143
+ it 'should make cell font color equal to hex color code passed' do
144
+ @cell.change_font_color('0f0f0f')
145
+ expect(@cell.font_color).to eq('0f0f0f')
146
+ end
68
147
 
69
- it 'should cause an error if hex color code includes # character' do
70
- lambda {
71
- @cell.change_font_color('#0f0f0f')
72
- }.should raise_error
73
- end
148
+ it 'should cause an error if hex color code includes # character' do
149
+ expect {
150
+ @cell.change_font_color('#0f0f0f')
151
+ }.to raise_error(RuntimeError)
152
+ end
74
153
  end
75
154
 
76
155
  describe '.change_font_italics' do
77
156
  it 'should make cell font italicized when true is passed' do
157
+ expect(@cell.is_italicized).to be_nil
78
158
  @cell.change_font_italics(true)
79
- @cell.is_italicized.should == true
159
+ expect(@cell.is_italicized).to eq(true)
80
160
  end
81
161
  end
82
162
 
83
163
  describe '.change_font_bold' do
84
164
  it 'should make cell font bolded when true is passed' do
165
+ expect(@cell.is_bolded).to be_nil
85
166
  @cell.change_font_bold(true)
86
- @cell.is_bolded.should == true
167
+ expect(@cell.is_bolded).to eq(true)
87
168
  end
88
169
  end
89
170
 
90
171
  describe '.change_font_underline' do
91
172
  it 'should make cell font underlined when true is passed' do
173
+ expect(@cell.is_underlined).to be_nil
92
174
  @cell.change_font_underline(true)
93
- @cell.is_underlined.should == true
175
+ expect(@cell.is_underlined).to eq(true)
94
176
  end
95
177
  end
96
178
 
97
179
  describe '.change_font_strikethrough' do
98
180
  it 'should make cell font struckthrough when true is passed' do
181
+ expect(@cell.is_struckthrough).to be_nil
99
182
  @cell.change_font_strikethrough(true)
100
- @cell.is_struckthrough.should == true
183
+ expect(@cell.is_struckthrough).to eq(true)
101
184
  end
102
185
  end
103
186
 
104
187
  describe '.change_horizontal_alignment' do
105
188
  it 'should cause cell to horizontally align as specified by the passed in string' do
106
- @cell.change_horizontal_alignment('center')
107
- @cell.horizontal_alignment.should == 'center'
108
- end
109
-
110
- it 'should cause error if nil, "center", "justify", "left", "right", or "distributed" is not passed' do
111
- lambda {
112
- @cell.change_horizontal_alignment('TEST')
113
- }.should raise_error
114
- end
189
+ expect(@cell.horizontal_alignment).to be_nil
190
+ @cell.change_horizontal_alignment('center')
191
+ expect(@cell.horizontal_alignment).to eq('center')
192
+ end
115
193
  end
116
194
 
117
195
  describe '.change_vertical_alignment' do
118
196
  it 'should cause cell to vertically align as specified by the passed in string' do
119
- @cell.change_vertical_alignment('center')
120
- @cell.vertical_alignment.should == 'center'
121
- end
197
+ expect(@cell.vertical_alignment).to be_nil
198
+ @cell.change_vertical_alignment('center')
199
+ expect(@cell.vertical_alignment).to eq('center')
200
+ end
201
+ end
122
202
 
123
- it 'should cause error if nil, "center", "justify", "left", "right", or "distributed" is not passed' do
124
- lambda {
125
- @cell.change_vertical_alignment('TEST')
126
- }.should raise_error
127
- end
203
+ describe '.change_wrap' do
204
+ it 'should cause cell to wrap align as specified by the passed in value' do
205
+ expect(@cell.text_wrap).to be_nil
206
+ @cell.change_text_wrap(true)
207
+ expect(@cell.text_wrap).to eq(true)
208
+ end
128
209
  end
129
210
 
130
- describe '.change_border_top' do
131
- it 'should cause cell to have border at top with specified weight' do
132
- @cell.change_border_top('thin')
133
- @cell.border_top.should == 'thin'
211
+ describe '.change_text_indent' do
212
+ it 'should cause the cell to have the corresponding text indent' do
213
+ expect(@cell.text_indent).to be_nil
214
+ @cell.change_text_indent(2)
215
+ expect(@cell.text_indent).to eq(2)
134
216
  end
135
217
 
136
- it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
137
- lambda {
138
- @cell.change_border_top('TEST')
139
- }.should raise_error
218
+ it 'should not cause other cells with the same style to have text indent' do
219
+ another_cell = @worksheet[1][0]
220
+ another_cell.style_index = @cell.style_index
221
+ expect(another_cell.text_indent).to be_nil
222
+ @cell.change_text_indent(2)
223
+ expect(another_cell.text_indent).to be_nil
140
224
  end
141
225
  end
142
226
 
143
- describe '.change_border_left' do
144
- it 'should cause cell to have border at left with specified weight' do
145
- @cell.change_border_left('thin')
146
- @cell.border_left.should == 'thin'
227
+ describe '.change_border_color' do
228
+ it 'should cause cell to have a colored top border' do
229
+ expect(@cell.get_border_color(:top)).to be_nil
230
+ @cell.change_border_color(:top, 'FF0000')
231
+ expect(@cell.get_border_color(:top)).to eq('FF0000')
147
232
  end
148
233
 
149
- it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
150
- lambda {
151
- @cell.change_border_left('TEST')
152
- }.should raise_error
234
+ it 'should cause cell to have a colored bottom border' do
235
+ expect(@cell.get_border_color(:bottom)).to be_nil
236
+ @cell.change_border_color(:bottom, 'FF0000')
237
+ expect(@cell.get_border_color(:bottom)).to eq('FF0000')
153
238
  end
154
- end
155
239
 
156
- describe '.change_border_right' do
157
- it 'should cause cell to have border at right with specified weight' do
158
- @cell.change_border_right('thin')
159
- @cell.border_right.should == 'thin'
240
+ it 'should cause cell to have a colored left border' do
241
+ expect(@cell.get_border_color(:left)).to be_nil
242
+ @cell.change_border_color(:left, 'FF0000')
243
+ expect(@cell.get_border_color(:left)).to eq('FF0000')
160
244
  end
161
245
 
162
- it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
163
- lambda {
164
- @cell.change_border_right('TEST')
165
- }.should raise_error
246
+ it 'should cause cell to have a colored right border' do
247
+ expect(@cell.get_border_color(:right)).to be_nil
248
+ @cell.change_border_color(:right, 'FF0000')
249
+ expect(@cell.get_border_color(:right)).to eq('FF0000')
166
250
  end
167
- end
168
251
 
169
- describe '.change_border_bottom' do
170
- it 'should cause cell to have border at bottom with specified weight' do
171
- @cell.change_border_bottom('thin')
172
- @cell.border_bottom.should == 'thin'
252
+ it 'should cause cell to have a colored diagonal border' do
253
+ expect(@cell.get_border_color(:diagonal)).to be_nil
254
+ @cell.change_border_color(:diagonal, 'FF0000')
255
+ expect(@cell.get_border_color(:diagonal)).to eq('FF0000')
173
256
  end
174
257
 
175
- it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
176
- lambda {
177
- @cell.change_border_bottom('TEST')
178
- }.should raise_error
258
+ it 'is not overridden if the border style is set afterwards' do
259
+ expect(@cell.get_border_color(:top)).to be_nil
260
+ expect(@cell.get_border(:top)).to be_nil
261
+ @cell.change_border_color(:top, 'FF0000')
262
+ @cell.change_border(:top, 'thin')
263
+ expect(@cell.get_border_color(:top)).to eq('FF0000')
264
+ expect(@cell.get_border(:top)).to eq('thin')
179
265
  end
180
266
  end
181
267
 
182
- describe '.change_border_diagonal' do
183
- it 'should cause cell to have border at diagonal with specified weight' do
184
- @cell.change_border_diagonal('thin')
185
- @cell.border_diagonal.should == 'thin'
268
+ describe '.change_border' do
269
+ it 'should cause cell to have border at top with specified weight' do
270
+ expect(@cell.get_border(:top)).to be_nil
271
+ @cell.change_border(:top, 'thin')
272
+ expect(@cell.get_border(:top)).to eq('thin')
186
273
  end
187
274
 
188
- it 'should cause error if nil, "thin", "thick", "hairline", or "medium" is not passed' do
189
- lambda {
190
- @cell.change_border_diagonal('TEST')
191
- }.should raise_error
275
+ it 'should cause cell to have border at right with specified weight' do
276
+ expect(@cell.get_border(:right)).to be_nil
277
+ @cell.change_border(:right, 'thin')
278
+ expect(@cell.get_border(:right)).to eq('thin')
279
+ end
280
+
281
+ it 'should cause cell to have border at left with specified weight' do
282
+ expect(@cell.get_border(:left)).to be_nil
283
+ @cell.change_border(:left, 'thin')
284
+ expect(@cell.get_border(:left)).to eq('thin')
285
+ end
286
+
287
+ it 'should cause cell to have border at bottom with specified weight' do
288
+ expect(@cell.get_border(:bottom)).to be_nil
289
+ @cell.change_border(:bottom, 'thin')
290
+ expect(@cell.get_border(:bottom)).to eq('thin')
291
+ end
292
+
293
+ it 'should cause cell to have border at diagonal with specified weight' do
294
+ expect(@cell.get_border(:diagonal)).to be_nil
295
+ @cell.change_border(:diagonal, 'thin')
296
+ expect(@cell.get_border(:diagonal)).to eq('thin')
192
297
  end
193
298
  end
194
299
 
@@ -196,190 +301,328 @@ describe RubyXL::Cell do
196
301
  it 'should return the value of a date' do
197
302
  date = Date.parse('January 1, 2011')
198
303
  @cell.change_contents(date)
199
- @cell.should_receive(:is_date?).any_number_of_times.and_return(true)
200
- @cell.value.should == date
304
+ expect(@cell).to receive(:is_date?).at_least(1).and_return(true)
305
+ expect(@cell.value).to eq(date)
201
306
  end
202
307
 
203
- it 'should convert date numbers correctly' do
204
- date = 41019
205
- @cell.change_contents(date)
206
- @cell.should_receive(:is_date?).any_number_of_times.and_return(true)
207
- puts @cell.value
208
- puts Date.parse('April 20, 2012')
209
- @cell.value.should == Date.parse('April 20, 2012')
308
+ it 'should properly return value of inlineStr' do
309
+ cell = @worksheet.add_cell(5, 5, RubyXL::RichText.new(:t => RubyXL::Text.new(:value => 'Hello')))
310
+ expect(cell.value).to eq('Hello')
311
+ end
312
+
313
+ it 'should properly handle numeric values' do
314
+ @cell.datatype = nil
315
+ @cell.raw_value = '1'
316
+ expect(@cell.value).to eq(1)
317
+
318
+ @cell.raw_value = '10000000'
319
+ expect(@cell.value).to eq(10000000)
320
+
321
+ @cell.raw_value = '-10'
322
+ expect(@cell.value).to eq(-10)
323
+
324
+ @cell.raw_value = '0'
325
+ expect(@cell.value).to eq(0)
326
+
327
+ @cell.raw_value = '0.001'
328
+ expect(@cell.value).to eq(0.001)
329
+
330
+ @cell.raw_value = '-0.00000000001'
331
+ expect(@cell.value).to eq(-0.00000000001)
332
+
333
+ @cell.raw_value = '1E5'
334
+ expect(@cell.value).to eq(100000.0)
335
+
336
+ @cell.raw_value = '1E0'
337
+ expect(@cell.value).to eq(1.0)
338
+
339
+ @cell.raw_value = '1E-5'
340
+ expect(@cell.value).to eq(0.00001)
341
+
342
+ @cell.raw_value = '-1E5'
343
+ expect(@cell.value).to eq(-100000.0)
344
+
345
+ @cell.raw_value = '-1E0'
346
+ expect(@cell.value).to eq(-1.0)
347
+
348
+ @cell.raw_value = '-1E-5'
349
+ expect(@cell.value).to eq(-0.00001)
350
+
351
+ @cell.raw_value = '1DE-5'
352
+ expect(@cell.value).to eq('1DE-5')
353
+ end
354
+
355
+ context '1900-based dates' do
356
+ before(:each) { @workbook.date1904 = false }
357
+ it 'should convert date numbers correctly' do
358
+ date = 41019
359
+ @cell.change_contents(date)
360
+ expect(@cell).to receive(:is_date?).at_least(1).and_return(true)
361
+ expect(@cell.value).to eq(Date.parse('April 20, 2012'))
362
+ @cell.change_contents(35981)
363
+ expect(@cell.value).to eq(Date.parse('July 5, 1998'))
364
+ @cell.change_contents(0.019467592592592595)
365
+ expect(@cell.value).to eq(DateTime.parse('1899-12-31T00:28:02+00:00'))
366
+ @cell.change_contents(1)
367
+ expect(@cell.value).to eq(Date.parse('January 1, 1900'))
368
+ @cell.change_contents(59)
369
+ expect(@cell.value).to eq(Date.parse('February 28, 1900'))
370
+ @cell.change_contents(60)
371
+ # There's no way Ruby can return the nonexistent February 29th, so it has to be March 1st:
372
+ expect(@cell.value).to eq(Date.parse('March 1, 1900'))
373
+ @cell.change_contents(61)
374
+ expect(@cell.value).to eq(Date.parse('March 1, 1900'))
375
+ end
376
+ end
377
+
378
+ context '1904-based dates' do
379
+ before(:each) { @workbook.date1904 = true }
380
+ it 'should convert date numbers correctly' do
381
+ date = 39557
382
+ @cell.change_contents(date)
383
+ expect(@cell).to receive(:is_date?).at_least(1).and_return(true)
384
+ expect(@cell.value).to eq(Date.parse('April 20, 2012'))
385
+ @cell.change_contents(34519)
386
+ expect(@cell.value).to eq(Date.parse('July 5, 1998'))
387
+ end
388
+ end
389
+
390
+ context 'date before January 1, 1900' do
391
+ it 'should parse as date' do
392
+ @cell.set_number_format('h:mm:ss')
393
+ @cell.datatype = nil
394
+
395
+ @cell.raw_value = '0.97726851851851848'
396
+ expect(@cell.is_date?).to be(true)
397
+ expect(@cell.value).to eq(DateTime.parse('1899-12-31 23:27:16'))
398
+ @cell.raw_value = '1.9467592592592595E-2'
399
+ expect(@cell.is_date?).to be(true)
400
+ expect(@cell.value).to eq(DateTime.parse('1899-12-31 00:28:02'))
401
+ end
402
+ end
403
+
404
+ context 'with RichText' do
405
+ it 'returns the value of the RichText' do
406
+ cell = RubyXL::Cell.new(is: RubyXL::RichText.new(t: RubyXL::Text.new(value: 'test')))
407
+ expect(cell.value).to eq('test')
408
+ end
210
409
  end
211
410
  end
212
411
 
213
412
  describe '.change_contents' do
214
413
  it 'should cause cell value to match string or number that is passed in' do
215
414
  @cell.change_contents('TEST')
216
- @cell.value.should == 'TEST'
217
- @cell.formula.should == nil
415
+ expect(@cell.value).to eq('TEST')
416
+ expect(@cell.formula).to be_nil
218
417
  end
219
418
 
220
419
  it 'should cause cell value to match a date that is passed in' do
221
420
  date = Date.parse('January 1, 2011')
222
421
  @cell.change_contents(date)
223
- @cell.should_receive(:is_date?).any_number_of_times.and_return(true)
224
- @cell.value.should == date
225
- @cell.formula.should == nil
422
+ expect(@cell).to receive(:is_date?).at_least(1).and_return(true)
423
+ expect(@cell.value).to eq(date)
424
+ expect(@cell.datatype).to be_nil
425
+ expect(@cell.formula).to be_nil
426
+ end
427
+
428
+ it 'should cause cell value to match a time that is passed in' do
429
+ time = Time.parse('January 1, 2011')
430
+ @cell.change_contents(time)
431
+ expect(@cell).to receive(:is_date?).at_least(1).and_return(true)
432
+ expect(@cell.value).to eq(time.to_datetime)
433
+ expect(@cell.datatype).to be_nil
434
+ expect(@cell.formula).to be_nil
435
+ end
436
+
437
+ it 'should case cell value to match a Float that is passed in' do
438
+ number = 1.25
439
+ @cell.change_contents(number)
440
+ expect(@cell.value).to eq(number)
441
+ expect(@cell.datatype).to be_nil
442
+ expect(@cell.formula).to be_nil
443
+ end
444
+
445
+ it 'should case cell value to match an Integer that is passed in' do
446
+ number = 1234567
447
+ @cell.change_contents(number)
448
+ expect(@cell.value).to eq(number)
449
+ expect(@cell.datatype).to be_nil
450
+ expect(@cell.formula).to be_nil
451
+ end
452
+
453
+ it 'should cause cell value to match a BigDecimal that is passed in' do
454
+ number = BigDecimal('1234.5678')
455
+ @cell.change_contents(number)
456
+ expect(@cell.value).to eq(number)
457
+ expect(@cell.datatype).to be_nil
458
+ expect(@cell.formula).to be_nil
226
459
  end
227
460
 
228
461
  it 'should cause cell value and formula to match what is passed in' do
229
462
  @cell.change_contents(nil, 'SUM(A2:A4)')
230
- @cell.value.should == nil
231
- @cell.formula.should == 'SUM(A2:A4)'
463
+ expect(@cell.value).to be_nil
464
+ expect(@cell.formula.expression).to eq('SUM(A2:A4)')
232
465
  end
233
466
  end
234
467
 
235
468
  describe '.is_italicized' do
236
469
  it 'should correctly return whether or not the cell\'s font is italicized' do
237
470
  @cell.change_font_italics(true)
238
- @cell.is_italicized.should == true
471
+ expect(@cell.is_italicized).to eq(true)
239
472
  end
240
473
  end
241
474
 
242
475
  describe '.is_bolded' do
243
476
  it 'should correctly return whether or not the cell\'s font is bolded' do
244
477
  @cell.change_font_bold(true)
245
- @cell.is_bolded.should == true
478
+ expect(@cell.is_bolded).to eq(true)
246
479
  end
247
480
  end
248
481
 
249
482
  describe '.is_underlined' do
250
483
  it 'should correctly return whether or not the cell\'s font is underlined' do
251
484
  @cell.change_font_underline(true)
252
- @cell.is_underlined.should == true
485
+ expect(@cell.is_underlined).to eq(true)
253
486
  end
254
487
  end
255
488
 
256
489
  describe '.is_struckthrough' do
257
490
  it 'should correctly return whether or not the cell\'s font is struckthrough' do
258
491
  @cell.change_font_strikethrough(true)
259
- @cell.is_struckthrough.should == true
492
+ expect(@cell.is_struckthrough).to eq(true)
260
493
  end
261
494
  end
262
495
 
263
496
  describe '.font_name' do
264
497
  it 'should correctly return the name of the cell\'s font' do
265
498
  @cell.change_font_name('Verdana')
266
- @cell.font_name.should == 'Verdana'
499
+ expect(@cell.font_name).to eq('Verdana')
267
500
  end
268
501
  end
269
502
 
270
503
  describe '.font_size' do
271
504
  it 'should correctly return the size of the cell\'s font' do
272
505
  @cell.change_font_size(20)
273
- @cell.font_size.should == 20
506
+ expect(@cell.font_size).to eq(20)
274
507
  end
275
508
  end
276
509
 
277
510
  describe '.font_color' do
278
511
  it 'should correctly return the color of the cell\'s font' do
279
512
  @cell.change_font_color('0f0f0f')
280
- @cell.font_color.should == '0f0f0f'
513
+ expect(@cell.font_color).to eq('0f0f0f')
281
514
  end
282
515
 
283
516
  it 'should return 000000 (black) if no font color has been specified for this cell' do
284
- @cell.font_color.should == '000000'
517
+ expect(@cell.font_color).to eq('000000')
285
518
  end
286
519
  end
287
520
 
288
521
  describe '.fill_color' do
289
522
  it 'should correctly return the color of the cell\'s fill' do
290
523
  @cell.change_fill('000000')
291
- @cell.fill_color.should == '000000'
524
+ expect(@cell.fill_color).to eq('000000')
292
525
  end
293
526
 
294
527
  it 'should return ffffff (white) if no fill color has been specified for this cell' do
295
- @cell.fill_color.should == 'ffffff'
528
+ expect(@cell.fill_color).to eq('ffffff')
296
529
  end
297
530
  end
298
531
 
299
532
  describe '.horizontal_alignment' do
300
533
  it 'should correctly return the type of horizontal alignment of this cell' do
301
534
  @cell.change_horizontal_alignment('center')
302
- @cell.horizontal_alignment.should == 'center'
535
+ expect(@cell.horizontal_alignment).to eq('center')
303
536
  end
304
537
 
305
538
  it 'should return nil if no horizontal alignment has been specified for this cell' do
306
- @cell.horizontal_alignment.should == nil
539
+ expect(@cell.horizontal_alignment).to be_nil
540
+ end
541
+
542
+ it 'should not create new XFs when changing alignment to already existing values' do
543
+ @cell.change_horizontal_alignment('left')
544
+ style_xf1 = @cell.style_index
545
+ @cell.change_horizontal_alignment('right')
546
+ expect(@cell.style_index).not_to eq(style_xf1)
547
+ style_xf2 = @cell.style_index
548
+ @cell.change_horizontal_alignment('left')
549
+ expect(@cell.style_index).to eq(style_xf1)
550
+ @cell.change_horizontal_alignment('right')
551
+ expect(@cell.style_index).to eq(style_xf2)
307
552
  end
308
553
  end
309
554
 
310
555
  describe '.vertical_alignment' do
311
556
  it 'should correctly return the type of vertical alignment of this cell' do
312
557
  @cell.change_vertical_alignment('center')
313
- @cell.vertical_alignment.should == 'center'
558
+ expect(@cell.vertical_alignment).to eq('center')
314
559
  end
315
560
 
316
561
  it 'should return nil if no vertical alignment has been specified for this cell' do
317
- @cell.vertical_alignment.should be_nil
562
+ expect(@cell.vertical_alignment).to be_nil
318
563
  end
319
564
  end
320
565
 
321
566
  describe '.border_top' do
322
567
  it 'should correctly return the weight of the border on top for this cell' do
323
- @cell.change_border_top('thin')
324
- @cell.border_top.should == 'thin'
568
+ @cell.change_border(:top, 'thin')
569
+ expect(@cell.get_border(:top)).to eq('thin')
325
570
  end
326
571
 
327
572
  it 'should return nil if no top border has been specified for this cell' do
328
- @cell.border_top.should be_nil
573
+ expect(@cell.get_border(:top)).to be_nil
329
574
  end
330
575
  end
331
576
 
332
577
  describe '.border_left' do
333
578
  it 'should correctly return the weight of the border on left for this cell' do
334
- @cell.change_border_left('thin')
335
- @cell.border_left.should == 'thin'
579
+ @cell.change_border(:left, 'thin')
580
+ expect(@cell.get_border(:left)).to eq('thin')
336
581
  end
337
582
 
338
583
  it 'should return nil if no left border has been specified for this cell' do
339
- @cell.border_left.should be_nil
584
+ expect(@cell.get_border(:left)).to be_nil
340
585
  end
341
586
  end
342
587
 
343
588
  describe '.border_right' do
344
589
  it 'should correctly return the weight of the border on right for this cell' do
345
- @cell.change_border_right('thin')
346
- @cell.border_right.should == 'thin'
590
+ @cell.change_border(:right, 'thin')
591
+ expect(@cell.get_border(:right)).to eq('thin')
347
592
  end
348
593
 
349
594
  it 'should return nil if no right border has been specified for this cell' do
350
- @cell.border_right.should be_nil
595
+ expect(@cell.get_border(:right)).to be_nil
351
596
  end
352
597
  end
353
598
 
354
599
  describe '.border_bottom' do
355
600
  it 'should correctly return the weight of the border on bottom for this cell' do
356
- @cell.change_border_bottom('thin')
357
- @cell.border_bottom.should == 'thin'
601
+ @cell.change_border(:bottom, 'thin')
602
+ expect(@cell.get_border(:bottom)).to eq('thin')
358
603
  end
359
604
 
360
605
  it 'should return nil if no bottom border has been specified for this cell' do
361
- @cell.border_bottom.should be_nil
606
+ expect(@cell.get_border(:bottom)).to be_nil
362
607
  end
363
608
  end
364
609
 
365
610
  describe '.border_diagonal' do
366
611
  it 'should correctly return the weight of the diagonal border for this cell' do
367
- @cell.change_border_diagonal('thin')
368
- @cell.border_diagonal.should == 'thin'
612
+ @cell.change_border(:diagonal, 'thin')
613
+ expect(@cell.get_border(:diagonal)).to eq('thin')
369
614
  end
370
615
 
371
616
  it 'should return nil if no diagonal border has been specified for this cell' do
372
- @cell.border_diagonal.should be_nil
617
+ expect(@cell.get_border(:diagonal)).to be_nil
373
618
  end
374
619
  end
375
620
 
376
- describe '.convert_to_cell' do
377
- it 'should correctly return the "Excel Style" description of cells when given a row/column number' do
378
- RubyXL::Cell.convert_to_cell(0,26).should == 'AA1'
379
- end
380
-
381
- it 'should cause an error if a negative argument is given' do
382
- lambda {RubyXL::Cell.convert_to_cell(-1,0)}.should raise_error
621
+ describe '.text_rotation' do
622
+ it 'should correctly return the rotation for this cell' do
623
+ expect(@cell.text_rotation).to be_nil
624
+ @cell.change_text_rotation(45)
625
+ expect(@cell.text_rotation).to eq(45)
383
626
  end
384
627
  end
385
628
  end