rubyXL 3.4.39 → 3.4.40
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.
- checksums.yaml +4 -4
- data/Rakefile +107 -14
- data/VERSION +1 -1
- data/bin/console +10 -0
- data/bin/setup +3 -0
- data/lib/rubyXL/convenience_methods/cell.rb +6 -3
- data/lib/rubyXL/version.rb +3 -0
- data/lib/rubyXL.rb +1 -0
- data/rubyXL.gemspec +10 -482
- metadata +27 -430
- data/.circleci/config.yml +0 -71
- data/.codeclimate.yml +0 -3
- data/.rubocop.yml +0 -124
- data/CHANGELOG.md +0 -12
- data/Gemfile +0 -23
- data/rdoc/README_rdoc.html +0 -871
- data/rdoc/RubyXL/AExtension.html +0 -703
- data/rdoc/RubyXL/AExtensionStorageArea.html +0 -543
- data/rdoc/RubyXL/ActiveX.html +0 -654
- data/rdoc/RubyXL/ActiveXBinary.html +0 -560
- data/rdoc/RubyXL/AdjustHandleList.html +0 -539
- data/rdoc/RubyXL/Alignment.html +0 -539
- data/rdoc/RubyXL/AlternateContent.html +0 -543
- data/rdoc/RubyXL/AlternateUrls.html +0 -539
- data/rdoc/RubyXL/Authors.html +0 -539
- data/rdoc/RubyXL/AutoFilter.html +0 -539
- data/rdoc/RubyXL/AutoFilterColumn.html +0 -539
- data/rdoc/RubyXL/BinaryImageFile.html +0 -568
- data/rdoc/RubyXL/BodyProperties.html +0 -539
- data/rdoc/RubyXL/BooleanNode.html +0 -543
- data/rdoc/RubyXL/BooleanValue.html +0 -543
- data/rdoc/RubyXL/Border.html +0 -759
- data/rdoc/RubyXL/BorderEdge.html +0 -656
- data/rdoc/RubyXL/Borders.html +0 -608
- data/rdoc/RubyXL/Break.html +0 -539
- data/rdoc/RubyXL/BreakList.html +0 -539
- data/rdoc/RubyXL/CT_AdjPoint2D.html +0 -539
- data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +0 -539
- data/rdoc/RubyXL/CT_AlphaModulateEffect.html +0 -539
- data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +0 -539
- data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +0 -539
- data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +0 -539
- data/rdoc/RubyXL/CT_Backdrop.html +0 -539
- data/rdoc/RubyXL/CT_Bevel.html +0 -539
- data/rdoc/RubyXL/CT_BiLevelEffect.html +0 -539
- data/rdoc/RubyXL/CT_BlendEffect.html +0 -539
- data/rdoc/RubyXL/CT_Blip.html +0 -539
- data/rdoc/RubyXL/CT_BlipFillProperties.html +0 -539
- data/rdoc/RubyXL/CT_BlurEffect.html +0 -539
- data/rdoc/RubyXL/CT_Camera.html +0 -539
- data/rdoc/RubyXL/CT_Color.html +0 -539
- data/rdoc/RubyXL/CT_ColorChangeEffect.html +0 -539
- data/rdoc/RubyXL/CT_ColorMapping.html +0 -539
- data/rdoc/RubyXL/CT_ColorScheme.html +0 -539
- data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +0 -539
- data/rdoc/RubyXL/CT_ConnectionSite.html +0 -539
- data/rdoc/RubyXL/CT_ConnectionSiteList.html +0 -539
- data/rdoc/RubyXL/CT_DashStop.html +0 -539
- data/rdoc/RubyXL/CT_DashStopList.html +0 -539
- data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +0 -539
- data/rdoc/RubyXL/CT_DuotoneEffect.html +0 -539
- data/rdoc/RubyXL/CT_EffectContainer.html +0 -539
- data/rdoc/RubyXL/CT_EffectList.html +0 -539
- data/rdoc/RubyXL/CT_EffectReference.html +0 -539
- data/rdoc/RubyXL/CT_EffectStyleItem.html +0 -539
- data/rdoc/RubyXL/CT_EffectStyleList.html +0 -539
- data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +0 -539
- data/rdoc/RubyXL/CT_FillEffect.html +0 -539
- data/rdoc/RubyXL/CT_FillOverlayEffect.html +0 -539
- data/rdoc/RubyXL/CT_FillStyleList.html +0 -539
- data/rdoc/RubyXL/CT_FlatText.html +0 -539
- data/rdoc/RubyXL/CT_FontCollection.html +0 -539
- data/rdoc/RubyXL/CT_FontReference.html +0 -539
- data/rdoc/RubyXL/CT_GeomGuideList.html +0 -539
- data/rdoc/RubyXL/CT_GlowEffect.html +0 -539
- data/rdoc/RubyXL/CT_GradientFillProperties.html +0 -539
- data/rdoc/RubyXL/CT_GradientStop.html +0 -539
- data/rdoc/RubyXL/CT_GradientStopList.html +0 -539
- data/rdoc/RubyXL/CT_HSLEffect.html +0 -539
- data/rdoc/RubyXL/CT_HslColor.html +0 -539
- data/rdoc/RubyXL/CT_Hyperlink.html +0 -539
- data/rdoc/RubyXL/CT_InnerShadowEffect.html +0 -539
- data/rdoc/RubyXL/CT_LightRig.html +0 -539
- data/rdoc/RubyXL/CT_LineEndProperties.html +0 -539
- data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +0 -539
- data/rdoc/RubyXL/CT_LineProperties.html +0 -539
- data/rdoc/RubyXL/CT_LineStyleList.html +0 -539
- data/rdoc/RubyXL/CT_LinearShadeProperties.html +0 -539
- data/rdoc/RubyXL/CT_LuminanceEffect.html +0 -539
- data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +0 -539
- data/rdoc/RubyXL/CT_OuterShadowEffect.html +0 -539
- data/rdoc/RubyXL/CT_Path2D.html +0 -539
- data/rdoc/RubyXL/CT_Path2DArcTo.html +0 -539
- data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +0 -539
- data/rdoc/RubyXL/CT_Path2DList.html +0 -539
- data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +0 -539
- data/rdoc/RubyXL/CT_Path2DTo.html +0 -539
- data/rdoc/RubyXL/CT_PathShadeProperties.html +0 -539
- data/rdoc/RubyXL/CT_PatternFillProperties.html +0 -539
- data/rdoc/RubyXL/CT_Point3D.html +0 -539
- data/rdoc/RubyXL/CT_PolarAdjustHandle.html +0 -539
- data/rdoc/RubyXL/CT_PresetColor.html +0 -539
- data/rdoc/RubyXL/CT_PresetLineDashProperties.html +0 -539
- data/rdoc/RubyXL/CT_PresetShadowEffect.html +0 -539
- data/rdoc/RubyXL/CT_PresetTextShape.html +0 -539
- data/rdoc/RubyXL/CT_ReflectionEffect.html +0 -539
- data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +0 -539
- data/rdoc/RubyXL/CT_RelativeRect.html +0 -539
- data/rdoc/RubyXL/CT_SRgbColor.html +0 -539
- data/rdoc/RubyXL/CT_ScRgbColor.html +0 -539
- data/rdoc/RubyXL/CT_Scene3D.html +0 -539
- data/rdoc/RubyXL/CT_SchemeColor.html +0 -539
- data/rdoc/RubyXL/CT_Shape3D.html +0 -539
- data/rdoc/RubyXL/CT_ShapeStyle.html +0 -539
- data/rdoc/RubyXL/CT_SoftEdgesEffect.html +0 -539
- data/rdoc/RubyXL/CT_SphereCoords.html +0 -539
- data/rdoc/RubyXL/CT_StretchInfoProperties.html +0 -539
- data/rdoc/RubyXL/CT_StyleMatrix.html +0 -539
- data/rdoc/RubyXL/CT_StyleMatrixReference.html +0 -539
- data/rdoc/RubyXL/CT_SupplementalFont.html +0 -539
- data/rdoc/RubyXL/CT_SystemColor.html +0 -539
- data/rdoc/RubyXL/CT_TextAutonumberBullet.html +0 -539
- data/rdoc/RubyXL/CT_TextBlipBullet.html +0 -539
- data/rdoc/RubyXL/CT_TextCharBullet.html +0 -539
- data/rdoc/RubyXL/CT_TextCharacterProperties.html +0 -539
- data/rdoc/RubyXL/CT_TextFont.html +0 -539
- data/rdoc/RubyXL/CT_TextListStyle.html +0 -539
- data/rdoc/RubyXL/CT_TextNormalAutofit.html +0 -539
- data/rdoc/RubyXL/CT_TextParagraphProperties.html +0 -539
- data/rdoc/RubyXL/CT_TextSpacing.html +0 -539
- data/rdoc/RubyXL/CT_TextTabStop.html +0 -539
- data/rdoc/RubyXL/CT_TextTabStopList.html +0 -539
- data/rdoc/RubyXL/CT_TileInfoProperties.html +0 -539
- data/rdoc/RubyXL/CT_TintEffect.html +0 -539
- data/rdoc/RubyXL/CT_Transform2D.html +0 -539
- data/rdoc/RubyXL/CT_TransformEffect.html +0 -539
- data/rdoc/RubyXL/CT_Vector3D.html +0 -539
- data/rdoc/RubyXL/CT_XYAdjustHandle.html +0 -539
- data/rdoc/RubyXL/CalculationChain.html +0 -633
- data/rdoc/RubyXL/CalculationChainCell.html +0 -539
- data/rdoc/RubyXL/CalculationProperties.html +0 -539
- data/rdoc/RubyXL/Cell.html +0 -1315
- data/rdoc/RubyXL/CellConvenienceMethods.html +0 -2311
- data/rdoc/RubyXL/CellExt.html +0 -539
- data/rdoc/RubyXL/CellSmartTag.html +0 -539
- data/rdoc/RubyXL/CellSmartTagProperty.html +0 -539
- data/rdoc/RubyXL/CellSmartTags.html +0 -539
- data/rdoc/RubyXL/CellStyle.html +0 -539
- data/rdoc/RubyXL/CellStyleXFs.html +0 -608
- data/rdoc/RubyXL/CellStyles.html +0 -608
- data/rdoc/RubyXL/CellValue.html +0 -609
- data/rdoc/RubyXL/CellWatch.html +0 -539
- data/rdoc/RubyXL/CellWatches.html +0 -539
- data/rdoc/RubyXL/CellXFs.html +0 -609
- data/rdoc/RubyXL/ChartColorsFile.html +0 -568
- data/rdoc/RubyXL/ChartFile.html +0 -664
- data/rdoc/RubyXL/ChartStyleFile.html +0 -568
- data/rdoc/RubyXL/ChartUserShapesFile.html +0 -568
- data/rdoc/RubyXL/Chartsheet.html +0 -743
- data/rdoc/RubyXL/ChartsheetPageSetup.html +0 -539
- data/rdoc/RubyXL/ChartsheetProperties.html +0 -539
- data/rdoc/RubyXL/ChartsheetProtection.html +0 -539
- data/rdoc/RubyXL/ChartsheetView.html +0 -539
- data/rdoc/RubyXL/ChartsheetViews.html +0 -539
- data/rdoc/RubyXL/Color.html +0 -629
- data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +0 -774
- data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +0 -845
- data/rdoc/RubyXL/ColorConvenienceClasses.html +0 -528
- data/rdoc/RubyXL/ColorConvenienceMethods.html +0 -606
- data/rdoc/RubyXL/ColorFilter.html +0 -539
- data/rdoc/RubyXL/ColorScale.html +0 -539
- data/rdoc/RubyXL/ColorSet.html +0 -539
- data/rdoc/RubyXL/Colors.html +0 -539
- data/rdoc/RubyXL/ColumnRange.html +0 -786
- data/rdoc/RubyXL/ColumnRanges.html +0 -773
- data/rdoc/RubyXL/Comment.html +0 -539
- data/rdoc/RubyXL/CommentList.html +0 -539
- data/rdoc/RubyXL/CommentsFile.html +0 -657
- data/rdoc/RubyXL/ConditionalFormatValue.html +0 -539
- data/rdoc/RubyXL/ConditionalFormatting.html +0 -539
- data/rdoc/RubyXL/ConditionalFormattingRule.html +0 -539
- data/rdoc/RubyXL/Connection.html +0 -539
- data/rdoc/RubyXL/ConnectionTable.html +0 -539
- data/rdoc/RubyXL/ConnectionTables.html +0 -539
- data/rdoc/RubyXL/ConnectionTextField.html +0 -539
- data/rdoc/RubyXL/ConnectionTextFields.html +0 -539
- data/rdoc/RubyXL/Connections.html +0 -633
- data/rdoc/RubyXL/ContentTypeDefault.html +0 -543
- data/rdoc/RubyXL/ContentTypeOverride.html +0 -543
- data/rdoc/RubyXL/ContentTypes.html +0 -721
- data/rdoc/RubyXL/ControlPropertiesFile.html +0 -568
- data/rdoc/RubyXL/CorePropertiesFile.html +0 -1013
- data/rdoc/RubyXL/CustomColor.html +0 -539
- data/rdoc/RubyXL/CustomColorList.html +0 -539
- data/rdoc/RubyXL/CustomFilter.html +0 -539
- data/rdoc/RubyXL/CustomFilters.html +0 -539
- data/rdoc/RubyXL/CustomGeometry.html +0 -539
- data/rdoc/RubyXL/CustomProperties.html +0 -539
- data/rdoc/RubyXL/CustomPropertiesFile.html +0 -568
- data/rdoc/RubyXL/CustomProperty.html +0 -539
- data/rdoc/RubyXL/CustomPropertyFile.html +0 -568
- data/rdoc/RubyXL/CustomSheetView.html +0 -539
- data/rdoc/RubyXL/CustomSheetViews.html +0 -539
- data/rdoc/RubyXL/CustomWorkbookView.html +0 -539
- data/rdoc/RubyXL/CustomWorkbookViews.html +0 -539
- data/rdoc/RubyXL/CustomXMLFile.html +0 -560
- data/rdoc/RubyXL/DXF.html +0 -539
- data/rdoc/RubyXL/DXFs.html +0 -539
- data/rdoc/RubyXL/DataBar.html +0 -539
- data/rdoc/RubyXL/DataConsolidate.html +0 -539
- data/rdoc/RubyXL/DataConsolidationReference.html +0 -539
- data/rdoc/RubyXL/DataConsolidationReferences.html +0 -539
- data/rdoc/RubyXL/DataType.html +0 -589
- data/rdoc/RubyXL/DataValidation.html +0 -539
- data/rdoc/RubyXL/DataValidations.html +0 -539
- data/rdoc/RubyXL/DateGroupItem.html +0 -539
- data/rdoc/RubyXL/DefinedName.html +0 -539
- data/rdoc/RubyXL/DefinedNameExt.html +0 -539
- data/rdoc/RubyXL/DefinedNames.html +0 -616
- data/rdoc/RubyXL/DefinedNamesExt.html +0 -539
- data/rdoc/RubyXL/DocumentPropertiesFile.html +0 -725
- data/rdoc/RubyXL/DrawingFile.html +0 -663
- data/rdoc/RubyXL/DynamicFilter.html +0 -539
- data/rdoc/RubyXL/EmbeddedControl.html +0 -539
- data/rdoc/RubyXL/EmbeddedControls.html +0 -539
- data/rdoc/RubyXL/Extension.html +0 -539
- data/rdoc/RubyXL/ExtensionStorageArea.html +0 -539
- data/rdoc/RubyXL/Extents.html +0 -539
- data/rdoc/RubyXL/ExternalBook.html +0 -539
- data/rdoc/RubyXL/ExternalLinksFile.html +0 -659
- data/rdoc/RubyXL/ExternalReference.html +0 -539
- data/rdoc/RubyXL/ExternalReferences.html +0 -539
- data/rdoc/RubyXL/ExtraColorSchemeList.html +0 -539
- data/rdoc/RubyXL/FieldItem.html +0 -539
- data/rdoc/RubyXL/FileRecoveryProperties.html +0 -539
- data/rdoc/RubyXL/FileSharing.html +0 -539
- data/rdoc/RubyXL/FileVersion.html +0 -539
- data/rdoc/RubyXL/Fill.html +0 -608
- data/rdoc/RubyXL/Fills.html +0 -608
- data/rdoc/RubyXL/FilterContainer.html +0 -539
- data/rdoc/RubyXL/FloatNode.html +0 -543
- data/rdoc/RubyXL/FloatValue.html +0 -543
- data/rdoc/RubyXL/Font.html +0 -626
- data/rdoc/RubyXL/FontConvenienceMethods.html +0 -1169
- data/rdoc/RubyXL/FontScheme.html +0 -539
- data/rdoc/RubyXL/Fonts.html +0 -608
- data/rdoc/RubyXL/Formula.html +0 -539
- data/rdoc/RubyXL/FunctionGroup.html +0 -539
- data/rdoc/RubyXL/FunctionGroups.html +0 -539
- data/rdoc/RubyXL/GenericStorageObject.html +0 -803
- data/rdoc/RubyXL/GradientFill.html +0 -539
- data/rdoc/RubyXL/HeaderFooterSettings.html +0 -539
- data/rdoc/RubyXL/Hyperlink.html +0 -539
- data/rdoc/RubyXL/HyperlinkRelFile.html +0 -560
- data/rdoc/RubyXL/Hyperlinks.html +0 -539
- data/rdoc/RubyXL/IconFilter.html +0 -539
- data/rdoc/RubyXL/IconSet.html +0 -539
- data/rdoc/RubyXL/IgnoredError.html +0 -539
- data/rdoc/RubyXL/IgnoredErrors.html +0 -539
- data/rdoc/RubyXL/IndexedColors.html +0 -539
- data/rdoc/RubyXL/InputCells.html +0 -539
- data/rdoc/RubyXL/IntegerNode.html +0 -543
- data/rdoc/RubyXL/IntegerValue.html +0 -543
- data/rdoc/RubyXL/LegacyCell.html +0 -597
- data/rdoc/RubyXL/LegacyWorksheet.html +0 -760
- data/rdoc/RubyXL/MRUColors.html +0 -539
- data/rdoc/RubyXL/MacrosFile.html +0 -568
- data/rdoc/RubyXL/MergedCell.html +0 -539
- data/rdoc/RubyXL/MergedCells.html +0 -539
- data/rdoc/RubyXL/NumFmt.html +0 -539
- data/rdoc/RubyXL/NumberFormat.html +0 -609
- data/rdoc/RubyXL/NumberFormats.html +0 -625
- data/rdoc/RubyXL/OLEObject.html +0 -539
- data/rdoc/RubyXL/OLEObjectFile.html +0 -568
- data/rdoc/RubyXL/OLEObjects.html +0 -539
- data/rdoc/RubyXL/OLESize.html +0 -539
- data/rdoc/RubyXL/OOXMLContainerObject.html +0 -909
- data/rdoc/RubyXL/OOXMLIgnored.html +0 -681
- data/rdoc/RubyXL/OOXMLObject.html +0 -561
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +0 -1034
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +0 -1091
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +0 -1174
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +0 -891
- data/rdoc/RubyXL/OdbcOleDbProperties.html +0 -539
- data/rdoc/RubyXL/Offset.html +0 -539
- data/rdoc/RubyXL/OlapProperties.html +0 -539
- data/rdoc/RubyXL/OleItem.html +0 -539
- data/rdoc/RubyXL/OleItems.html +0 -539
- data/rdoc/RubyXL/OleLink.html +0 -539
- data/rdoc/RubyXL/OutlineProperties.html +0 -539
- data/rdoc/RubyXL/PageMargins.html +0 -539
- data/rdoc/RubyXL/PageSetup.html +0 -539
- data/rdoc/RubyXL/PageSetupProperties.html +0 -539
- data/rdoc/RubyXL/Pane.html +0 -539
- data/rdoc/RubyXL/Parser.html +0 -670
- data/rdoc/RubyXL/PatternFill.html +0 -539
- data/rdoc/RubyXL/PersonMetadata.html +0 -568
- data/rdoc/RubyXL/PhoneticProperties.html +0 -539
- data/rdoc/RubyXL/PhoneticRun.html +0 -539
- data/rdoc/RubyXL/PivotArea.html +0 -539
- data/rdoc/RubyXL/PivotCache.html +0 -539
- data/rdoc/RubyXL/PivotCacheDefinitionFile.html +0 -590
- data/rdoc/RubyXL/PivotCacheRecordsFile.html +0 -568
- data/rdoc/RubyXL/PivotCaches.html +0 -539
- data/rdoc/RubyXL/PivotReference.html +0 -539
- data/rdoc/RubyXL/PivotReferences.html +0 -539
- data/rdoc/RubyXL/PivotSelection.html +0 -539
- data/rdoc/RubyXL/PivotTableFile.html +0 -590
- data/rdoc/RubyXL/PresetGeometry.html +0 -539
- data/rdoc/RubyXL/PrintOptions.html +0 -539
- data/rdoc/RubyXL/PrinterSettingsFile.html +0 -568
- data/rdoc/RubyXL/ProtectedRange.html +0 -539
- data/rdoc/RubyXL/ProtectedRanges.html +0 -539
- data/rdoc/RubyXL/Protection.html +0 -539
- data/rdoc/RubyXL/QueryParameter.html +0 -539
- data/rdoc/RubyXL/QueryParameters.html +0 -539
- data/rdoc/RubyXL/QueryTable.html +0 -655
- data/rdoc/RubyXL/QueryTableDeletedField.html +0 -539
- data/rdoc/RubyXL/QueryTableDeletedFields.html +0 -539
- data/rdoc/RubyXL/QueryTableField.html +0 -539
- data/rdoc/RubyXL/QueryTableFields.html +0 -539
- data/rdoc/RubyXL/QueryTableRefresh.html +0 -539
- data/rdoc/RubyXL/RID.html +0 -543
- data/rdoc/RubyXL/RawOOXML.html +0 -703
- data/rdoc/RubyXL/Reference.html +0 -1332
- data/rdoc/RubyXL/Relationship.html +0 -543
- data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +0 -604
- data/rdoc/RubyXL/RelationshipSupport.html +0 -943
- data/rdoc/RubyXL/RevisionPointer.html +0 -539
- data/rdoc/RubyXL/RichText.html +0 -611
- data/rdoc/RubyXL/RichTextRun.html +0 -608
- data/rdoc/RubyXL/Row.html +0 -1003
- data/rdoc/RubyXL/RowExt.html +0 -539
- data/rdoc/RubyXL/RunProperties.html +0 -539
- data/rdoc/RubyXL/Scenario.html +0 -539
- data/rdoc/RubyXL/Scenarios.html +0 -539
- data/rdoc/RubyXL/Selection.html +0 -616
- data/rdoc/RubyXL/ShapeGuide.html +0 -539
- data/rdoc/RubyXL/ShapeTextRectangle.html +0 -539
- data/rdoc/RubyXL/SharedStringsTable.html +0 -952
- data/rdoc/RubyXL/Sheet.html +0 -539
- data/rdoc/RubyXL/SheetCalculationProperties.html +0 -539
- data/rdoc/RubyXL/SheetData.html +0 -652
- data/rdoc/RubyXL/SheetDataExt.html +0 -539
- data/rdoc/RubyXL/SheetDataSet.html +0 -539
- data/rdoc/RubyXL/SheetMetadata.html +0 -568
- data/rdoc/RubyXL/SheetName.html +0 -539
- data/rdoc/RubyXL/SheetNames.html +0 -539
- data/rdoc/RubyXL/Sheets.html +0 -539
- data/rdoc/RubyXL/SlicerCacheFile.html +0 -568
- data/rdoc/RubyXL/SlicerFile.html +0 -568
- data/rdoc/RubyXL/SmartTagProperties.html +0 -539
- data/rdoc/RubyXL/SmartTagType.html +0 -539
- data/rdoc/RubyXL/SmartTagTypes.html +0 -539
- data/rdoc/RubyXL/SmartTags.html +0 -539
- data/rdoc/RubyXL/SortCondition.html +0 -539
- data/rdoc/RubyXL/SortState.html +0 -539
- data/rdoc/RubyXL/Sqref.html +0 -681
- data/rdoc/RubyXL/Stop.html +0 -539
- data/rdoc/RubyXL/StringNode.html +0 -543
- data/rdoc/RubyXL/StringNodeW3C.html +0 -681
- data/rdoc/RubyXL/StringValue.html +0 -543
- data/rdoc/RubyXL/Stylesheet.html +0 -864
- data/rdoc/RubyXL/TableFile.html +0 -568
- data/rdoc/RubyXL/TableParts.html +0 -543
- data/rdoc/RubyXL/TableStyle.html +0 -539
- data/rdoc/RubyXL/TableStyles.html +0 -539
- data/rdoc/RubyXL/Text.html +0 -679
- data/rdoc/RubyXL/TextImportSettings.html +0 -539
- data/rdoc/RubyXL/Theme.html +0 -1077
- data/rdoc/RubyXL/ThemeElements.html +0 -539
- data/rdoc/RubyXL/ThumbnailFile.html +0 -568
- data/rdoc/RubyXL/Top10.html +0 -539
- data/rdoc/RubyXL/VMLDrawingFile.html +0 -590
- data/rdoc/RubyXL/Variant.html +0 -539
- data/rdoc/RubyXL/Vector.html +0 -612
- data/rdoc/RubyXL/VectorValue.html +0 -543
- data/rdoc/RubyXL/VisualProperties.html +0 -539
- data/rdoc/RubyXL/WebPublishObject.html +0 -539
- data/rdoc/RubyXL/WebPublishObjects.html +0 -539
- data/rdoc/RubyXL/WebPublishingItem.html +0 -539
- data/rdoc/RubyXL/WebPublishingItems.html +0 -539
- data/rdoc/RubyXL/WebPublishingProperties.html +0 -539
- data/rdoc/RubyXL/WebQueryProperties.html +0 -539
- data/rdoc/RubyXL/Workbook.html +0 -2085
- data/rdoc/RubyXL/WorkbookConvenienceMethods.html +0 -1407
- data/rdoc/RubyXL/WorkbookProperties.html +0 -539
- data/rdoc/RubyXL/WorkbookProtection.html +0 -539
- data/rdoc/RubyXL/WorkbookRoot.html +0 -940
- data/rdoc/RubyXL/WorkbookView.html +0 -539
- data/rdoc/RubyXL/WorkbookViews.html +0 -539
- data/rdoc/RubyXL/Worksheet.html +0 -1224
- data/rdoc/RubyXL/WorksheetConvenienceMethods.html +0 -4087
- data/rdoc/RubyXL/WorksheetDimensions.html +0 -539
- data/rdoc/RubyXL/WorksheetFormatProperties.html +0 -543
- data/rdoc/RubyXL/WorksheetProperties.html +0 -539
- data/rdoc/RubyXL/WorksheetProtection.html +0 -539
- data/rdoc/RubyXL/WorksheetView.html +0 -539
- data/rdoc/RubyXL/WorksheetViews.html +0 -539
- data/rdoc/RubyXL/XF.html +0 -539
- data/rdoc/RubyXL.html +0 -1381
- data/rdoc/created.rid +0 -45
- data/rdoc/css/rdoc.css +0 -1955
- data/rdoc/index.html +0 -455
- data/rdoc/js/aliki.js +0 -511
- data/rdoc/js/bash_highlighter.js +0 -167
- data/rdoc/js/c_highlighter.js +0 -299
- data/rdoc/js/search_controller.js +0 -129
- data/rdoc/js/search_data.js +0 -1
- data/rdoc/js/search_navigation.js +0 -105
- data/rdoc/js/search_ranker.js +0 -239
- data/rdoc/js/theme-toggle.js +0 -112
- data/spec/lib/cell_spec.rb +0 -694
- data/spec/lib/color_spec.rb +0 -21
- data/spec/lib/parser_spec.rb +0 -118
- data/spec/lib/reference_spec.rb +0 -122
- data/spec/lib/rgb_color_spec.rb +0 -29
- data/spec/lib/stylesheet_spec.rb +0 -27
- data/spec/lib/text_spec.rb +0 -27
- data/spec/lib/workbook_root_spec.rb +0 -43
- data/spec/lib/workbook_spec.rb +0 -197
- data/spec/lib/worksheet_spec.rb +0 -1777
- data/spec/spec_helper.rb +0 -13
- data/test/input/.gitkeep +0 -0
- data/test/output/.gitkeep +0 -0
- data/test/test_parse_write.rb +0 -15
- data/tmp/.gitignore +0 -1
data/spec/lib/worksheet_spec.rb
DELETED
|
@@ -1,1777 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
require 'rubyXL/convenience_methods/worksheet'
|
|
5
|
-
|
|
6
|
-
SKIP_ROW_COL = 3
|
|
7
|
-
|
|
8
|
-
describe RubyXL::Worksheet do
|
|
9
|
-
subject do
|
|
10
|
-
workbook = RubyXL::Workbook.new
|
|
11
|
-
worksheet = workbook.add_worksheet
|
|
12
|
-
|
|
13
|
-
11.times do |y|
|
|
14
|
-
11.times do |x|
|
|
15
|
-
next if y == SKIP_ROW_COL || x == SKIP_ROW_COL # Skip some rows/cells
|
|
16
|
-
worksheet.add_cell(y, x, "#{x}:#{y}", "F#{x}:#{y}")
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
worksheet
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe 'addressing cells' do
|
|
24
|
-
it 'should be able to address cells by row and column indices' do
|
|
25
|
-
expect(subject[2][4].value).to eq('4:2')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'should be able to address cells by reference' do
|
|
29
|
-
expect(subject.cell_at('B5').value).to eq('1:4')
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe '.change_row_fill' do
|
|
34
|
-
it 'should raise error if hex color code not passed' do
|
|
35
|
-
expect {
|
|
36
|
-
subject.change_row_fill(0, 'G')
|
|
37
|
-
}.to raise_error(ArgumentError)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'should raise error if hex color code includes # character' do
|
|
41
|
-
expect {
|
|
42
|
-
subject.change_row_fill(3, '#FFF000')
|
|
43
|
-
}.to raise_error(ArgumentError)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it 'should make row and cell fill colors equal hex color code passed' do
|
|
47
|
-
subject.change_row_fill(0, '111111')
|
|
48
|
-
expect(subject.get_row_fill(0)).to eq('111111')
|
|
49
|
-
expect(subject[0][5].fill_color).to eq('111111')
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'should cause error if a negative argument is passed in' do
|
|
53
|
-
expect {
|
|
54
|
-
subject.change_row_fill(-1, '111111')
|
|
55
|
-
}.to raise_error(ArgumentError)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it 'should create a new row if it did not exist before' do
|
|
59
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
60
|
-
subject.change_row_fill(11, '111111')
|
|
61
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
62
|
-
expect(subject.get_row_fill(11)).to eq('111111')
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
describe '.change_row_font_name' do
|
|
67
|
-
it 'should make row and cell font names equal font name passed' do
|
|
68
|
-
subject.change_row_font_name(0, 'Arial')
|
|
69
|
-
expect(subject.get_row_font_name(0)).to eq('Arial')
|
|
70
|
-
expect(subject[0][5].font_name).to eq('Arial')
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'should cause error if a negative argument is passed in' do
|
|
74
|
-
expect {
|
|
75
|
-
subject.change_row_font_name(-1, 'Arial')
|
|
76
|
-
}.to raise_error(ArgumentError)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it 'should create a new row if it did not exist before' do
|
|
80
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
81
|
-
subject.change_row_font_name(11, 'Arial')
|
|
82
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
83
|
-
expect(subject.get_row_font_name(11)).to eq('Arial')
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
describe '.change_row_font_size' do
|
|
88
|
-
it 'should make row and cell font sizes equal font number passed' do
|
|
89
|
-
subject.change_row_font_size(0, 20)
|
|
90
|
-
expect(subject.get_row_font_size(0)).to eq(20)
|
|
91
|
-
expect(subject[0][5].font_size).to eq(20)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it 'should cause an error if a string passed' do
|
|
95
|
-
expect {
|
|
96
|
-
subject.change_row_font_size(0, '20')
|
|
97
|
-
}.to raise_error(ArgumentError)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
it 'should cause error if a negative argument is passed in' do
|
|
101
|
-
expect {
|
|
102
|
-
subject.change_row_font_size(-1, 20)
|
|
103
|
-
}.to raise_error(ArgumentError)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it 'should create a new row if it did not exist before' do
|
|
107
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
108
|
-
subject.change_row_font_size(11, 20)
|
|
109
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
110
|
-
expect(subject.get_row_font_size(11)).to eq(20)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
describe '.change_row_font_color' do
|
|
115
|
-
it 'should make row and cell font colors equal to font color passed' do
|
|
116
|
-
subject.change_row_font_color(0, '0f0f0f')
|
|
117
|
-
expect(subject.get_row_font_color(0)).to eq('0f0f0f')
|
|
118
|
-
expect(subject[0][5].font_color).to eq('0f0f0f')
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
it 'should raise error if hex color code not passed' do
|
|
122
|
-
expect {
|
|
123
|
-
subject.change_row_font_color(0, 'G')
|
|
124
|
-
}.to raise_error(ArgumentError)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
it 'should raise error if hex color code includes # character' do
|
|
128
|
-
expect {
|
|
129
|
-
subject.change_row_font_color(3, '#FFF000')
|
|
130
|
-
}.to raise_error(ArgumentError)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
it 'should cause error if a negative argument is passed in' do
|
|
134
|
-
expect {
|
|
135
|
-
subject.change_row_font_color(-1, '0f0f0f')
|
|
136
|
-
}.to raise_error(ArgumentError)
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
it 'should create a new row if it did not exist before' do
|
|
140
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
141
|
-
subject.change_row_font_color(11, '0f0f0f')
|
|
142
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
143
|
-
expect(subject.get_row_font_color(11)).to eq('0f0f0f')
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
describe '.change_row_italics' do
|
|
148
|
-
it 'should make row and cell fonts italicized when true is passed' do
|
|
149
|
-
subject.change_row_italics(0, true)
|
|
150
|
-
expect(subject.is_row_italicized(0)).to eq(true)
|
|
151
|
-
expect(subject[0][5].is_italicized).to eq(true)
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
it 'should cause error if a negative argument is passed in' do
|
|
155
|
-
expect {
|
|
156
|
-
subject.change_row_italics(-1, false)
|
|
157
|
-
}.to raise_error(ArgumentError)
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
it 'should create a new row if it did not exist before' do
|
|
161
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
162
|
-
subject.change_row_italics(11, true)
|
|
163
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
164
|
-
expect(subject.is_row_italicized(11)).to eq(true)
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
describe '.change_row_bold' do
|
|
169
|
-
it 'should make row and cell fonts bolded when true is passed' do
|
|
170
|
-
subject.change_row_bold(0, true)
|
|
171
|
-
expect(subject.is_row_bolded(0)).to eq(true)
|
|
172
|
-
expect(subject[0][5].is_bolded).to eq(true)
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
it 'should cause error if a negative argument is passed in' do
|
|
176
|
-
expect {
|
|
177
|
-
subject.change_row_bold(-1, false)
|
|
178
|
-
}.to raise_error(ArgumentError)
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
it 'should create a new row if it did not exist before' do
|
|
182
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
183
|
-
subject.change_row_bold(11, true)
|
|
184
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
185
|
-
expect(subject.is_row_bolded(11)).to eq(true)
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
describe '.change_row_underline' do
|
|
190
|
-
it 'should make row and cell fonts underlined when true is passed' do
|
|
191
|
-
subject.change_row_underline(0, true)
|
|
192
|
-
expect(subject.is_row_underlined(0)).to eq(true)
|
|
193
|
-
expect(subject[0][5].is_underlined).to eq(true)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
it 'should cause error if a negative argument is passed in' do
|
|
197
|
-
expect {
|
|
198
|
-
subject.change_row_underline(-1, false)
|
|
199
|
-
}.to raise_error(ArgumentError)
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
it 'should create a new row if it did not exist before' do
|
|
203
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
204
|
-
subject.change_row_underline(11, true)
|
|
205
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
206
|
-
expect(subject.is_row_underlined(11)).to eq(true)
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
describe '.change_row_strikethrough' do
|
|
211
|
-
it 'should make row and cell fonts struckthrough when true is passed' do
|
|
212
|
-
subject.change_row_strikethrough(0, true)
|
|
213
|
-
expect(subject.is_row_struckthrough(0)).to eq(true)
|
|
214
|
-
expect(subject[0][5].is_struckthrough).to eq(true)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
it 'should cause error if a negative argument is passed in' do
|
|
218
|
-
expect {
|
|
219
|
-
subject.change_row_strikethrough(-1, false)
|
|
220
|
-
}.to raise_error(ArgumentError)
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
it 'should create a new row if it did not exist before' do
|
|
224
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
225
|
-
subject.change_row_strikethrough(11, true)
|
|
226
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
227
|
-
expect(subject.is_row_struckthrough(11)).to eq(true)
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
describe '.change_row_height' do
|
|
232
|
-
it 'should make row height match number which is passed' do
|
|
233
|
-
subject.change_row_height(0, 30.0002)
|
|
234
|
-
expect(subject.get_row_height(0)).to eq(30.0002)
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
it 'should make row height a number equivalent of the string passed if it is a string which is a number' do
|
|
238
|
-
subject.change_row_height(0, 30.0002)
|
|
239
|
-
expect(subject.get_row_height(0)).to eq(30.0002)
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
it 'should cause error if a negative argument is passed in' do
|
|
243
|
-
expect {
|
|
244
|
-
subject.change_row_height(-1, 30)
|
|
245
|
-
}.to raise_error(ArgumentError)
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
it 'should create a new row if it did not exist before' do
|
|
249
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
250
|
-
subject.change_row_height(11, 30)
|
|
251
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
252
|
-
expect(subject.get_row_height(11)).to eq(30)
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
describe '.change_row_horizontal_alignment' do
|
|
257
|
-
it 'should cause row and cells to horizontally align as specified by the passed in string' do
|
|
258
|
-
subject.change_row_horizontal_alignment(0, 'center')
|
|
259
|
-
expect(subject.get_row_alignment(0, true)).to eq('center')
|
|
260
|
-
expect(subject[0][5].horizontal_alignment).to eq('center')
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
it 'should cause error if a negative argument is passed in' do
|
|
264
|
-
expect {
|
|
265
|
-
subject.change_row_horizontal_alignment(-1, 'center')
|
|
266
|
-
}.to raise_error(ArgumentError)
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
it 'should create a new row if it did not exist before' do
|
|
270
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
271
|
-
subject.change_row_horizontal_alignment(11, 'center')
|
|
272
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
273
|
-
expect(subject.get_row_alignment(11, true)).to eq('center')
|
|
274
|
-
end
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
describe '.change_row_vertical_alignment' do
|
|
278
|
-
it 'should cause row and cells to vertically align as specified by the passed in string' do
|
|
279
|
-
subject.change_row_vertical_alignment(0, 'center')
|
|
280
|
-
expect(subject.get_row_alignment(0, false)).to eq('center')
|
|
281
|
-
expect(subject[0][5].vertical_alignment).to eq('center')
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
it 'should cause error if a negative argument is passed in' do
|
|
285
|
-
expect {
|
|
286
|
-
subject.change_row_vertical_alignment(-1, 'center')
|
|
287
|
-
}.to raise_error(ArgumentError)
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
it 'should create a new row if it did not exist before' do
|
|
291
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
292
|
-
subject.change_row_vertical_alignment(11, 'center')
|
|
293
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
294
|
-
expect(subject.get_row_alignment(11, false)).to eq('center')
|
|
295
|
-
end
|
|
296
|
-
end
|
|
297
|
-
|
|
298
|
-
describe '.change_row_border' do
|
|
299
|
-
it 'should cause error if a negative argument is passed in' do
|
|
300
|
-
expect {
|
|
301
|
-
subject.change_row_border(-1, :left, 'thin')
|
|
302
|
-
}.to raise_error(ArgumentError)
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
it 'should create a new row if it did not exist before' do
|
|
306
|
-
expect(subject.sheet_data[11]).to be_nil
|
|
307
|
-
subject.change_row_border(11, :left, 'thin')
|
|
308
|
-
expect(subject.sheet_data[11]).to be_a(RubyXL::Row)
|
|
309
|
-
expect(subject.get_row_border(11, :left)).to eq('thin')
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
it 'should cause row and cells to have border at top of specified weight' do
|
|
313
|
-
subject.change_row_border(0, :top, 'thin')
|
|
314
|
-
expect(subject.get_row_border(0, :top)).to eq('thin')
|
|
315
|
-
expect(subject[0][5].get_border(:top)).to eq('thin')
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
it 'should cause row and cells to have border at left of specified weight' do
|
|
319
|
-
subject.change_row_border(0, :left, 'thin')
|
|
320
|
-
expect(subject.get_row_border(0, :left)).to eq('thin')
|
|
321
|
-
expect(subject[0][5].get_border(:left)).to eq('thin')
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
it 'should cause row and cells to have border at right of specified weight' do
|
|
325
|
-
subject.change_row_border(0, :right, 'thin')
|
|
326
|
-
expect(subject.get_row_border(0, :right)).to eq('thin')
|
|
327
|
-
expect(subject[0][5].get_border(:right)).to eq('thin')
|
|
328
|
-
end
|
|
329
|
-
|
|
330
|
-
it 'should cause row to have border at bottom of specified weight' do
|
|
331
|
-
subject.change_row_border(0, :bottom, 'thin')
|
|
332
|
-
expect(subject.get_row_border(0, :bottom)).to eq('thin')
|
|
333
|
-
expect(subject[0][5].get_border(:bottom)).to eq('thin')
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
it 'should cause row to have border at diagonal of specified weight' do
|
|
337
|
-
subject.change_row_border(0, :diagonal, 'thin')
|
|
338
|
-
expect(subject.get_row_border(0, :diagonal)).to eq('thin')
|
|
339
|
-
expect(subject[0][5].get_border(:diagonal)).to eq('thin')
|
|
340
|
-
end
|
|
341
|
-
end
|
|
342
|
-
|
|
343
|
-
describe '.change_column_font_name' do
|
|
344
|
-
it 'should cause column and cell font names to match string passed in' do
|
|
345
|
-
subject.change_column_font_name(0, 'Arial')
|
|
346
|
-
expect(subject.get_column_font_name(0)).to eq('Arial')
|
|
347
|
-
expect(subject[5][0].font_name).to eq('Arial')
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
it 'should cause error if a negative argument is passed in' do
|
|
351
|
-
expect {
|
|
352
|
-
subject.change_column_font_name(-1, 'Arial')
|
|
353
|
-
}.to raise_error(ArgumentError)
|
|
354
|
-
end
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
describe '.change_column_font_size' do
|
|
358
|
-
it 'should make column and cell font sizes equal font number passed' do
|
|
359
|
-
subject.change_column_font_size(0, 20)
|
|
360
|
-
expect(subject.get_column_font_size(0)).to eq(20)
|
|
361
|
-
expect(subject[5][0].font_size).to eq(20)
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
it 'should cause an error if a string passed' do
|
|
365
|
-
expect {
|
|
366
|
-
subject.change_column_font_size(0, '20')
|
|
367
|
-
}.to raise_error(ArgumentError)
|
|
368
|
-
end
|
|
369
|
-
|
|
370
|
-
it 'should cause error if a negative argument is passed in' do
|
|
371
|
-
expect {
|
|
372
|
-
subject.change_column_font_size(-1, 20)
|
|
373
|
-
}.to raise_error(ArgumentError)
|
|
374
|
-
end
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
describe '.change_column_font_color' do
|
|
378
|
-
it 'should make column and cell font colors equal to font color passed' do
|
|
379
|
-
subject.change_column_font_color(0, '0f0f0f')
|
|
380
|
-
expect(subject.get_column_font_color(0)).to eq('0f0f0f')
|
|
381
|
-
expect(subject[5][0].font_color).to eq('0f0f0f')
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
it 'should raise error if hex color code not passed' do
|
|
385
|
-
expect {
|
|
386
|
-
subject.change_column_font_color(0, 'G')
|
|
387
|
-
}.to raise_error(ArgumentError)
|
|
388
|
-
end
|
|
389
|
-
|
|
390
|
-
it 'should raise error if hex color code includes # character' do
|
|
391
|
-
expect {
|
|
392
|
-
subject.change_column_font_color(0, '#FFF000')
|
|
393
|
-
}.to raise_error(ArgumentError)
|
|
394
|
-
end
|
|
395
|
-
|
|
396
|
-
it 'should cause error if a negative argument is passed in' do
|
|
397
|
-
expect {
|
|
398
|
-
subject.change_column_font_color(-1, '0f0f0f')
|
|
399
|
-
}.to raise_error(ArgumentError)
|
|
400
|
-
end
|
|
401
|
-
end
|
|
402
|
-
|
|
403
|
-
describe '.change_column_italics' do
|
|
404
|
-
it 'should make column and cell fonts italicized when true is passed' do
|
|
405
|
-
subject.change_column_italics(0, true)
|
|
406
|
-
expect(subject.is_column_italicized(0)).to eq(true)
|
|
407
|
-
expect(subject[5][0].is_italicized).to eq(true)
|
|
408
|
-
end
|
|
409
|
-
|
|
410
|
-
it 'should cause error if a negative argument is passed in' do
|
|
411
|
-
expect {
|
|
412
|
-
subject.change_column_italics(-1, false)
|
|
413
|
-
}.to raise_error(ArgumentError)
|
|
414
|
-
end
|
|
415
|
-
end
|
|
416
|
-
|
|
417
|
-
describe '.change_column_bold' do
|
|
418
|
-
it 'should make column and cell fonts bolded when true is passed' do
|
|
419
|
-
subject.change_column_bold(0, true)
|
|
420
|
-
expect(subject.is_column_bolded(0)).to eq(true)
|
|
421
|
-
expect(subject[5][0].is_bolded).to eq(true)
|
|
422
|
-
end
|
|
423
|
-
|
|
424
|
-
it 'should cause error if a negative argument is passed in' do
|
|
425
|
-
expect {
|
|
426
|
-
subject.change_column_bold(-1, false)
|
|
427
|
-
}.to raise_error(ArgumentError)
|
|
428
|
-
end
|
|
429
|
-
end
|
|
430
|
-
|
|
431
|
-
describe '.change_column_underline' do
|
|
432
|
-
it 'should make column and cell fonts underlined when true is passed' do
|
|
433
|
-
subject.change_column_underline(0, true)
|
|
434
|
-
expect(subject.is_column_underlined(0)).to eq(true)
|
|
435
|
-
expect(subject[5][0].is_underlined).to eq(true)
|
|
436
|
-
end
|
|
437
|
-
|
|
438
|
-
it 'should cause error if a negative argument is passed in' do
|
|
439
|
-
expect {
|
|
440
|
-
subject.change_column_underline(-1, false)
|
|
441
|
-
}.to raise_error(ArgumentError)
|
|
442
|
-
end
|
|
443
|
-
end
|
|
444
|
-
|
|
445
|
-
describe '.change_column_strikethrough' do
|
|
446
|
-
it 'should make column and cell fonts struckthrough when true is passed' do
|
|
447
|
-
subject.change_column_strikethrough(0, true)
|
|
448
|
-
expect(subject.is_column_struckthrough(0)).to eq(true)
|
|
449
|
-
expect(subject[5][0].is_struckthrough).to eq(true)
|
|
450
|
-
end
|
|
451
|
-
|
|
452
|
-
it 'should cause error if a negative argument is passed in' do
|
|
453
|
-
expect {
|
|
454
|
-
subject.change_column_strikethrough(-1, false)
|
|
455
|
-
}.to raise_error(ArgumentError)
|
|
456
|
-
end
|
|
457
|
-
end
|
|
458
|
-
|
|
459
|
-
describe '.change_column_width_raw' do
|
|
460
|
-
it 'should make column width match number which is passed' do
|
|
461
|
-
subject.change_column_width_raw(0, 30.0002)
|
|
462
|
-
expect(subject.get_column_width_raw(0)).to eq(30.0002)
|
|
463
|
-
end
|
|
464
|
-
|
|
465
|
-
it 'should cause error if a negative argument is passed in' do
|
|
466
|
-
expect {
|
|
467
|
-
subject.change_column_width_raw(-1, 10)
|
|
468
|
-
}.to raise_error(ArgumentError)
|
|
469
|
-
end
|
|
470
|
-
end
|
|
471
|
-
|
|
472
|
-
describe '.change_column_fill' do
|
|
473
|
-
it 'should raise error if hex color code not passed' do
|
|
474
|
-
expect {
|
|
475
|
-
subject.change_column_fill(0, 'G')
|
|
476
|
-
}.to raise_error(ArgumentError)
|
|
477
|
-
end
|
|
478
|
-
|
|
479
|
-
it 'should raise error if hex color code includes # character' do
|
|
480
|
-
expect {
|
|
481
|
-
subject.change_column_fill(3, '#FFF000')
|
|
482
|
-
}.to raise_error(ArgumentError)
|
|
483
|
-
end
|
|
484
|
-
|
|
485
|
-
it 'should make column and cell fill colors equal hex color code passed' do
|
|
486
|
-
subject.change_column_fill(0, '111111')
|
|
487
|
-
expect(subject.get_column_fill(0)).to eq('111111')
|
|
488
|
-
expect(subject[5][0].fill_color).to eq('111111')
|
|
489
|
-
end
|
|
490
|
-
|
|
491
|
-
it 'should cause error if a negative argument is passed in' do
|
|
492
|
-
expect {
|
|
493
|
-
subject.change_column_fill(-1, '111111')
|
|
494
|
-
}.to raise_error(ArgumentError)
|
|
495
|
-
end
|
|
496
|
-
end
|
|
497
|
-
|
|
498
|
-
describe '.change_column_horizontal_alignment' do
|
|
499
|
-
it 'should cause column and cell to horizontally align as specified by the passed in string' do
|
|
500
|
-
subject.change_column_horizontal_alignment(0, 'center')
|
|
501
|
-
expect(subject.get_column_alignment(0, :horizontal)).to eq('center')
|
|
502
|
-
expect(subject[5][0].horizontal_alignment).to eq('center')
|
|
503
|
-
end
|
|
504
|
-
|
|
505
|
-
it 'should cause error if a negative argument is passed in' do
|
|
506
|
-
expect {
|
|
507
|
-
subject.change_column_horizontal_alignment(-1, 'center')
|
|
508
|
-
}.to raise_error(ArgumentError)
|
|
509
|
-
end
|
|
510
|
-
end
|
|
511
|
-
|
|
512
|
-
describe '.change_column_vertical_alignment' do
|
|
513
|
-
it 'should cause column and cell to vertically align as specified by the passed in string' do
|
|
514
|
-
subject.change_column_vertical_alignment(0, 'center')
|
|
515
|
-
expect(subject.get_column_alignment(0, :vertical)).to eq('center')
|
|
516
|
-
expect(subject[5][0].vertical_alignment).to eq('center')
|
|
517
|
-
end
|
|
518
|
-
|
|
519
|
-
it 'should cause error if a negative argument is passed in' do
|
|
520
|
-
expect {
|
|
521
|
-
subject.change_column_vertical_alignment(-1, 'center')
|
|
522
|
-
}.to raise_error(ArgumentError)
|
|
523
|
-
end
|
|
524
|
-
|
|
525
|
-
it 'should set column width if column alignment is changed' do
|
|
526
|
-
test_column = 2
|
|
527
|
-
expect(subject.get_column_alignment(test_column, :vertical)).to be_nil
|
|
528
|
-
expect(subject.get_column_width_raw(test_column)).to be_nil
|
|
529
|
-
expect(subject.get_column_width(test_column)).to eq(RubyXL::ColumnRange::DEFAULT_WIDTH)
|
|
530
|
-
subject.change_column_vertical_alignment(test_column, 'top')
|
|
531
|
-
expect(subject.get_column_width_raw(test_column)).not_to be_nil
|
|
532
|
-
expect(subject.get_column_width(test_column)).to eq(RubyXL::ColumnRange::DEFAULT_WIDTH)
|
|
533
|
-
expect(subject.get_column_alignment(test_column, :vertical)).to eq('top')
|
|
534
|
-
end
|
|
535
|
-
end
|
|
536
|
-
|
|
537
|
-
describe '.change_column_border' do
|
|
538
|
-
it 'should cause error if a negative argument is passed in' do
|
|
539
|
-
expect {
|
|
540
|
-
subject.change_column_border(-1, :top, 'thin')
|
|
541
|
-
}.to raise_error(ArgumentError)
|
|
542
|
-
end
|
|
543
|
-
|
|
544
|
-
it 'should cause column and cells within to have border at top of specified weight' do
|
|
545
|
-
subject.change_column_border(0, :top, 'thin')
|
|
546
|
-
expect(subject.get_column_border(0, :top)).to eq('thin')
|
|
547
|
-
expect(subject[5][0].get_border(:top)).to eq('thin')
|
|
548
|
-
end
|
|
549
|
-
|
|
550
|
-
it 'should cause column and cells within to have border at left of specified weight' do
|
|
551
|
-
subject.change_column_border(0, :left, 'thin')
|
|
552
|
-
expect(subject.get_column_border(0, :left)).to eq('thin')
|
|
553
|
-
expect(subject[5][0].get_border(:left)).to eq('thin')
|
|
554
|
-
end
|
|
555
|
-
|
|
556
|
-
it 'should cause column and cells within to have border at right of specified weight' do
|
|
557
|
-
subject.change_column_border(0, :right, 'thin')
|
|
558
|
-
expect(subject.get_column_border(0, :right)).to eq('thin')
|
|
559
|
-
expect(subject[5][0].get_border(:right)).to eq('thin')
|
|
560
|
-
end
|
|
561
|
-
|
|
562
|
-
it 'should cause column and cells within to have border at bottom of specified weight' do
|
|
563
|
-
subject.change_column_border(0, :bottom, 'thin')
|
|
564
|
-
expect(subject.get_column_border(0, :bottom)).to eq('thin')
|
|
565
|
-
expect(subject[5][0].get_border(:bottom)).to eq('thin')
|
|
566
|
-
end
|
|
567
|
-
|
|
568
|
-
it 'should cause column and cells within to have border at diagonal of specified weight' do
|
|
569
|
-
subject.change_column_border(0, :diagonal, 'thin')
|
|
570
|
-
expect(subject.get_column_border(0, :diagonal)).to eq('thin')
|
|
571
|
-
expect(subject[5][0].get_border(:diagonal)).to eq('thin')
|
|
572
|
-
end
|
|
573
|
-
end
|
|
574
|
-
|
|
575
|
-
describe '.merge_cells' do
|
|
576
|
-
it 'should merge cells in any valid range specified by indices' do
|
|
577
|
-
subject.merge_cells(0, 1, 2, 3)
|
|
578
|
-
expect(subject.merged_cells.collect{ |r| r.ref.to_s }).to eq(['B1:D3'])
|
|
579
|
-
end
|
|
580
|
-
|
|
581
|
-
it 'should merge cells in any valid range specified by Reference' do
|
|
582
|
-
subject.merge_cells('A1:FF99')
|
|
583
|
-
expect(subject.merged_cells.collect{ |r| r.ref.to_s }).to eq(['A1:FF99'])
|
|
584
|
-
end
|
|
585
|
-
|
|
586
|
-
it 'should merge cells in any valid range specified by named params' do
|
|
587
|
-
subject.merge_cells(row_from: 0, row_to: 1, col_from: 2, col_to: 3)
|
|
588
|
-
expect(subject.merged_cells.collect{ |r| r.ref.to_s }).to eq(['C1:D2'])
|
|
589
|
-
end
|
|
590
|
-
end
|
|
591
|
-
|
|
592
|
-
describe '.add_cell' do
|
|
593
|
-
it 'should add new cell where specified, even if a cell is already there (default)' do
|
|
594
|
-
old_cell = subject[0][0]
|
|
595
|
-
old_cell_value = old_cell.value.to_s
|
|
596
|
-
|
|
597
|
-
subject.add_cell(0, 0, 'TEST')
|
|
598
|
-
expect(subject[0][0].value).not_to eq(old_cell_value)
|
|
599
|
-
expect(subject[0][0].value).to eq('TEST')
|
|
600
|
-
end
|
|
601
|
-
|
|
602
|
-
it 'should add a new cell below nil rows that might exist' do
|
|
603
|
-
subject.sheet_data.rows << nil << nil
|
|
604
|
-
subject.add_cell(15, 0, 'TEST')
|
|
605
|
-
expect(subject[15][0].value).to eq('TEST')
|
|
606
|
-
end
|
|
607
|
-
|
|
608
|
-
it 'should add new cell where specified with formula, even if a cell is already there (default)' do
|
|
609
|
-
old_cell = subject[0][0]
|
|
610
|
-
old_cell_value = old_cell.value.to_s
|
|
611
|
-
old_cell_formula = old_cell.formula.expression.to_s
|
|
612
|
-
|
|
613
|
-
subject.add_cell(0, 0, '', 'SUM(A2:A10)')
|
|
614
|
-
expect(subject[0][0].value).not_to eq(old_cell_value)
|
|
615
|
-
expect(subject[0][0].formula).not_to eq(old_cell_formula)
|
|
616
|
-
expect(subject[0][0].value).to eq('')
|
|
617
|
-
expect(subject[0][0].formula.expression).to eq('SUM(A2:A10)')
|
|
618
|
-
end
|
|
619
|
-
|
|
620
|
-
it 'should not overwrite when a cell is present when overwrite is specified to be false' do
|
|
621
|
-
old_cell = subject[0][0]
|
|
622
|
-
old_cell_value = old_cell.value.to_s
|
|
623
|
-
old_cell_formula = old_cell.formula.expression.to_s
|
|
624
|
-
|
|
625
|
-
subject.add_cell(0, 0, 'TEST', 'B2', false)
|
|
626
|
-
expect(subject[0][0].value).to eq(old_cell_value)
|
|
627
|
-
expect(subject[0][0].formula.expression.to_s).to eq(old_cell_formula)
|
|
628
|
-
end
|
|
629
|
-
|
|
630
|
-
it 'should still add a new cell when there is no cell to be overwritten' do
|
|
631
|
-
subject.add_cell(11, 11, 'TEST', 'B2', false)
|
|
632
|
-
expect(subject[11][11].value).to eq('TEST')
|
|
633
|
-
expect(subject[11][11].formula.expression).to eq('B2')
|
|
634
|
-
end
|
|
635
|
-
|
|
636
|
-
it 'should add boolean cells' do
|
|
637
|
-
subject.add_cell(0, 0, true)
|
|
638
|
-
subject.add_cell(1, 0, false)
|
|
639
|
-
expect(subject[0][0].datatype).to eq(RubyXL::DataType::BOOLEAN)
|
|
640
|
-
expect(subject[0][0].value).to eq(1)
|
|
641
|
-
expect(subject[1][0].value).to eq(0)
|
|
642
|
-
end
|
|
643
|
-
|
|
644
|
-
it 'should cause error if a negative argument is passed in' do
|
|
645
|
-
expect {
|
|
646
|
-
subject.add_cell(-1, -1, '')
|
|
647
|
-
}.to raise_error(ArgumentError)
|
|
648
|
-
end
|
|
649
|
-
end
|
|
650
|
-
|
|
651
|
-
describe '.delete_row' do
|
|
652
|
-
it 'should delete a row at index specified, "pushing" everything else "up"' do
|
|
653
|
-
subject.delete_row(0)
|
|
654
|
-
expect(subject[0][0].value).to eq('0:1')
|
|
655
|
-
expect(subject[0][0].formula.expression.to_s).to eq('F0:1')
|
|
656
|
-
expect(subject[0][0].row).to eq(0)
|
|
657
|
-
expect(subject[0][0].column).to eq(0)
|
|
658
|
-
end
|
|
659
|
-
|
|
660
|
-
it 'should delete a row at index specified, adjusting styles for other rows' do
|
|
661
|
-
subject.change_row_font_name(1, 'Courier')
|
|
662
|
-
subject.delete_row(0)
|
|
663
|
-
expect(subject.get_row_font_name(0)).to eq('Courier')
|
|
664
|
-
end
|
|
665
|
-
|
|
666
|
-
it 'should preserve (rather than fix) formulas that reference cells in "pushed up" rows' do
|
|
667
|
-
subject.add_cell(11, 0, nil, 'SUM(A1:A10)')
|
|
668
|
-
subject.delete_row(0)
|
|
669
|
-
expect(subject[10][0].formula.expression).to eq('SUM(A1:A10)')
|
|
670
|
-
end
|
|
671
|
-
|
|
672
|
-
it 'should cause error if a negative argument is passed in' do
|
|
673
|
-
expect {
|
|
674
|
-
subject.delete_row(-1)
|
|
675
|
-
}.to raise_error(ArgumentError)
|
|
676
|
-
end
|
|
677
|
-
|
|
678
|
-
it 'should properly reindex the cells' do
|
|
679
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
680
|
-
if (r == SKIP_ROW_COL) then
|
|
681
|
-
expect(row).to be_nil
|
|
682
|
-
else
|
|
683
|
-
row.cells.each_with_index { |cell, c|
|
|
684
|
-
if (c == SKIP_ROW_COL) then
|
|
685
|
-
expect(cell).to be_nil
|
|
686
|
-
else
|
|
687
|
-
expect(cell.row).to eq(r)
|
|
688
|
-
expect(cell.column).to eq(c)
|
|
689
|
-
end
|
|
690
|
-
}
|
|
691
|
-
end
|
|
692
|
-
}
|
|
693
|
-
end
|
|
694
|
-
|
|
695
|
-
describe 'merged_cells updating' do
|
|
696
|
-
context 'merged cells in the row' do
|
|
697
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
698
|
-
# | A2 | MERGED | E2 |
|
|
699
|
-
# | A3 | B3 | C3 | D3 | E3 |
|
|
700
|
-
before do
|
|
701
|
-
subject.merge_cells(1, 1, 1, 3)
|
|
702
|
-
expect(subject.merged_cells.size).to eq 1
|
|
703
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D2'
|
|
704
|
-
end
|
|
705
|
-
it 'should delete merged cell' do
|
|
706
|
-
subject.delete_row(1)
|
|
707
|
-
expect(subject.merged_cells.size).to eq 0
|
|
708
|
-
end
|
|
709
|
-
end
|
|
710
|
-
context 'merged vertical two cells' do
|
|
711
|
-
# | A1 | B1 | C1 |
|
|
712
|
-
# | A2 | MERGED | C2 |
|
|
713
|
-
# | A3 | | C3 |
|
|
714
|
-
# | A4 | B4 | C4 |
|
|
715
|
-
before do
|
|
716
|
-
subject.merge_cells(1, 1, 2, 1)
|
|
717
|
-
expect(subject.merged_cells.size).to eq 1
|
|
718
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:B3'
|
|
719
|
-
end
|
|
720
|
-
it 'should delete merged cell' do
|
|
721
|
-
subject.delete_row(1)
|
|
722
|
-
expect(subject.merged_cells.size).to eq 0
|
|
723
|
-
end
|
|
724
|
-
end
|
|
725
|
-
|
|
726
|
-
context 'merged three or more rows' do
|
|
727
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
728
|
-
# | A2 | | E2 |
|
|
729
|
-
# | A3 | MERGED | E3 |
|
|
730
|
-
# | A4 | | E4 |
|
|
731
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
732
|
-
before do
|
|
733
|
-
subject.merge_cells(1, 1, 3, 3)
|
|
734
|
-
expect(subject.merged_cells.size).to eq 1
|
|
735
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D4'
|
|
736
|
-
end
|
|
737
|
-
|
|
738
|
-
# | A2 | | E2 |
|
|
739
|
-
# | A3 | MERGED | E3 |
|
|
740
|
-
# | A4 | | E4 |
|
|
741
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
742
|
-
it 'should updates merged cell when delete above the cell' do
|
|
743
|
-
subject.delete_row(0)
|
|
744
|
-
expect(subject.merged_cells.size).to eq 1
|
|
745
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B1:D3'
|
|
746
|
-
end
|
|
747
|
-
|
|
748
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
749
|
-
# | A3 | MERGED | E3 |
|
|
750
|
-
# | A4 | | E4 |
|
|
751
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
752
|
-
it 'should updates merged cell when delete top of the cell' do
|
|
753
|
-
subject.delete_row(1)
|
|
754
|
-
expect(subject.merged_cells.size).to eq 1
|
|
755
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D3'
|
|
756
|
-
end
|
|
757
|
-
|
|
758
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
759
|
-
# | A2 | MERGED | E2 |
|
|
760
|
-
# | A4 | | E4 |
|
|
761
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
762
|
-
it 'should updates merged cell when delete middle of the cell' do
|
|
763
|
-
subject.delete_row(2)
|
|
764
|
-
expect(subject.merged_cells.size).to eq 1
|
|
765
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D3'
|
|
766
|
-
end
|
|
767
|
-
|
|
768
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
769
|
-
# | A2 | MERGED | E2 |
|
|
770
|
-
# | A3 | | E3 |
|
|
771
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
772
|
-
it 'should updates merged cell when delete bottom of the cell' do
|
|
773
|
-
subject.delete_row(3)
|
|
774
|
-
expect(subject.merged_cells.size).to eq 1
|
|
775
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D3'
|
|
776
|
-
end
|
|
777
|
-
|
|
778
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
779
|
-
# | A2 | | E2 |
|
|
780
|
-
# | A3 | MERGED | E3 |
|
|
781
|
-
# | A4 | | E4 |
|
|
782
|
-
it 'should not updates merged cell when ldelete below the cell' do
|
|
783
|
-
subject.delete_row(4)
|
|
784
|
-
expect(subject.merged_cells.size).to eq 1
|
|
785
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D4'
|
|
786
|
-
end
|
|
787
|
-
end
|
|
788
|
-
end
|
|
789
|
-
|
|
790
|
-
it 'should not make empty merged_cells when a worksheet does not have a merged cell' do
|
|
791
|
-
# If a worksheet has empty merged_cells, the xlsx file has an XML error and has to repair.
|
|
792
|
-
subject.delete_row(0)
|
|
793
|
-
expect(subject.merged_cells).to be_nil
|
|
794
|
-
end
|
|
795
|
-
end
|
|
796
|
-
|
|
797
|
-
describe '.insert_row' do
|
|
798
|
-
it 'should insert a row at index specified, "pushing" everything else "down"' do
|
|
799
|
-
old_cell = subject[0][0]
|
|
800
|
-
old_cell_value = old_cell.value.to_s
|
|
801
|
-
old_cell_formula = old_cell.formula.expression.to_s
|
|
802
|
-
|
|
803
|
-
subject.insert_row(0)
|
|
804
|
-
expect(subject[0][0]).to be_nil
|
|
805
|
-
expect(subject[1][0].value).to eq(old_cell_value)
|
|
806
|
-
expect(subject[1][0].formula.expression.to_s).to eq(old_cell_formula)
|
|
807
|
-
|
|
808
|
-
subject.insert_row(7)
|
|
809
|
-
expect(subject[7][0].is_underlined).to be_nil
|
|
810
|
-
end
|
|
811
|
-
|
|
812
|
-
it 'should insert a row skipping nil rows that might exist' do
|
|
813
|
-
subject.sheet_data.rows << nil << nil
|
|
814
|
-
rows = subject.sheet_data.rows.size
|
|
815
|
-
subject.insert_row(rows)
|
|
816
|
-
expect(subject[rows - 1]).to be_nil
|
|
817
|
-
end
|
|
818
|
-
|
|
819
|
-
it 'should insert a row at index specified, copying styles from row "above"' do
|
|
820
|
-
subject.change_row_font_name(0, 'Courier')
|
|
821
|
-
subject.insert_row(1)
|
|
822
|
-
expect(subject.get_row_font_name(1)).to eq('Courier')
|
|
823
|
-
end
|
|
824
|
-
|
|
825
|
-
it 'should preserve (rather than fix) formulas that reference cells "pushed down" rows' do
|
|
826
|
-
subject.add_cell(5, 0, nil, 'SUM(A1:A4)')
|
|
827
|
-
subject.insert_row(0)
|
|
828
|
-
expect(subject[6][0].formula.expression).to eq('SUM(A1:A4)')
|
|
829
|
-
end
|
|
830
|
-
|
|
831
|
-
it 'should cause error if a negative argument is passed in' do
|
|
832
|
-
expect {
|
|
833
|
-
subject.insert_row(-1)
|
|
834
|
-
}.to raise_error(ArgumentError)
|
|
835
|
-
end
|
|
836
|
-
|
|
837
|
-
it 'should expand matrix to fit argument if nonnegative' do
|
|
838
|
-
expect(subject.sheet_data.size).to eq(11)
|
|
839
|
-
subject.insert_row(11)
|
|
840
|
-
expect(subject.sheet_data.size).to eq(13)
|
|
841
|
-
end
|
|
842
|
-
|
|
843
|
-
it 'should properly reindex the cells' do
|
|
844
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
845
|
-
if (r == SKIP_ROW_COL) then
|
|
846
|
-
expect(row).to be_nil
|
|
847
|
-
else
|
|
848
|
-
row.cells.each_with_index { |cell, c|
|
|
849
|
-
if (c == SKIP_ROW_COL) then
|
|
850
|
-
expect(cell).to be_nil
|
|
851
|
-
else
|
|
852
|
-
expect(cell.row).to eq(r)
|
|
853
|
-
expect(cell.column).to eq(c)
|
|
854
|
-
end
|
|
855
|
-
}
|
|
856
|
-
end
|
|
857
|
-
}
|
|
858
|
-
end
|
|
859
|
-
|
|
860
|
-
describe 'merged_cells updating' do
|
|
861
|
-
# | A1 | B1 | C1 | D1 |
|
|
862
|
-
# | A2 | MERGED | D2 |
|
|
863
|
-
# | A3 | | D3 |
|
|
864
|
-
# | A4 | B4 | C4 | D4 |
|
|
865
|
-
before do
|
|
866
|
-
subject.merge_cells(1, 1, 2, 2)
|
|
867
|
-
expect(subject.merged_cells.size).to eq 1
|
|
868
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C3'
|
|
869
|
-
end
|
|
870
|
-
|
|
871
|
-
# | A1 | B1 | C1 | D1 |
|
|
872
|
-
# | | | | |
|
|
873
|
-
# | A2 | MERGED | D2 |
|
|
874
|
-
# | A3 | | D3 |
|
|
875
|
-
# | A4 | B4 | C4 | D4 |
|
|
876
|
-
it 'should updates merged cell when insert above the cell' do
|
|
877
|
-
subject.insert_row(1)
|
|
878
|
-
expect(subject.merged_cells.size).to eq 1
|
|
879
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B3:C4'
|
|
880
|
-
end
|
|
881
|
-
|
|
882
|
-
# | A1 | B1 | C1 | D1 |
|
|
883
|
-
# | A2 | | D2 |
|
|
884
|
-
# | | MERGED | |
|
|
885
|
-
# | A3 | | D3 |
|
|
886
|
-
# | A4 | B4 | C4 | D4 |
|
|
887
|
-
it 'should updates merged cell when insert into the cell' do
|
|
888
|
-
subject.insert_row(2)
|
|
889
|
-
expect(subject.merged_cells.size).to eq 1
|
|
890
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C4'
|
|
891
|
-
end
|
|
892
|
-
|
|
893
|
-
# | A1 | B1 | C1 | D1 |
|
|
894
|
-
# | A2 | MERGED | D2 |
|
|
895
|
-
# | A3 | | D3 |
|
|
896
|
-
# | | | | |
|
|
897
|
-
# | A4 | B4 | C4 | D4 |
|
|
898
|
-
it 'should not updates merged cell when insert below the cell' do
|
|
899
|
-
subject.insert_row(3)
|
|
900
|
-
expect(subject.merged_cells.size).to eq 1
|
|
901
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C3'
|
|
902
|
-
end
|
|
903
|
-
end
|
|
904
|
-
|
|
905
|
-
it 'should not make empty merged_cells when a worksheet does not have a merged cell' do
|
|
906
|
-
# If a worksheet has empty merged_cells, the xlsx file has an XML error and has to repair.
|
|
907
|
-
subject.insert_row(0)
|
|
908
|
-
expect(subject.merged_cells).to be_nil
|
|
909
|
-
end
|
|
910
|
-
end
|
|
911
|
-
|
|
912
|
-
describe '.delete_column' do
|
|
913
|
-
it 'should delete a column at index specified, "pushing" everything else "left"' do
|
|
914
|
-
subject.delete_column(0)
|
|
915
|
-
expect(subject[0][0].value).to eq('1:0')
|
|
916
|
-
expect(subject[0][0].formula.expression.to_s).to eq('F1:0')
|
|
917
|
-
expect(subject[0][0].row).to eq(0)
|
|
918
|
-
end
|
|
919
|
-
|
|
920
|
-
it 'should delete a column at index specified, "pushing" styles "left"' do
|
|
921
|
-
subject.change_column_font_name(1, 'Courier')
|
|
922
|
-
subject.delete_column(0)
|
|
923
|
-
expect(subject.get_column_font_name(0)).to eq('Courier')
|
|
924
|
-
end
|
|
925
|
-
|
|
926
|
-
it 'should preserve (rather than fix) formulas that reference cells in "pushed left" columns' do
|
|
927
|
-
subject.add_cell(0, 4, nil, 'SUM(A1:D1)')
|
|
928
|
-
subject.delete_column(0)
|
|
929
|
-
expect(subject[0][3].formula.expression).to eq('SUM(A1:D1)')
|
|
930
|
-
end
|
|
931
|
-
|
|
932
|
-
it 'should update cell indices after deleting the column' do
|
|
933
|
-
subject.delete_column(2)
|
|
934
|
-
|
|
935
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
936
|
-
if (r == SKIP_ROW_COL) then
|
|
937
|
-
expect(row).to be_nil
|
|
938
|
-
else
|
|
939
|
-
row.cells.each_with_index { |cell, c|
|
|
940
|
-
if (SKIP_ROW_COL - 1 == c) then
|
|
941
|
-
expect(cell).to be_nil
|
|
942
|
-
else
|
|
943
|
-
expect(cell.row).to eq(r)
|
|
944
|
-
expect(cell.column).to eq(c)
|
|
945
|
-
end
|
|
946
|
-
}
|
|
947
|
-
end
|
|
948
|
-
}
|
|
949
|
-
end
|
|
950
|
-
|
|
951
|
-
it 'should cause error if negative argument is passed in' do
|
|
952
|
-
expect {
|
|
953
|
-
subject.delete_column(-1)
|
|
954
|
-
}.to raise_error(ArgumentError)
|
|
955
|
-
end
|
|
956
|
-
|
|
957
|
-
it 'should properly reindex the cells' do
|
|
958
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
959
|
-
if (r == SKIP_ROW_COL) then
|
|
960
|
-
expect(row).to be_nil
|
|
961
|
-
else
|
|
962
|
-
row.cells.each_with_index { |cell, c|
|
|
963
|
-
if (c == SKIP_ROW_COL) then
|
|
964
|
-
expect(cell).to be_nil
|
|
965
|
-
else
|
|
966
|
-
expect(cell.row).to eq(r)
|
|
967
|
-
expect(cell.column).to eq(c)
|
|
968
|
-
end
|
|
969
|
-
}
|
|
970
|
-
end
|
|
971
|
-
}
|
|
972
|
-
end
|
|
973
|
-
|
|
974
|
-
describe 'merged_cells updating' do
|
|
975
|
-
context 'merged cells in the column' do
|
|
976
|
-
# | A1 | B1 | C1 |
|
|
977
|
-
# | A2 | | C2 |
|
|
978
|
-
# | A3 | MERGED | C3 |
|
|
979
|
-
# | A4 | | C4 |
|
|
980
|
-
# | A5 | B5 | C5 |
|
|
981
|
-
before do
|
|
982
|
-
subject.merge_cells(1, 1, 3, 1)
|
|
983
|
-
expect(subject.merged_cells.size).to eq 1
|
|
984
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:B4'
|
|
985
|
-
end
|
|
986
|
-
it 'should delete merged cell' do
|
|
987
|
-
subject.delete_column(1)
|
|
988
|
-
expect(subject.merged_cells.size).to eq 0
|
|
989
|
-
end
|
|
990
|
-
end
|
|
991
|
-
context 'merged horizontal two cells' do
|
|
992
|
-
# | A1 | B1 | C1 | D1 |
|
|
993
|
-
# | A2 | MERGED | D2 |
|
|
994
|
-
# | A3 | B3 | C3 | D3 |
|
|
995
|
-
before do
|
|
996
|
-
subject.merge_cells(1, 1, 1, 2)
|
|
997
|
-
expect(subject.merged_cells.size).to eq 1
|
|
998
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C2'
|
|
999
|
-
end
|
|
1000
|
-
it 'should delete merged cell' do
|
|
1001
|
-
subject.delete_column(1)
|
|
1002
|
-
expect(subject.merged_cells.size).to eq 0
|
|
1003
|
-
end
|
|
1004
|
-
end
|
|
1005
|
-
context 'merged three or more columns' do
|
|
1006
|
-
# | A1 | B1 | C1 | D1 | E1 |
|
|
1007
|
-
# | A2 | | E2 |
|
|
1008
|
-
# | A3 | MERGED | E3 |
|
|
1009
|
-
# | A4 | | E4 |
|
|
1010
|
-
# | A5 | B5 | C5 | D5 | E5 |
|
|
1011
|
-
before do
|
|
1012
|
-
subject.merge_cells(1, 1, 3, 3)
|
|
1013
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1014
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D4'
|
|
1015
|
-
end
|
|
1016
|
-
# | B1 | C1 | D1 | E1 |
|
|
1017
|
-
# | | E2 |
|
|
1018
|
-
# | MERGED | E3 |
|
|
1019
|
-
# | | E4 |
|
|
1020
|
-
# | B5 | C5 | D5 | E5 |
|
|
1021
|
-
it 'should updates merged cell when delete before the cell' do
|
|
1022
|
-
subject.delete_column(0)
|
|
1023
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1024
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'A2:C4'
|
|
1025
|
-
end
|
|
1026
|
-
# | A1 | C1 | D1 | E1 |
|
|
1027
|
-
# | A2 | | E2 |
|
|
1028
|
-
# | A3 | MERGED | E3 |
|
|
1029
|
-
# | A4 | | E4 |
|
|
1030
|
-
# | A5 | C5 | D5 | E5 |
|
|
1031
|
-
it 'should updates merged cell when delete left of the cell' do
|
|
1032
|
-
subject.delete_column(1)
|
|
1033
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1034
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C4'
|
|
1035
|
-
end
|
|
1036
|
-
# | A1 | B1 | D1 | E1 |
|
|
1037
|
-
# | A2 | | E2 |
|
|
1038
|
-
# | A3 | MERGED | E3 |
|
|
1039
|
-
# | A4 | | E4 |
|
|
1040
|
-
# | A5 | B5 | D5 | E5 |
|
|
1041
|
-
it 'should updates merged cell when delete center of the cell' do
|
|
1042
|
-
subject.delete_column(2)
|
|
1043
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1044
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C4'
|
|
1045
|
-
end
|
|
1046
|
-
# | A1 | B1 | C1 | E1 |
|
|
1047
|
-
# | A2 | | E2 |
|
|
1048
|
-
# | A3 | MERGED | E3 |
|
|
1049
|
-
# | A4 | | E4 |
|
|
1050
|
-
# | A5 | B5 | C5 | E5 |
|
|
1051
|
-
it 'should updates merged cell when delete right of the cell' do
|
|
1052
|
-
subject.delete_column(3)
|
|
1053
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1054
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C4'
|
|
1055
|
-
end
|
|
1056
|
-
# | A1 | B1 | C1 | D1 |
|
|
1057
|
-
# | A2 | |
|
|
1058
|
-
# | A3 | MERGED |
|
|
1059
|
-
# | A4 | |
|
|
1060
|
-
# | A5 | B5 | C5 | D5 |
|
|
1061
|
-
it 'should not updates merged cell when delete after the cell' do
|
|
1062
|
-
subject.delete_column(4)
|
|
1063
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1064
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D4'
|
|
1065
|
-
end
|
|
1066
|
-
end
|
|
1067
|
-
end
|
|
1068
|
-
|
|
1069
|
-
it 'should not make empty merged_cells when a worksheet does not have a merged cell' do
|
|
1070
|
-
# If a worksheet has empty merged_cells, the xlsx file has an XML error and has to repair.
|
|
1071
|
-
subject.delete_column(0)
|
|
1072
|
-
expect(subject.merged_cells).to be_nil
|
|
1073
|
-
end
|
|
1074
|
-
end
|
|
1075
|
-
|
|
1076
|
-
describe '.insert_column' do
|
|
1077
|
-
it 'should insert a column at index specified, "pushing" everything else "right"' do
|
|
1078
|
-
old_cell = subject[0][0]
|
|
1079
|
-
old_cell_value = old_cell.value.to_s
|
|
1080
|
-
old_cell_formula = old_cell.formula.expression.to_s
|
|
1081
|
-
|
|
1082
|
-
subject.insert_column(0)
|
|
1083
|
-
expect(subject[0][0]).to be_nil
|
|
1084
|
-
expect(subject[0][1].value).to eq(old_cell_value)
|
|
1085
|
-
expect(subject[0][1].formula.expression.to_s).to eq(old_cell_formula)
|
|
1086
|
-
end
|
|
1087
|
-
|
|
1088
|
-
it 'should insert a column at index specified, copying styles from column to "left"' do
|
|
1089
|
-
subject.change_column_font_name(0, 'Courier')
|
|
1090
|
-
subject.insert_column(1)
|
|
1091
|
-
expect(subject.get_column_font_name(1)).to eq('Courier')
|
|
1092
|
-
end
|
|
1093
|
-
|
|
1094
|
-
it 'should insert a column at 0 without copying any styles, when passed 0 as column index' do
|
|
1095
|
-
subject.change_column_font_name(0, 'Courier')
|
|
1096
|
-
subject.insert_column(0)
|
|
1097
|
-
expect(subject.get_column_font_name(0)).to eq('Verdana') # not courier
|
|
1098
|
-
end
|
|
1099
|
-
|
|
1100
|
-
it 'should preserve (rather than fix) formulas that reference cells in "pushed right" column' do
|
|
1101
|
-
subject.add_cell(0, 5, nil, 'SUM(A1:D1)')
|
|
1102
|
-
subject.insert_column(0)
|
|
1103
|
-
expect(subject[0][6].formula.expression).to eq('SUM(A1:D1)')
|
|
1104
|
-
end
|
|
1105
|
-
|
|
1106
|
-
it 'should update cell indices after deleting the column' do
|
|
1107
|
-
subject.insert_column(5)
|
|
1108
|
-
subject[0].cells.each_with_index { |cell, i|
|
|
1109
|
-
next if cell.nil?
|
|
1110
|
-
expect(cell.column).to eq(i)
|
|
1111
|
-
}
|
|
1112
|
-
end
|
|
1113
|
-
|
|
1114
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1115
|
-
expect {
|
|
1116
|
-
subject.insert_column(-1)
|
|
1117
|
-
}.to raise_error(ArgumentError)
|
|
1118
|
-
end
|
|
1119
|
-
|
|
1120
|
-
it 'should properly reindex the cells' do
|
|
1121
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
1122
|
-
if (r == SKIP_ROW_COL) then
|
|
1123
|
-
expect(row).to be_nil
|
|
1124
|
-
else
|
|
1125
|
-
row.cells.each_with_index { |cell, c|
|
|
1126
|
-
if (c == SKIP_ROW_COL) 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
|
|
1134
|
-
}
|
|
1135
|
-
end
|
|
1136
|
-
|
|
1137
|
-
describe 'merged_cells updating' do
|
|
1138
|
-
# | A1 | B1 | C1 | D1 |
|
|
1139
|
-
# | A2 | MERGED | D2 |
|
|
1140
|
-
# | A3 | | D3 |
|
|
1141
|
-
# | A4 | B4 | C4 | D4 |
|
|
1142
|
-
before do
|
|
1143
|
-
subject.merge_cells(1, 1, 2, 2)
|
|
1144
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1145
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C3'
|
|
1146
|
-
end
|
|
1147
|
-
|
|
1148
|
-
# | A1 | | B1 | C1 | D1 |
|
|
1149
|
-
# | A2 | | MERGED | D2 |
|
|
1150
|
-
# | A3 | | | D3 |
|
|
1151
|
-
# | A4 | | B4 | C4 | D4 |
|
|
1152
|
-
it 'should updates merged cell when insert before the cell' do
|
|
1153
|
-
subject.insert_column(1)
|
|
1154
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1155
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'C2:D3'
|
|
1156
|
-
end
|
|
1157
|
-
|
|
1158
|
-
# | A1 | B1 | | C1 | D1 |
|
|
1159
|
-
# | A2 | MERGED | D2 |
|
|
1160
|
-
# | A3 | | D3 |
|
|
1161
|
-
# | A4 | B4 | | C4 | D4 |
|
|
1162
|
-
it 'should updates merged cell when insert into the cell' do
|
|
1163
|
-
subject.insert_column(2)
|
|
1164
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1165
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:D3'
|
|
1166
|
-
end
|
|
1167
|
-
|
|
1168
|
-
# | A1 | B1 | C1 | | D1 |
|
|
1169
|
-
# | A2 | MERGED | | D2 |
|
|
1170
|
-
# | A3 | | | D3 |
|
|
1171
|
-
# | A4 | B4 | C4 | | D4 |
|
|
1172
|
-
it 'should not updates merged cell when insert after the cell' do
|
|
1173
|
-
subject.insert_column(3)
|
|
1174
|
-
expect(subject.merged_cells.size).to eq 1
|
|
1175
|
-
expect(subject.merged_cells.first.ref.to_s).to eq 'B2:C3'
|
|
1176
|
-
end
|
|
1177
|
-
end
|
|
1178
|
-
|
|
1179
|
-
it 'should not make empty merged_cells when a worksheet does not have a merged cell' do
|
|
1180
|
-
# If a worksheet has empty merged_cells, the xlsx file has an XML error and has to repair.
|
|
1181
|
-
subject.insert_column(0)
|
|
1182
|
-
expect(subject.merged_cells).to be_nil
|
|
1183
|
-
end
|
|
1184
|
-
end
|
|
1185
|
-
|
|
1186
|
-
describe '.insert_cell' do
|
|
1187
|
-
it 'should simply add a cell if no shift argument is specified' do
|
|
1188
|
-
subject.insert_cell(0, 0, 'test')
|
|
1189
|
-
expect(subject[0][0].value).to eq('test')
|
|
1190
|
-
expect(subject[0][1].value).to eq('1:0')
|
|
1191
|
-
expect(subject[1][0].value).to eq('0:1')
|
|
1192
|
-
end
|
|
1193
|
-
|
|
1194
|
-
it 'should shift cells to the right if :right is specified' do
|
|
1195
|
-
subject.insert_cell(0, 0, 'test', nil, :right)
|
|
1196
|
-
expect(subject[0][0].value).to eq('test')
|
|
1197
|
-
expect(subject[0][1].value).to eq('0:0')
|
|
1198
|
-
expect(subject[1][0].value).to eq('0:1')
|
|
1199
|
-
end
|
|
1200
|
-
|
|
1201
|
-
it 'should update cell indices after inserting the cell' do
|
|
1202
|
-
subject.insert_cell(0, 0, 'test', nil, :right)
|
|
1203
|
-
subject.sheet_data.rows.each_with_index { |row, r|
|
|
1204
|
-
if (r == SKIP_ROW_COL) then
|
|
1205
|
-
expect(row).to be_nil
|
|
1206
|
-
else
|
|
1207
|
-
row.cells.each_with_index { |cell, c|
|
|
1208
|
-
if ((r == 0) && (SKIP_ROW_COL + 1 == c)) || ((r != 0) && (c == SKIP_ROW_COL)) then
|
|
1209
|
-
expect(cell).to be_nil
|
|
1210
|
-
else
|
|
1211
|
-
expect(cell.row).to eq(r)
|
|
1212
|
-
expect(cell.column).to eq(c)
|
|
1213
|
-
end
|
|
1214
|
-
}
|
|
1215
|
-
end
|
|
1216
|
-
}
|
|
1217
|
-
end
|
|
1218
|
-
|
|
1219
|
-
it 'should shift cells down if :down is specified' do
|
|
1220
|
-
subject.insert_cell(0, 0, 'test', nil, :down)
|
|
1221
|
-
expect(subject[0][0].value).to eq('test')
|
|
1222
|
-
expect(subject[0][1].value).to eq('1:0')
|
|
1223
|
-
expect(subject[1][0].value).to eq('0:0')
|
|
1224
|
-
end
|
|
1225
|
-
|
|
1226
|
-
it 'should cause error if shift argument is specified which is not :right or :down' do
|
|
1227
|
-
expect {
|
|
1228
|
-
subject.insert_cell(0, 0, 'test', nil, :up)
|
|
1229
|
-
}.to raise_error(ArgumentError)
|
|
1230
|
-
end
|
|
1231
|
-
|
|
1232
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1233
|
-
expect {
|
|
1234
|
-
subject.insert_cell(-1, -1)
|
|
1235
|
-
}.to raise_error(ArgumentError)
|
|
1236
|
-
end
|
|
1237
|
-
end
|
|
1238
|
-
|
|
1239
|
-
describe '.delete_cell' do
|
|
1240
|
-
it 'should make a cell nil if no shift argument specified' do
|
|
1241
|
-
old_cell = subject[0][0].inspect
|
|
1242
|
-
|
|
1243
|
-
deleted = subject.delete_cell(0, 0)
|
|
1244
|
-
expect(subject[0][0]).to be_nil
|
|
1245
|
-
expect(old_cell).to eq(deleted.inspect)
|
|
1246
|
-
end
|
|
1247
|
-
|
|
1248
|
-
it 'should return nil if a cell which is out of range is specified' do
|
|
1249
|
-
expect(subject.delete_cell(12, 12)).to be_nil
|
|
1250
|
-
end
|
|
1251
|
-
|
|
1252
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1253
|
-
expect {
|
|
1254
|
-
subject.delete_cell(-1, -1)
|
|
1255
|
-
}.to raise_error(ArgumentError)
|
|
1256
|
-
end
|
|
1257
|
-
|
|
1258
|
-
it 'should shift cells to the right of the deleted cell left if :left is specified' do
|
|
1259
|
-
subject.delete_cell(0, 0, :left)
|
|
1260
|
-
expect(subject[0][0].value).to eq('1:0')
|
|
1261
|
-
end
|
|
1262
|
-
|
|
1263
|
-
it 'should update cell indices after deleting the cell' do
|
|
1264
|
-
subject.delete_cell(4, 0, :left)
|
|
1265
|
-
subject[0].cells.each_with_index { |cell, i|
|
|
1266
|
-
if i == SKIP_ROW_COL then
|
|
1267
|
-
expect(cell).to be_nil
|
|
1268
|
-
else
|
|
1269
|
-
expect(cell.column).to eq(i)
|
|
1270
|
-
end
|
|
1271
|
-
}
|
|
1272
|
-
end
|
|
1273
|
-
|
|
1274
|
-
it 'should shift cells below the deleted cell up if :up is specified' do
|
|
1275
|
-
subject.delete_cell(0, 0, :up)
|
|
1276
|
-
expect(subject[0][0].value).to eq('0:1')
|
|
1277
|
-
end
|
|
1278
|
-
|
|
1279
|
-
it 'should cause en error if an argument other than :left, :up, or nil is specified for shift' do
|
|
1280
|
-
expect {
|
|
1281
|
-
subject.delete_cell(0, 0, :down)
|
|
1282
|
-
}.to raise_error(ArgumentError)
|
|
1283
|
-
end
|
|
1284
|
-
end
|
|
1285
|
-
|
|
1286
|
-
describe '.get_row_fill' do
|
|
1287
|
-
it 'should return white (ffffff) if no fill color specified for row' do
|
|
1288
|
-
expect(subject.get_row_fill(0)).to eq('ffffff')
|
|
1289
|
-
end
|
|
1290
|
-
|
|
1291
|
-
it 'should correctly reflect fill color if specified for row' do
|
|
1292
|
-
subject.change_row_fill(0, '000000')
|
|
1293
|
-
expect(subject.get_row_fill(0)).to eq('000000')
|
|
1294
|
-
end
|
|
1295
|
-
|
|
1296
|
-
it 'should return nil if a row which does not exist is passed in' do
|
|
1297
|
-
expect(subject.get_row_fill(11)).to be_nil
|
|
1298
|
-
end
|
|
1299
|
-
end
|
|
1300
|
-
|
|
1301
|
-
describe '.get_row_font_name' do
|
|
1302
|
-
it 'should correctly reflect font name for row' do
|
|
1303
|
-
subject.change_row_font_name(0, 'Courier')
|
|
1304
|
-
expect(subject.get_row_font_name(0)).to eq('Courier')
|
|
1305
|
-
end
|
|
1306
|
-
|
|
1307
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1308
|
-
expect(subject.get_row_font_name(11)).to be_nil
|
|
1309
|
-
end
|
|
1310
|
-
end
|
|
1311
|
-
|
|
1312
|
-
describe '.get_row_font_size' do
|
|
1313
|
-
it 'should correctly reflect font size for row' do
|
|
1314
|
-
subject.change_row_font_size(0, 30)
|
|
1315
|
-
expect(subject.get_row_font_size(0)).to eq(30)
|
|
1316
|
-
end
|
|
1317
|
-
|
|
1318
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1319
|
-
expect(subject.get_row_font_size(11)).to be_nil
|
|
1320
|
-
end
|
|
1321
|
-
end
|
|
1322
|
-
|
|
1323
|
-
describe '.get_row_font_color' do
|
|
1324
|
-
it 'should correctly reflect font color for row' do
|
|
1325
|
-
subject.change_row_font_color(0, '0f0f0f')
|
|
1326
|
-
expect(subject.get_row_font_color(0)).to eq('0f0f0f')
|
|
1327
|
-
end
|
|
1328
|
-
|
|
1329
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1330
|
-
expect(subject.get_row_font_color(11)).to be_nil
|
|
1331
|
-
end
|
|
1332
|
-
end
|
|
1333
|
-
|
|
1334
|
-
describe '.is_row_italicized' do
|
|
1335
|
-
it 'should correctly return whether row is italicized' do
|
|
1336
|
-
subject.change_row_italics(0, true)
|
|
1337
|
-
expect(subject.is_row_italicized(0)).to eq(true)
|
|
1338
|
-
end
|
|
1339
|
-
|
|
1340
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1341
|
-
expect(subject.is_row_italicized(11)).to be_nil
|
|
1342
|
-
end
|
|
1343
|
-
end
|
|
1344
|
-
|
|
1345
|
-
describe '.is_row_bolded' do
|
|
1346
|
-
it 'should correctly return whether row is bolded' do
|
|
1347
|
-
subject.change_row_bold(0, true)
|
|
1348
|
-
expect(subject.is_row_bolded(0)).to eq(true)
|
|
1349
|
-
end
|
|
1350
|
-
|
|
1351
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1352
|
-
expect(subject.is_row_bolded(11)).to be_nil
|
|
1353
|
-
end
|
|
1354
|
-
end
|
|
1355
|
-
|
|
1356
|
-
describe '.is_row_underlined' do
|
|
1357
|
-
it 'should correctly return whether row is underlined' do
|
|
1358
|
-
subject.change_row_underline(0, true)
|
|
1359
|
-
expect(subject.is_row_underlined(0)).to eq(true)
|
|
1360
|
-
end
|
|
1361
|
-
|
|
1362
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1363
|
-
expect(subject.is_row_underlined(11)).to be_nil
|
|
1364
|
-
end
|
|
1365
|
-
end
|
|
1366
|
-
|
|
1367
|
-
describe '.is_row_struckthrough' do
|
|
1368
|
-
it 'should correctly return whether row is struckthrough' do
|
|
1369
|
-
subject.change_row_strikethrough(0, true)
|
|
1370
|
-
expect(subject.is_row_struckthrough(0)).to eq(true)
|
|
1371
|
-
end
|
|
1372
|
-
|
|
1373
|
-
it 'should return nil if a (nonnegative) row which does not exist is passed in' do
|
|
1374
|
-
expect(subject.is_row_struckthrough(11)).to be_nil
|
|
1375
|
-
end
|
|
1376
|
-
end
|
|
1377
|
-
|
|
1378
|
-
describe '.get_row_height' do
|
|
1379
|
-
it 'should return 13 if no height specified for row' do
|
|
1380
|
-
expect(subject.get_row_height(0)).to eq(13)
|
|
1381
|
-
end
|
|
1382
|
-
|
|
1383
|
-
it 'should correctly reflect height if specified for row' do
|
|
1384
|
-
subject.change_row_height(0, 30)
|
|
1385
|
-
expect(subject.get_row_height(0)).to eq(30)
|
|
1386
|
-
end
|
|
1387
|
-
|
|
1388
|
-
it 'should return default row height if a row which does not exist is passed in' do
|
|
1389
|
-
expect(subject.get_row_height(11)).to eq(13)
|
|
1390
|
-
end
|
|
1391
|
-
|
|
1392
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1393
|
-
expect {
|
|
1394
|
-
subject.get_row_height(-1)
|
|
1395
|
-
}.to raise_error(ArgumentError)
|
|
1396
|
-
end
|
|
1397
|
-
end
|
|
1398
|
-
|
|
1399
|
-
describe '.get_row_alignment' do
|
|
1400
|
-
it 'should return nil if no horizontal alignment specified for row' do
|
|
1401
|
-
expect(subject.get_row_alignment(0, true)).to be_nil
|
|
1402
|
-
end
|
|
1403
|
-
|
|
1404
|
-
it 'should return nil if a row which does not exist is passed in' do
|
|
1405
|
-
expect(subject.get_row_alignment(11, true)).to be_nil
|
|
1406
|
-
end
|
|
1407
|
-
|
|
1408
|
-
it 'should return correct horizontal alignment if it is set for that row' do
|
|
1409
|
-
subject.change_row_horizontal_alignment(0, 'center')
|
|
1410
|
-
expect(subject.get_row_alignment(0, true)).to eq('center')
|
|
1411
|
-
end
|
|
1412
|
-
|
|
1413
|
-
it 'should return nil if no alignment specified for row' do
|
|
1414
|
-
expect(subject.get_row_alignment(0, false)).to be_nil
|
|
1415
|
-
end
|
|
1416
|
-
|
|
1417
|
-
it 'should return nil if a row which does not exist is passed in' do
|
|
1418
|
-
expect(subject.get_row_alignment(11, false)).to be_nil
|
|
1419
|
-
end
|
|
1420
|
-
|
|
1421
|
-
it 'should return correct vertical alignment if it is set for that row' do
|
|
1422
|
-
subject.change_row_vertical_alignment(0, 'center')
|
|
1423
|
-
expect(subject.get_row_alignment(0, false)).to eq('center')
|
|
1424
|
-
end
|
|
1425
|
-
end
|
|
1426
|
-
|
|
1427
|
-
describe '.get_row_border' do
|
|
1428
|
-
it 'should return nil if no border is specified for that row in that direction' do
|
|
1429
|
-
expect(subject.get_row_border(0, :top)).to be_nil
|
|
1430
|
-
end
|
|
1431
|
-
|
|
1432
|
-
it 'should return type of border that this row has on top' do
|
|
1433
|
-
subject.change_row_border(0, :top, 'thin')
|
|
1434
|
-
expect(subject.get_row_border(0, :top)).to eq('thin')
|
|
1435
|
-
end
|
|
1436
|
-
|
|
1437
|
-
it 'should return nil if a row which does not exist is passed in' do
|
|
1438
|
-
expect(subject.get_row_border(11, :top)).to be_nil
|
|
1439
|
-
end
|
|
1440
|
-
end
|
|
1441
|
-
|
|
1442
|
-
describe '.get_column_font_name' do
|
|
1443
|
-
it 'should correctly reflect font name for column' do
|
|
1444
|
-
subject.change_column_font_name(0, 'Courier')
|
|
1445
|
-
expect(subject.get_column_font_name(0)).to eq('Courier')
|
|
1446
|
-
end
|
|
1447
|
-
|
|
1448
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1449
|
-
expect {
|
|
1450
|
-
subject.get_column_font_name(-1)
|
|
1451
|
-
}.to raise_error(ArgumentError)
|
|
1452
|
-
end
|
|
1453
|
-
|
|
1454
|
-
it 'should return default font if a (nonnegative) column which does not exist is passed in' do
|
|
1455
|
-
expect(subject.get_column_font_name(11)).to eq('Verdana')
|
|
1456
|
-
end
|
|
1457
|
-
end
|
|
1458
|
-
|
|
1459
|
-
describe '.get_column_font_size' do
|
|
1460
|
-
it 'should correctly reflect font size for column' do
|
|
1461
|
-
subject.change_column_font_size(0, 30)
|
|
1462
|
-
expect(subject.get_column_font_size(0)).to eq(30)
|
|
1463
|
-
end
|
|
1464
|
-
|
|
1465
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1466
|
-
expect {
|
|
1467
|
-
subject.get_column_font_size(-1)
|
|
1468
|
-
}.to raise_error(ArgumentError)
|
|
1469
|
-
end
|
|
1470
|
-
|
|
1471
|
-
it 'should return default font size if a column which does not exist is passed in' do
|
|
1472
|
-
expect(subject.get_column_font_size(11)).to eq(10)
|
|
1473
|
-
end
|
|
1474
|
-
end
|
|
1475
|
-
|
|
1476
|
-
describe '.get_column_font_color' do
|
|
1477
|
-
it 'should correctly reflect font color for column' do
|
|
1478
|
-
subject.change_column_font_color(0, '0f0f0f')
|
|
1479
|
-
expect(subject.get_column_font_color(0)).to eq('0f0f0f')
|
|
1480
|
-
end
|
|
1481
|
-
|
|
1482
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1483
|
-
expect {
|
|
1484
|
-
subject.get_column_font_color(-1)
|
|
1485
|
-
}.to raise_error(ArgumentError)
|
|
1486
|
-
end
|
|
1487
|
-
|
|
1488
|
-
it 'should return default color (000000) if a (nonnegative) column which does not exist is passed in' do
|
|
1489
|
-
expect(subject.get_column_font_color(11)).to eq('000000')
|
|
1490
|
-
end
|
|
1491
|
-
|
|
1492
|
-
it 'should return default color (000000) if no rgb font color is specified' do
|
|
1493
|
-
expect(subject.get_column_font_color(0)).to eq('000000')
|
|
1494
|
-
end
|
|
1495
|
-
end
|
|
1496
|
-
|
|
1497
|
-
describe '.is_column_italicized' do
|
|
1498
|
-
it 'should correctly return whether column is italicized' do
|
|
1499
|
-
subject.change_column_italics(0, true)
|
|
1500
|
-
expect(subject.is_column_italicized(0)).to eq(true)
|
|
1501
|
-
end
|
|
1502
|
-
|
|
1503
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1504
|
-
expect {
|
|
1505
|
-
subject.is_column_italicized(-1)
|
|
1506
|
-
}.to raise_error(ArgumentError)
|
|
1507
|
-
end
|
|
1508
|
-
|
|
1509
|
-
it 'should return nil if a (nonnegative) column which does not exist is passed in' do
|
|
1510
|
-
expect(subject.is_column_italicized(11)).to be_nil
|
|
1511
|
-
end
|
|
1512
|
-
end
|
|
1513
|
-
|
|
1514
|
-
describe '.is_column_bolded' do
|
|
1515
|
-
it 'should correctly return whether column is bolded' do
|
|
1516
|
-
subject.change_column_bold(0, true)
|
|
1517
|
-
expect(subject.is_column_bolded(0)).to eq(true)
|
|
1518
|
-
end
|
|
1519
|
-
|
|
1520
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1521
|
-
expect {
|
|
1522
|
-
subject.is_column_bolded(-1)
|
|
1523
|
-
}.to raise_error(ArgumentError)
|
|
1524
|
-
end
|
|
1525
|
-
|
|
1526
|
-
it 'should return nil if a (nonnegative) column which does not exist is passed in' do
|
|
1527
|
-
expect(subject.is_column_bolded(11)).to be_nil
|
|
1528
|
-
end
|
|
1529
|
-
end
|
|
1530
|
-
|
|
1531
|
-
describe '.is_column_underlined' do
|
|
1532
|
-
it 'should correctly return whether column is underlined' do
|
|
1533
|
-
subject.change_column_underline(0, true)
|
|
1534
|
-
expect(subject.is_column_underlined(0)).to eq(true)
|
|
1535
|
-
end
|
|
1536
|
-
|
|
1537
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1538
|
-
expect {
|
|
1539
|
-
subject.is_column_underlined(-1)
|
|
1540
|
-
}.to raise_error(ArgumentError)
|
|
1541
|
-
end
|
|
1542
|
-
|
|
1543
|
-
it 'should return nil if a (nonnegative) column which does not exist is passed in' do
|
|
1544
|
-
expect(subject.is_column_underlined(11)).to be_nil
|
|
1545
|
-
end
|
|
1546
|
-
end
|
|
1547
|
-
|
|
1548
|
-
describe '.is_column_struckthrough' do
|
|
1549
|
-
it 'should correctly return whether column is struckthrough' do
|
|
1550
|
-
subject.change_column_strikethrough(0, true)
|
|
1551
|
-
expect(subject.is_column_struckthrough(0)).to eq(true)
|
|
1552
|
-
end
|
|
1553
|
-
|
|
1554
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1555
|
-
expect {
|
|
1556
|
-
subject.is_column_struckthrough(-1)
|
|
1557
|
-
}.to raise_error(ArgumentError)
|
|
1558
|
-
end
|
|
1559
|
-
|
|
1560
|
-
it 'should return nil if a (nonnegative) column which does not exist is passed in' do
|
|
1561
|
-
expect(subject.is_column_struckthrough(11)).to be_nil
|
|
1562
|
-
end
|
|
1563
|
-
end
|
|
1564
|
-
|
|
1565
|
-
describe '.get_column_width_raw' do
|
|
1566
|
-
it 'should return nil if no width specified for column' do
|
|
1567
|
-
expect(subject.get_column_width_raw(0)).to be_nil
|
|
1568
|
-
end
|
|
1569
|
-
|
|
1570
|
-
it 'should correctly reflect width if specified for column' do
|
|
1571
|
-
subject.change_column_width_raw(0, 30.123)
|
|
1572
|
-
expect(subject.get_column_width_raw(0)).to eq(30.123)
|
|
1573
|
-
end
|
|
1574
|
-
|
|
1575
|
-
it 'should return nil for a column that does not exist' do
|
|
1576
|
-
expect(subject.get_column_width_raw(11)).to be_nil
|
|
1577
|
-
end
|
|
1578
|
-
|
|
1579
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1580
|
-
expect {
|
|
1581
|
-
subject.get_column_width_raw(-1)
|
|
1582
|
-
}.to raise_error(ArgumentError)
|
|
1583
|
-
end
|
|
1584
|
-
end
|
|
1585
|
-
|
|
1586
|
-
describe '.get_column_width' do
|
|
1587
|
-
it 'should return default width if no width specified for column' do
|
|
1588
|
-
expect(subject.get_column_width(0)).to eq(RubyXL::ColumnRange::DEFAULT_WIDTH)
|
|
1589
|
-
end
|
|
1590
|
-
|
|
1591
|
-
it 'should correctly reflect width if specified for column' do
|
|
1592
|
-
subject.change_column_width(0, 15)
|
|
1593
|
-
expect(subject.get_column_width(0)).to eq(15)
|
|
1594
|
-
end
|
|
1595
|
-
|
|
1596
|
-
it 'should return default width for a column that does not exist' do
|
|
1597
|
-
expect(subject.get_column_width(11)).to eq(RubyXL::ColumnRange::DEFAULT_WIDTH)
|
|
1598
|
-
end
|
|
1599
|
-
|
|
1600
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1601
|
-
expect {
|
|
1602
|
-
subject.get_column_width(-1)
|
|
1603
|
-
}.to raise_error(ArgumentError)
|
|
1604
|
-
end
|
|
1605
|
-
end
|
|
1606
|
-
|
|
1607
|
-
describe '.get_column_fill' do
|
|
1608
|
-
it 'should return white (ffffff) if no fill color specified for column' do
|
|
1609
|
-
expect(subject.get_column_fill(0)).to eq('ffffff')
|
|
1610
|
-
end
|
|
1611
|
-
|
|
1612
|
-
it 'should correctly reflect fill color if specified for column' do
|
|
1613
|
-
subject.change_column_fill(0, '000000')
|
|
1614
|
-
expect(subject.get_column_fill(0)).to eq('000000')
|
|
1615
|
-
end
|
|
1616
|
-
|
|
1617
|
-
it 'should return nil if a column which does not exist is passed in' do
|
|
1618
|
-
expect(subject.get_column_fill(11)).to eq('ffffff')
|
|
1619
|
-
end
|
|
1620
|
-
|
|
1621
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1622
|
-
expect {
|
|
1623
|
-
subject.get_column_fill(-1)
|
|
1624
|
-
}.to raise_error(ArgumentError)
|
|
1625
|
-
end
|
|
1626
|
-
end
|
|
1627
|
-
|
|
1628
|
-
describe '.get_column_horizontal_alignment' do
|
|
1629
|
-
it 'should return nil if no alignment specified for column' do
|
|
1630
|
-
expect(subject.get_column_alignment(0, :horizontal)).to be_nil
|
|
1631
|
-
end
|
|
1632
|
-
|
|
1633
|
-
it 'should return nil if a column which does not exist is passed in' do
|
|
1634
|
-
expect(subject.get_column_alignment(11, :horizontal)).to be_nil
|
|
1635
|
-
end
|
|
1636
|
-
|
|
1637
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1638
|
-
expect {
|
|
1639
|
-
subject.get_column_alignment(-1, :horizontal)
|
|
1640
|
-
}.to raise_error(ArgumentError)
|
|
1641
|
-
end
|
|
1642
|
-
|
|
1643
|
-
it 'should return correct horizontal alignment if it is set for that column' do
|
|
1644
|
-
subject.change_column_horizontal_alignment(0, 'center')
|
|
1645
|
-
expect(subject.get_column_alignment(0, :horizontal)).to eq('center')
|
|
1646
|
-
end
|
|
1647
|
-
end
|
|
1648
|
-
|
|
1649
|
-
describe '.get_column_vertical_alignment' do
|
|
1650
|
-
it 'should return nil if no alignment specified for column' do
|
|
1651
|
-
expect(subject.get_column_alignment(0, :vertical)).to be_nil
|
|
1652
|
-
end
|
|
1653
|
-
|
|
1654
|
-
it 'should return nil if a column which does not exist is passed in' do
|
|
1655
|
-
expect(subject.get_column_alignment(11, :vertical)).to be_nil
|
|
1656
|
-
end
|
|
1657
|
-
|
|
1658
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1659
|
-
expect {
|
|
1660
|
-
subject.get_column_alignment(-1, :vertical)
|
|
1661
|
-
}.to raise_error(ArgumentError)
|
|
1662
|
-
end
|
|
1663
|
-
|
|
1664
|
-
it 'should return correct vertical alignment if it is set for that column' do
|
|
1665
|
-
subject.change_column_vertical_alignment(0, 'center')
|
|
1666
|
-
expect(subject.get_column_alignment(0, :vertical)).to eq('center')
|
|
1667
|
-
end
|
|
1668
|
-
end
|
|
1669
|
-
|
|
1670
|
-
describe '.get_column_border' do
|
|
1671
|
-
it 'should return nil if no border is specified for that column in that direction' do
|
|
1672
|
-
expect(subject.get_column_border(0, :diagonal)).to be_nil
|
|
1673
|
-
end
|
|
1674
|
-
|
|
1675
|
-
it 'should return type of border that this column has on diagonal' do
|
|
1676
|
-
subject.change_column_border(0, :diagonal, 'thin')
|
|
1677
|
-
expect(subject.get_column_border(0, :diagonal)).to eq('thin')
|
|
1678
|
-
end
|
|
1679
|
-
|
|
1680
|
-
it 'should cause error if a negative argument is passed in' do
|
|
1681
|
-
expect {
|
|
1682
|
-
subject.get_column_border(-1, :diagonal)
|
|
1683
|
-
}.to raise_error(ArgumentError)
|
|
1684
|
-
end
|
|
1685
|
-
|
|
1686
|
-
it 'should return nil if a column which does not exist is passed in' do
|
|
1687
|
-
expect(subject.get_column_border(11, :diagonal)).to be_nil
|
|
1688
|
-
end
|
|
1689
|
-
end
|
|
1690
|
-
|
|
1691
|
-
describe '@column_range' do
|
|
1692
|
-
it 'should properly handle range addition and modification' do
|
|
1693
|
-
# Ranges should be empty for brand new worskeet
|
|
1694
|
-
expect(subject.cols.size).to eq(0)
|
|
1695
|
-
|
|
1696
|
-
# Range should be created if the column has not been touched before
|
|
1697
|
-
subject.change_column_width(0, 30)
|
|
1698
|
-
expect(subject.get_column_width(0)).to eq(30)
|
|
1699
|
-
expect(subject.cols.size).to eq(1)
|
|
1700
|
-
|
|
1701
|
-
# Existing range should be reused
|
|
1702
|
-
subject.change_column_width(0, 20)
|
|
1703
|
-
expect(subject.get_column_width(0)).to eq(20)
|
|
1704
|
-
expect(subject.cols.size).to eq(1)
|
|
1705
|
-
|
|
1706
|
-
# Creation of the new range should not affect previously changed columns
|
|
1707
|
-
subject.change_column_width(1, 30)
|
|
1708
|
-
expect(subject.get_column_width(1)).to eq(30)
|
|
1709
|
-
expect(subject.get_column_width(0)).to eq(20)
|
|
1710
|
-
expect(subject.cols.size).to eq(2)
|
|
1711
|
-
|
|
1712
|
-
subject.cols.clear
|
|
1713
|
-
subject.cols << RubyXL::ColumnRange.new(:min => 1, :max => 9, :width => 33) # Note that this is raw width
|
|
1714
|
-
|
|
1715
|
-
r = subject.cols.locate_range(3)
|
|
1716
|
-
expect(r.min).to eq(1)
|
|
1717
|
-
expect(r.max).to eq(9)
|
|
1718
|
-
|
|
1719
|
-
# When a column is modified at the beginning of the range, it should shrink to the right
|
|
1720
|
-
subject.change_column_width(0, 20)
|
|
1721
|
-
expect(subject.cols.size).to eq(2)
|
|
1722
|
-
expect(subject.get_column_width(0)).to eq(20)
|
|
1723
|
-
expect(subject.get_column_width(1)).to eq(32)
|
|
1724
|
-
|
|
1725
|
-
r = subject.cols.locate_range(3)
|
|
1726
|
-
expect(r.min).to eq(2)
|
|
1727
|
-
expect(r.max).to eq(9)
|
|
1728
|
-
|
|
1729
|
-
# When a column is modified at the beginning of the range, it should shrink to the left
|
|
1730
|
-
subject.change_column_width(8, 30)
|
|
1731
|
-
expect(subject.cols.size).to eq(3)
|
|
1732
|
-
expect(subject.get_column_width(8)).to eq(30)
|
|
1733
|
-
|
|
1734
|
-
r = subject.cols.locate_range(3)
|
|
1735
|
-
expect(r.min).to eq(2)
|
|
1736
|
-
expect(r.max).to eq(8)
|
|
1737
|
-
|
|
1738
|
-
# When a column is modified in the middle of the range, it should split into two
|
|
1739
|
-
subject.change_column_width(4, 15)
|
|
1740
|
-
expect(subject.cols.size).to eq(5)
|
|
1741
|
-
expect(subject.get_column_width(3)).to eq(32)
|
|
1742
|
-
|
|
1743
|
-
r = subject.cols.locate_range(2)
|
|
1744
|
-
expect(r.min).to eq(2)
|
|
1745
|
-
expect(r.max).to eq(4)
|
|
1746
|
-
|
|
1747
|
-
expect(subject.get_column_width(4)).to eq(15)
|
|
1748
|
-
|
|
1749
|
-
r = subject.cols.locate_range(4)
|
|
1750
|
-
expect(r.min).to eq(5)
|
|
1751
|
-
expect(r.max).to eq(5)
|
|
1752
|
-
|
|
1753
|
-
expect(subject.get_column_width(5)).to eq(32)
|
|
1754
|
-
|
|
1755
|
-
r = subject.cols.locate_range(6)
|
|
1756
|
-
expect(r.min).to eq(6)
|
|
1757
|
-
expect(r.max).to eq(8)
|
|
1758
|
-
end
|
|
1759
|
-
end
|
|
1760
|
-
|
|
1761
|
-
describe 'forbidden sheet names' do
|
|
1762
|
-
it 'should stream a workbook successfully' do
|
|
1763
|
-
subject.sheet_name = 'Test Name'
|
|
1764
|
-
subject.workbook.stream
|
|
1765
|
-
end
|
|
1766
|
-
|
|
1767
|
-
it 'should throw an error when forbidden characters are used in the sheet name' do
|
|
1768
|
-
subject.sheet_name = 'Some [Special] Name'
|
|
1769
|
-
expect { subject.workbook.stream }.to raise_error(RuntimeError)
|
|
1770
|
-
end
|
|
1771
|
-
|
|
1772
|
-
it 'should throw an error when forbidden name is used' do
|
|
1773
|
-
subject.sheet_name = 'History'
|
|
1774
|
-
expect { subject.workbook.stream }.to raise_error(RuntimeError)
|
|
1775
|
-
end
|
|
1776
|
-
end
|
|
1777
|
-
end
|