rubyXL 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +28 -2
- data/VERSION +1 -1
- data/lib/rubyXL/cell.rb +0 -5
- data/lib/rubyXL/convenience_methods.rb +30 -52
- data/lib/rubyXL/objects/ooxml_object.rb +2 -0
- data/lib/rubyXL/objects/root.rb +16 -2
- data/lib/rubyXL/parser.rb +3 -32
- data/lib/rubyXL/worksheet.rb +29 -91
- data/rdoc/README_rdoc.html +1 -1
- data/rdoc/RubyXL.html +1 -1
- data/rdoc/RubyXL/AExtension.html +1 -1
- data/rdoc/RubyXL/AExtensionStorageArea.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 +1 -1
- data/rdoc/RubyXL/BorderEdge.html +1 -1
- data/rdoc/RubyXL/Borders.html +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/CellConvenienceMethods.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 +1 -1
- data/rdoc/RubyXL/CellStyles.html +1 -1
- data/rdoc/RubyXL/CellValue.html +1 -1
- data/rdoc/RubyXL/CellWatch.html +1 -1
- data/rdoc/RubyXL/CellWatches.html +1 -1
- data/rdoc/RubyXL/CellXFs.html +1 -1
- data/rdoc/RubyXL/ChartColorsFile.html +1 -1
- data/rdoc/RubyXL/ChartFile.html +1 -1
- data/rdoc/RubyXL/ChartStyleFile.html +1 -1
- data/rdoc/RubyXL/ChartUserShapesFile.html +1 -1
- data/rdoc/RubyXL/Chartsheet.html +1 -1
- 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 +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/ColumnRanges.html +1 -1
- data/rdoc/RubyXL/Comment.html +1 -1
- data/rdoc/RubyXL/CommentList.html +1 -1
- data/rdoc/RubyXL/CommentsFile.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
- data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
- data/rdoc/RubyXL/ContentTypeDefault.html +1 -1
- data/rdoc/RubyXL/ContentTypeOverride.html +1 -1
- data/rdoc/RubyXL/ContentTypes.html +1 -1
- data/rdoc/RubyXL/ControlPropertiesFile.html +1 -1
- data/rdoc/RubyXL/CorePropertiesFile.html +1 -1
- 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/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/DefinedNames.html +1 -1
- data/rdoc/RubyXL/DocumentPropertiesFile.html +1 -1
- data/rdoc/RubyXL/DrawingFile.html +1 -1
- 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/ExternalLinksFile.html +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/Fills.html +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/FontScheme.html +1 -1
- data/rdoc/RubyXL/Fonts.html +1 -1
- 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 +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/LegacyWorksheet.html +37 -37
- 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 +1 -1
- data/rdoc/RubyXL/NumberFormats.html +1 -1
- data/rdoc/RubyXL/OLEObject.html +1 -1
- data/rdoc/RubyXL/OLEObjects.html +1 -1
- data/rdoc/RubyXL/OLESize.html +1 -1
- data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +6 -6
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +1 -1
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
- data/rdoc/RubyXL/Offset.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 +5 -99
- 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/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/RID.html +1 -1
- data/rdoc/RubyXL/RawOOXML.html +1 -1
- data/rdoc/RubyXL/Reference.html +1 -1
- data/rdoc/RubyXL/Relationship.html +1 -1
- data/rdoc/RubyXL/RelationshipSupport.html +1 -1
- data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +1 -1
- data/rdoc/RubyXL/RichText.html +1 -1
- data/rdoc/RubyXL/RichTextRun.html +1 -1
- data/rdoc/RubyXL/Row.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 +1 -1
- data/rdoc/RubyXL/ShapeGuide.html +1 -1
- data/rdoc/RubyXL/ShapeTextRectangle.html +1 -1
- data/rdoc/RubyXL/SharedStringsTable.html +1 -1
- data/rdoc/RubyXL/Sheet.html +1 -1
- data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
- data/rdoc/RubyXL/SheetData.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 +1 -1
- data/rdoc/RubyXL/Stop.html +1 -1
- data/rdoc/RubyXL/StringNode.html +1 -1
- data/rdoc/RubyXL/StringNodeW3C.html +1 -1
- data/rdoc/RubyXL/StringValue.html +1 -1
- data/rdoc/RubyXL/Stylesheet.html +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/Theme.html +1 -1
- 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 +1 -1
- data/rdoc/RubyXL/Variant.html +1 -1
- data/rdoc/RubyXL/Vector.html +1 -1
- 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/Workbook.html +1 -1
- data/rdoc/RubyXL/WorkbookConvenienceMethods.html +1 -1
- data/rdoc/RubyXL/WorkbookProperties.html +1 -1
- data/rdoc/RubyXL/WorkbookProtection.html +1 -1
- data/rdoc/RubyXL/WorkbookRoot.html +18 -4
- data/rdoc/RubyXL/WorkbookView.html +1 -1
- data/rdoc/RubyXL/WorkbookViews.html +1 -1
- data/rdoc/RubyXL/Worksheet.html +1 -1
- data/rdoc/RubyXL/WorksheetConvenienceMethods.html +1 -1
- 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/created.rid +21 -21
- data/rdoc/index.html +2 -2
- data/rdoc/js/search_index.js +1 -1
- data/rdoc/table_of_contents.html +62 -72
- data/rubyXL.gemspec +8 -4
- data/spec/lib/cell_spec.rb +15 -15
- data/spec/lib/parser_spec.rb +0 -8
- data/spec/lib/worksheet_spec.rb +107 -369
- data/tmp/.gitignore +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4de40cef47a71af3b19e027b2508941f63d82f1d
|
|
4
|
+
data.tar.gz: 0b2696764fdf2513922baafc8c84c4c224641156
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9893bbaebe5a580c6d9fb78c9949e7baf407640eea6e127435c502c301442abb4256165e8a7aa7031033ab68ddfbd03fdad7c7d5ae9e6ae4f65a09623d69e221
|
|
7
|
+
data.tar.gz: 0c41ea643f4a75692f66e7eeb2d6bdc260d42c86263e021be1aeb197fc5ab477a16c937e590a3236ba2b2422b1cbf26e2238060aed17d3286fac6cd04ee385f4
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
|
|
3
2
|
require 'rubygems'
|
|
4
3
|
require 'bundler'
|
|
4
|
+
|
|
5
5
|
begin
|
|
6
6
|
Bundler.setup(:default, :development)
|
|
7
7
|
rescue Bundler::BundlerError => e
|
|
@@ -44,7 +44,6 @@ end
|
|
|
44
44
|
|
|
45
45
|
require 'rspec/core/rake_task'
|
|
46
46
|
RSpec::Core::RakeTask.new(:spec)
|
|
47
|
-
|
|
48
47
|
task :default => :spec
|
|
49
48
|
|
|
50
49
|
require 'rdoc/task'
|
|
@@ -56,3 +55,30 @@ Rake::RDocTask.new do |rdoc|
|
|
|
56
55
|
rdoc.rdoc_files.include('README*')
|
|
57
56
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
58
57
|
end
|
|
58
|
+
|
|
59
|
+
desc "Dump profiling data"
|
|
60
|
+
task :profile do
|
|
61
|
+
require 'benchmark'
|
|
62
|
+
require 'stackprof'
|
|
63
|
+
|
|
64
|
+
$:.unshift File.dirname(__FILE__) + '/lib' # Make Ruby aware of load path
|
|
65
|
+
require './lib/rubyXL'
|
|
66
|
+
|
|
67
|
+
spreadsheets = Dir.glob(File.join("test", "input", "*.xls?")).sort!
|
|
68
|
+
|
|
69
|
+
spreadsheets.each { |input|
|
|
70
|
+
puts "<<<--- Profiling parsing #{input}..."
|
|
71
|
+
doc = nil
|
|
72
|
+
StackProf.run(:mode => :cpu, :interval => 100,
|
|
73
|
+
:out => "tmp/stackprof-cpu-parse-#{File.basename(input)}.dump") {
|
|
74
|
+
doc = RubyXL::Parser.parse(input)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
output = File.join("test", "output", File.basename(input))
|
|
78
|
+
puts "--->>> Profiling writing of #{output}..."
|
|
79
|
+
StackProf.run(:mode => :cpu, :interval => 100,
|
|
80
|
+
:out => "tmp/stackprof-cpu-write-#{File.basename(input)}.dump") {
|
|
81
|
+
doc.write(output)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.3.0
|
data/lib/rubyXL/cell.rb
CHANGED
|
@@ -204,11 +204,6 @@ module RubyXL
|
|
|
204
204
|
|
|
205
205
|
private
|
|
206
206
|
|
|
207
|
-
def get_border(direction)
|
|
208
|
-
validate_worksheet
|
|
209
|
-
get_cell_border.get_edge_style(direction)
|
|
210
|
-
end
|
|
211
|
-
|
|
212
207
|
def validate_workbook()
|
|
213
208
|
unless workbook.nil? || workbook.worksheets.nil?
|
|
214
209
|
workbook.worksheets.each { |sheet|
|
|
@@ -221,11 +221,18 @@ module RubyXL
|
|
|
221
221
|
def get_row_height(row = 0)
|
|
222
222
|
validate_workbook
|
|
223
223
|
validate_nonnegative(row)
|
|
224
|
-
return nil unless row_exists(row)
|
|
225
224
|
row = sheet_data.rows[row]
|
|
226
225
|
row && row.ht || 13
|
|
227
226
|
end
|
|
228
227
|
|
|
228
|
+
def get_row_border(row, border_direction)
|
|
229
|
+
validate_workbook
|
|
230
|
+
validate_nonnegative(row)
|
|
231
|
+
|
|
232
|
+
border = @workbook.borders[get_row_xf(row).border_id]
|
|
233
|
+
border && border.get_edge_style(border_direction)
|
|
234
|
+
end
|
|
235
|
+
|
|
229
236
|
def get_row_horizontal_alignment(row = 0)
|
|
230
237
|
return get_row_alignment(row, true)
|
|
231
238
|
end
|
|
@@ -314,11 +321,27 @@ module RubyXL
|
|
|
314
321
|
def get_column_fill(col=0)
|
|
315
322
|
validate_workbook
|
|
316
323
|
validate_nonnegative(col)
|
|
317
|
-
return nil unless column_exists(col)
|
|
318
324
|
|
|
319
325
|
@workbook.get_fill_color(get_col_xf(col))
|
|
320
326
|
end
|
|
321
327
|
|
|
328
|
+
def get_column_border(col, border_direction)
|
|
329
|
+
validate_workbook
|
|
330
|
+
validate_nonnegative(col)
|
|
331
|
+
|
|
332
|
+
xf = @workbook.cell_xfs[get_cols_style_index(col)]
|
|
333
|
+
border = @workbook.borders[xf.border_id]
|
|
334
|
+
border && border.get_edge_style(border_direction)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
def get_column_alignment(col, type)
|
|
338
|
+
validate_workbook
|
|
339
|
+
validate_nonnegative(col)
|
|
340
|
+
|
|
341
|
+
xf = @workbook.cell_xfs[get_cols_style_index(col)]
|
|
342
|
+
xf.alignment && xf.alignment.send(type)
|
|
343
|
+
end
|
|
344
|
+
|
|
322
345
|
def get_column_horizontal_alignment(col=0)
|
|
323
346
|
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_column_alignment` instead."
|
|
324
347
|
get_column_alignment(col, :horizontal)
|
|
@@ -599,6 +622,11 @@ module RubyXL
|
|
|
599
622
|
|
|
600
623
|
module CellConvenienceMethods
|
|
601
624
|
|
|
625
|
+
def get_border(direction)
|
|
626
|
+
validate_worksheet
|
|
627
|
+
get_cell_border.get_edge_style(direction)
|
|
628
|
+
end
|
|
629
|
+
|
|
602
630
|
def change_horizontal_alignment(alignment = 'center')
|
|
603
631
|
validate_worksheet
|
|
604
632
|
self.style_index = workbook.modify_alignment(self.style_index) { |a| a.horizontal = alignment }
|
|
@@ -619,56 +647,6 @@ module RubyXL
|
|
|
619
647
|
self.style_index = workbook.modify_border(self.style_index, direction, weight)
|
|
620
648
|
end
|
|
621
649
|
|
|
622
|
-
def change_border_top(weight = 'thin')
|
|
623
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead."
|
|
624
|
-
change_border(:top, weight)
|
|
625
|
-
end
|
|
626
|
-
|
|
627
|
-
def change_border_left(weight = 'thin')
|
|
628
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead."
|
|
629
|
-
change_border(:left, weight)
|
|
630
|
-
end
|
|
631
|
-
|
|
632
|
-
def change_border_right(weight = 'thin')
|
|
633
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead."
|
|
634
|
-
change_border(:right, weight)
|
|
635
|
-
end
|
|
636
|
-
|
|
637
|
-
def change_border_bottom(weight = 'thin')
|
|
638
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead."
|
|
639
|
-
change_border(:bottom, weight)
|
|
640
|
-
end
|
|
641
|
-
|
|
642
|
-
def change_border_diagonal(weight = 'thin')
|
|
643
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead."
|
|
644
|
-
change_border(:diagonal, weight)
|
|
645
|
-
end
|
|
646
|
-
|
|
647
|
-
def border_top()
|
|
648
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_border` instead."
|
|
649
|
-
return get_border(:top)
|
|
650
|
-
end
|
|
651
|
-
|
|
652
|
-
def border_left()
|
|
653
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_border` instead."
|
|
654
|
-
return get_border(:left)
|
|
655
|
-
end
|
|
656
|
-
|
|
657
|
-
def border_right()
|
|
658
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_border` instead."
|
|
659
|
-
return get_border(:right)
|
|
660
|
-
end
|
|
661
|
-
|
|
662
|
-
def border_bottom()
|
|
663
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_border` instead."
|
|
664
|
-
return get_border(:bottom)
|
|
665
|
-
end
|
|
666
|
-
|
|
667
|
-
def border_diagonal()
|
|
668
|
-
warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `get_border` instead."
|
|
669
|
-
return get_border(:diagonal)
|
|
670
|
-
end
|
|
671
|
-
|
|
672
650
|
end
|
|
673
651
|
|
|
674
652
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
1
2
|
require 'pathname'
|
|
2
3
|
require 'rubyXL/objects/reference'
|
|
3
4
|
|
|
@@ -381,6 +382,7 @@ module RubyXL
|
|
|
381
382
|
"<#{self.class}: #{super} #{vars.join(", ")}>"
|
|
382
383
|
end
|
|
383
384
|
|
|
385
|
+
|
|
384
386
|
class << self
|
|
385
387
|
def define_count_attribute
|
|
386
388
|
# Count will be inherited from Array. so no need to define it explicitly.
|
data/lib/rubyXL/objects/root.rb
CHANGED
|
@@ -59,14 +59,28 @@ module RubyXL
|
|
|
59
59
|
OOXMLTopLevelObject::ROOT
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def self.parse_file(xl_file_path, opts)
|
|
62
|
+
def self.parse_file(xl_file_path, opts = {})
|
|
63
63
|
begin
|
|
64
64
|
::Zip::File.open(xl_file_path) { |zip_file|
|
|
65
65
|
root = self.new
|
|
66
66
|
root.filepath = xl_file_path
|
|
67
67
|
root.content_types = RubyXL::ContentTypes.parse_file(zip_file, ContentTypes::XLSX_PATH)
|
|
68
68
|
root.load_relationships(zip_file, OOXMLTopLevelObject::ROOT)
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
wb = root.workbook
|
|
71
|
+
wb.root = root
|
|
72
|
+
|
|
73
|
+
wb.sheets.each_with_index { |sheet, i|
|
|
74
|
+
sheet_obj = wb.relationship_container.related_files[sheet.r_id]
|
|
75
|
+
|
|
76
|
+
wb.worksheets[i] = sheet_obj # Must be done first so the sheet becomes aware of its number
|
|
77
|
+
sheet_obj.workbook = wb
|
|
78
|
+
|
|
79
|
+
sheet_obj.sheet_name = sheet.name
|
|
80
|
+
sheet_obj.sheet_id = sheet.sheet_id
|
|
81
|
+
sheet_obj.state = sheet.state
|
|
82
|
+
}
|
|
83
|
+
|
|
70
84
|
root
|
|
71
85
|
}
|
|
72
86
|
rescue ::Zip::Error => e
|
data/lib/rubyXL/parser.rb
CHANGED
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
require 'nokogiri'
|
|
2
|
-
require 'tmpdir'
|
|
3
|
-
|
|
4
1
|
module RubyXL
|
|
5
|
-
|
|
6
2
|
class Parser
|
|
7
|
-
def self.parse(
|
|
8
|
-
|
|
3
|
+
def self.parse(xl_file_path)
|
|
4
|
+
root = RubyXL::WorkbookRoot.parse_file(xl_file_path)
|
|
5
|
+
root.workbook
|
|
9
6
|
end
|
|
10
|
-
|
|
11
|
-
# +:data_only+ allows only the sheet data to be parsed, so as to speed up parsing.
|
|
12
|
-
# However, using this option will result in date-formatted cells being interpreted as numbers.
|
|
13
|
-
def initialize(opts = {})
|
|
14
|
-
@opts = opts
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def parse(xl_file_path)
|
|
18
|
-
root = RubyXL::WorkbookRoot.parse_file(xl_file_path, @opts)
|
|
19
|
-
|
|
20
|
-
wb = root.workbook
|
|
21
|
-
|
|
22
|
-
wb.sheets.each_with_index { |sheet, i|
|
|
23
|
-
sheet_obj = wb.relationship_container.related_files[sheet.r_id]
|
|
24
|
-
|
|
25
|
-
wb.worksheets[i] = sheet_obj # Must be done first so the sheet becomes aware of its number
|
|
26
|
-
sheet_obj.workbook = wb
|
|
27
|
-
|
|
28
|
-
sheet_obj.sheet_name = sheet.name
|
|
29
|
-
sheet_obj.sheet_id = sheet.sheet_id
|
|
30
|
-
sheet_obj.state = sheet.state
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
wb
|
|
34
|
-
end
|
|
35
|
-
|
|
36
7
|
end
|
|
37
8
|
end
|
data/lib/rubyXL/worksheet.rb
CHANGED
|
@@ -135,38 +135,40 @@ module LegacyWorksheet
|
|
|
135
135
|
merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(row1, row2, col1, col2))
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
-
def add_row(
|
|
138
|
+
def add_row(row_index = 0, params = {})
|
|
139
139
|
new_row = RubyXL::Row.new(params)
|
|
140
140
|
new_row.worksheet = self
|
|
141
|
-
sheet_data.rows[
|
|
141
|
+
sheet_data.rows[row_index] = new_row
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
def add_cell(
|
|
144
|
+
def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
|
|
145
145
|
validate_workbook
|
|
146
|
-
|
|
146
|
+
validate_nonnegative(row_index)
|
|
147
|
+
validate_nonnegative(column_index)
|
|
148
|
+
row = sheet_data.rows[row_index] || add_row(row_index)
|
|
149
|
+
|
|
150
|
+
c = row.cells[column_index]
|
|
147
151
|
|
|
148
|
-
if overwrite ||
|
|
152
|
+
if overwrite || c.nil?
|
|
149
153
|
c = RubyXL::Cell.new
|
|
150
154
|
c.worksheet = self
|
|
151
|
-
c.row =
|
|
152
|
-
c.column =
|
|
155
|
+
c.row = row_index
|
|
156
|
+
c.column = column_index
|
|
153
157
|
c.raw_value = data
|
|
154
158
|
c.datatype = RubyXL::DataType::RAW_STRING unless formula || data.is_a?(Numeric)
|
|
155
159
|
c.formula = RubyXL::Formula.new(:expression => formula) if formula
|
|
156
160
|
|
|
157
|
-
range = cols && cols.locate_range(
|
|
158
|
-
c.style_index =
|
|
159
|
-
|
|
160
|
-
sheet_data.rows[row].cells[column] = c
|
|
161
|
+
range = cols && cols.locate_range(column_index)
|
|
162
|
+
c.style_index = row.style_index || (range && range.style_index) || 0
|
|
163
|
+
row.cells[column_index] = c
|
|
161
164
|
end
|
|
162
165
|
|
|
163
|
-
|
|
166
|
+
c
|
|
164
167
|
end
|
|
165
168
|
|
|
166
169
|
def delete_row(row_index=0)
|
|
167
170
|
validate_workbook
|
|
168
171
|
validate_nonnegative(row_index)
|
|
169
|
-
return nil unless row_exists(row_index)
|
|
170
172
|
|
|
171
173
|
deleted = sheet_data.rows.delete_at(row_index)
|
|
172
174
|
|
|
@@ -216,8 +218,7 @@ module LegacyWorksheet
|
|
|
216
218
|
validate_workbook
|
|
217
219
|
validate_nonnegative(column_index)
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
#delete column
|
|
221
222
|
sheet_data.rows.each { |row| row.cells.delete_at(column_index) }
|
|
222
223
|
|
|
223
224
|
# Change column numbers for cells to the right of the deleted column
|
|
@@ -271,7 +272,7 @@ module LegacyWorksheet
|
|
|
271
272
|
add_row(sheet_data.size, :cells => Array.new(sheet_data.rows[row].size))
|
|
272
273
|
(sheet_data.size - 1).downto(row+1) { |index|
|
|
273
274
|
sheet_data.rows[index].cells[col] = sheet_data.rows[index-1].cells[col]
|
|
274
|
-
}
|
|
275
|
+
}
|
|
275
276
|
else
|
|
276
277
|
raise 'invalid shift option'
|
|
277
278
|
end
|
|
@@ -282,30 +283,29 @@ module LegacyWorksheet
|
|
|
282
283
|
# by default, only sets cell to nil
|
|
283
284
|
# if :left is specified, method will shift row contents to the right of the deleted cell to the left
|
|
284
285
|
# if :up is specified, method will shift column contents below the deleted cell upward
|
|
285
|
-
def delete_cell(
|
|
286
|
+
def delete_cell(row_index = 0, column_index=0, shift=nil)
|
|
286
287
|
validate_workbook
|
|
287
|
-
validate_nonnegative(
|
|
288
|
-
validate_nonnegative(
|
|
289
|
-
|
|
290
|
-
return nil unless row_exists(row) && column_exists(col)
|
|
288
|
+
validate_nonnegative(row_index)
|
|
289
|
+
validate_nonnegative(column_index)
|
|
291
290
|
|
|
292
|
-
|
|
291
|
+
row = sheet_data[row_index]
|
|
292
|
+
old_cell = row && row[column_index]
|
|
293
293
|
|
|
294
294
|
case shift
|
|
295
295
|
when nil then
|
|
296
|
-
|
|
296
|
+
row.cells[column_index] = nil if row
|
|
297
297
|
when :left then
|
|
298
|
-
|
|
298
|
+
row.delete_cell_shift_left(column_index) if row
|
|
299
299
|
when :up then
|
|
300
|
-
(
|
|
301
|
-
c = sheet_data.rows[index].cells[
|
|
300
|
+
(row_index...(sheet_data.size - 1)).each { |index|
|
|
301
|
+
c = sheet_data.rows[index].cells[column_index] = sheet_data.rows[index + 1].cells[column_index]
|
|
302
302
|
c.row -= 1 if c.is_a?(Cell)
|
|
303
303
|
}
|
|
304
304
|
else
|
|
305
305
|
raise 'invalid shift option'
|
|
306
306
|
end
|
|
307
307
|
|
|
308
|
-
return
|
|
308
|
+
return old_cell
|
|
309
309
|
end
|
|
310
310
|
|
|
311
311
|
private
|
|
@@ -326,8 +326,6 @@ module LegacyWorksheet
|
|
|
326
326
|
validate_workbook
|
|
327
327
|
validate_nonnegative(row)
|
|
328
328
|
|
|
329
|
-
return nil unless row_exists(row)
|
|
330
|
-
|
|
331
329
|
xf_obj = get_row_xf(row)
|
|
332
330
|
return nil if xf_obj.alignment.nil?
|
|
333
331
|
|
|
@@ -336,43 +334,13 @@ module LegacyWorksheet
|
|
|
336
334
|
end
|
|
337
335
|
end
|
|
338
336
|
|
|
339
|
-
def get_row_border(row, border_direction)
|
|
340
|
-
validate_workbook
|
|
341
|
-
validate_nonnegative(row)
|
|
342
|
-
|
|
343
|
-
return nil unless row_exists(row)
|
|
344
|
-
|
|
345
|
-
border = @workbook.borders[get_row_xf(row).border_id]
|
|
346
|
-
border && border.get_edge_style(border_direction)
|
|
347
|
-
end
|
|
348
|
-
|
|
349
337
|
def column_font(col)
|
|
350
338
|
validate_workbook
|
|
351
339
|
validate_nonnegative(col)
|
|
352
|
-
return nil unless column_exists(col)
|
|
353
340
|
|
|
354
341
|
@workbook.fonts[@workbook.cell_xfs[get_cols_style_index(col)].font_id]
|
|
355
342
|
end
|
|
356
343
|
|
|
357
|
-
def get_column_alignment(col, type)
|
|
358
|
-
validate_workbook
|
|
359
|
-
validate_nonnegative(col)
|
|
360
|
-
return nil unless column_exists(col)
|
|
361
|
-
|
|
362
|
-
xf = @workbook.cell_xfs[get_cols_style_index(col)]
|
|
363
|
-
xf.alignment && xf.alignment.send(type)
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
def get_column_border(col, border_direction)
|
|
367
|
-
validate_workbook
|
|
368
|
-
validate_nonnegative(col)
|
|
369
|
-
return nil unless column_exists(col)
|
|
370
|
-
|
|
371
|
-
xf = @workbook.cell_xfs[get_cols_style_index(col)]
|
|
372
|
-
border = @workbook.borders[xf.border_id]
|
|
373
|
-
border && border.get_edge_style(border_direction)
|
|
374
|
-
end
|
|
375
|
-
|
|
376
344
|
#validates Workbook, ensures that this worksheet is in @workbook
|
|
377
345
|
def validate_workbook()
|
|
378
346
|
unless @workbook.nil? || @workbook.worksheets.nil?
|
|
@@ -421,29 +389,8 @@ module LegacyWorksheet
|
|
|
421
389
|
validate_nonnegative(row_index)
|
|
422
390
|
validate_nonnegative(column_index)
|
|
423
391
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
# Expand cell arrays in existing rows, if necessary.
|
|
427
|
-
# Writing anything to a cell in the array automatically creates all the members
|
|
428
|
-
# with lower indices, filling them with +nil+s. But, we can't just write +nil+
|
|
429
|
-
# to +column_index+ because it may be less than +size+! So we read from that index
|
|
430
|
-
# (if it didn't exist, we will get nil) and write right back.
|
|
431
|
-
sheet_data.rows.each { |r| r.cells[column_index] = r.cells[column_index] unless r.nil? }
|
|
432
|
-
|
|
433
|
-
first_row = sheet_data.rows.first
|
|
434
|
-
col_size = [ first_row && first_row.cells.size || 0, column_index ].max
|
|
435
|
-
|
|
436
|
-
# Now create new rows with the required number of cells.
|
|
437
|
-
# Doing +.downto()+ here so the reallocation of row array has to only happen once,
|
|
438
|
-
# when it is extended to max size; after that, we will be writing into existing
|
|
439
|
-
# (but empty) members. Additional checks are not necessary, because if +row_index+
|
|
440
|
-
# is less than +size+, then +.downto()+ will not execute, and if it equals +size+,
|
|
441
|
-
# then the block will be invoked exactly once, which takes care of the case when
|
|
442
|
-
# +row_index+ is greater than the current max index by exactly 1.
|
|
443
|
-
row_index.downto(existing_row_count) { |r|
|
|
444
|
-
add_row(r, :cells => Array.new(col_size))
|
|
445
|
-
}
|
|
446
|
-
end
|
|
392
|
+
row = sheet_data.rows[row_index] || add_row(row_index)
|
|
393
|
+
end
|
|
447
394
|
|
|
448
395
|
# Helper method to get the style index for a column
|
|
449
396
|
def get_col_style(column_index)
|
|
@@ -469,14 +416,5 @@ module LegacyWorksheet
|
|
|
469
416
|
end
|
|
470
417
|
private :validate_nonnegative
|
|
471
418
|
|
|
472
|
-
def column_exists(col)
|
|
473
|
-
sheet_data.rows.any? { |r| r && (r.cells.size > col) }
|
|
474
|
-
end
|
|
475
|
-
|
|
476
|
-
def row_exists(row)
|
|
477
|
-
sheet_data.rows.size > row
|
|
478
|
-
end
|
|
479
|
-
|
|
480
|
-
|
|
481
419
|
end #end class
|
|
482
420
|
end
|