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