rubyXL-ptr 3.3.27
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 +7 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +229 -0
- data/Rakefile +103 -0
- data/VERSION +1 -0
- data/lib/rubyXL.rb +12 -0
- data/lib/rubyXL/cell.rb +54 -0
- data/lib/rubyXL/convenience_methods.rb +1122 -0
- data/lib/rubyXL/objects/border.rb +74 -0
- data/lib/rubyXL/objects/calculation_chain.rb +31 -0
- data/lib/rubyXL/objects/cell_style.rb +65 -0
- data/lib/rubyXL/objects/chartsheet.rb +92 -0
- data/lib/rubyXL/objects/color.rb +27 -0
- data/lib/rubyXL/objects/column_range.rb +92 -0
- data/lib/rubyXL/objects/comments.rb +47 -0
- data/lib/rubyXL/objects/container_nodes.rb +135 -0
- data/lib/rubyXL/objects/content_types.rb +77 -0
- data/lib/rubyXL/objects/data_validation.rb +37 -0
- data/lib/rubyXL/objects/document_properties.rb +159 -0
- data/lib/rubyXL/objects/extensions.rb +40 -0
- data/lib/rubyXL/objects/external_links.rb +85 -0
- data/lib/rubyXL/objects/fill.rb +55 -0
- data/lib/rubyXL/objects/filters.rb +120 -0
- data/lib/rubyXL/objects/font.rb +48 -0
- data/lib/rubyXL/objects/formula.rb +24 -0
- data/lib/rubyXL/objects/ooxml_object.rb +460 -0
- data/lib/rubyXL/objects/reference.rb +110 -0
- data/lib/rubyXL/objects/relationships.rb +213 -0
- data/lib/rubyXL/objects/root.rb +86 -0
- data/lib/rubyXL/objects/shared_strings.rb +70 -0
- data/lib/rubyXL/objects/sheet_common.rb +51 -0
- data/lib/rubyXL/objects/sheet_data.rb +188 -0
- data/lib/rubyXL/objects/simple_types.rb +232 -0
- data/lib/rubyXL/objects/storage.rb +182 -0
- data/lib/rubyXL/objects/stylesheet.rb +232 -0
- data/lib/rubyXL/objects/text.rb +94 -0
- data/lib/rubyXL/objects/theme.rb +1716 -0
- data/lib/rubyXL/objects/workbook.rb +464 -0
- data/lib/rubyXL/objects/worksheet.rb +748 -0
- data/lib/rubyXL/parser.rb +29 -0
- data/lib/rubyXL/worksheet.rb +105 -0
- data/rdoc/README_rdoc.html +475 -0
- data/rdoc/RubyXL.html +598 -0
- data/rdoc/RubyXL/AExtension.html +223 -0
- data/rdoc/RubyXL/AExtensionStorageArea.html +103 -0
- data/rdoc/RubyXL/ActiveX.html +182 -0
- data/rdoc/RubyXL/ActiveXBinary.html +117 -0
- data/rdoc/RubyXL/AdjustHandleList.html +106 -0
- data/rdoc/RubyXL/Alignment.html +106 -0
- data/rdoc/RubyXL/AlternateContent.html +103 -0
- data/rdoc/RubyXL/Authors.html +106 -0
- data/rdoc/RubyXL/AutoFilter.html +106 -0
- data/rdoc/RubyXL/AutoFilterColumn.html +106 -0
- data/rdoc/RubyXL/BinaryImageFile.html +122 -0
- data/rdoc/RubyXL/BodyProperties.html +106 -0
- data/rdoc/RubyXL/BooleanNode.html +103 -0
- data/rdoc/RubyXL/BooleanValue.html +103 -0
- data/rdoc/RubyXL/Border.html +275 -0
- data/rdoc/RubyXL/BorderEdge.html +189 -0
- data/rdoc/RubyXL/Borders.html +157 -0
- data/rdoc/RubyXL/Break.html +106 -0
- data/rdoc/RubyXL/BreakList.html +106 -0
- data/rdoc/RubyXL/CT_AdjPoint2D.html +106 -0
- data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +106 -0
- data/rdoc/RubyXL/CT_AlphaModulateEffect.html +106 -0
- data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +106 -0
- data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +106 -0
- data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +106 -0
- data/rdoc/RubyXL/CT_Backdrop.html +106 -0
- data/rdoc/RubyXL/CT_Bevel.html +106 -0
- data/rdoc/RubyXL/CT_BiLevelEffect.html +106 -0
- data/rdoc/RubyXL/CT_BlendEffect.html +106 -0
- data/rdoc/RubyXL/CT_Blip.html +106 -0
- data/rdoc/RubyXL/CT_BlipFillProperties.html +106 -0
- data/rdoc/RubyXL/CT_BlurEffect.html +106 -0
- data/rdoc/RubyXL/CT_Camera.html +106 -0
- data/rdoc/RubyXL/CT_Color.html +106 -0
- data/rdoc/RubyXL/CT_ColorChangeEffect.html +106 -0
- data/rdoc/RubyXL/CT_ColorMapping.html +106 -0
- data/rdoc/RubyXL/CT_ColorScheme.html +106 -0
- data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +106 -0
- data/rdoc/RubyXL/CT_ConnectionSite.html +106 -0
- data/rdoc/RubyXL/CT_ConnectionSiteList.html +106 -0
- data/rdoc/RubyXL/CT_DashStop.html +106 -0
- data/rdoc/RubyXL/CT_DashStopList.html +106 -0
- data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +106 -0
- data/rdoc/RubyXL/CT_DuotoneEffect.html +106 -0
- data/rdoc/RubyXL/CT_EffectContainer.html +106 -0
- data/rdoc/RubyXL/CT_EffectList.html +106 -0
- data/rdoc/RubyXL/CT_EffectReference.html +106 -0
- data/rdoc/RubyXL/CT_EffectStyleItem.html +106 -0
- data/rdoc/RubyXL/CT_EffectStyleList.html +106 -0
- data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +106 -0
- data/rdoc/RubyXL/CT_FillEffect.html +106 -0
- data/rdoc/RubyXL/CT_FillOverlayEffect.html +106 -0
- data/rdoc/RubyXL/CT_FillStyleList.html +106 -0
- data/rdoc/RubyXL/CT_FlatText.html +106 -0
- data/rdoc/RubyXL/CT_FontCollection.html +106 -0
- data/rdoc/RubyXL/CT_FontReference.html +106 -0
- data/rdoc/RubyXL/CT_GeomGuideList.html +106 -0
- data/rdoc/RubyXL/CT_GlowEffect.html +106 -0
- data/rdoc/RubyXL/CT_GradientFillProperties.html +106 -0
- data/rdoc/RubyXL/CT_GradientStop.html +106 -0
- data/rdoc/RubyXL/CT_GradientStopList.html +106 -0
- data/rdoc/RubyXL/CT_HSLEffect.html +106 -0
- data/rdoc/RubyXL/CT_HslColor.html +106 -0
- data/rdoc/RubyXL/CT_Hyperlink.html +106 -0
- data/rdoc/RubyXL/CT_InnerShadowEffect.html +106 -0
- data/rdoc/RubyXL/CT_LightRig.html +106 -0
- data/rdoc/RubyXL/CT_LineEndProperties.html +106 -0
- data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +106 -0
- data/rdoc/RubyXL/CT_LineProperties.html +106 -0
- data/rdoc/RubyXL/CT_LineStyleList.html +106 -0
- data/rdoc/RubyXL/CT_LinearShadeProperties.html +106 -0
- data/rdoc/RubyXL/CT_LuminanceEffect.html +106 -0
- data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +106 -0
- data/rdoc/RubyXL/CT_OuterShadowEffect.html +106 -0
- data/rdoc/RubyXL/CT_Path2D.html +106 -0
- data/rdoc/RubyXL/CT_Path2DArcTo.html +106 -0
- data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +106 -0
- data/rdoc/RubyXL/CT_Path2DList.html +106 -0
- data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +106 -0
- data/rdoc/RubyXL/CT_Path2DTo.html +106 -0
- data/rdoc/RubyXL/CT_PathShadeProperties.html +106 -0
- data/rdoc/RubyXL/CT_PatternFillProperties.html +106 -0
- data/rdoc/RubyXL/CT_Point3D.html +106 -0
- data/rdoc/RubyXL/CT_PolarAdjustHandle.html +106 -0
- data/rdoc/RubyXL/CT_PresetColor.html +106 -0
- data/rdoc/RubyXL/CT_PresetLineDashProperties.html +106 -0
- data/rdoc/RubyXL/CT_PresetShadowEffect.html +106 -0
- data/rdoc/RubyXL/CT_PresetTextShape.html +106 -0
- data/rdoc/RubyXL/CT_ReflectionEffect.html +106 -0
- data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +106 -0
- data/rdoc/RubyXL/CT_RelativeRect.html +106 -0
- data/rdoc/RubyXL/CT_SRgbColor.html +106 -0
- data/rdoc/RubyXL/CT_ScRgbColor.html +106 -0
- data/rdoc/RubyXL/CT_Scene3D.html +106 -0
- data/rdoc/RubyXL/CT_SchemeColor.html +106 -0
- data/rdoc/RubyXL/CT_Shape3D.html +106 -0
- data/rdoc/RubyXL/CT_ShapeStyle.html +106 -0
- data/rdoc/RubyXL/CT_SoftEdgesEffect.html +106 -0
- data/rdoc/RubyXL/CT_SphereCoords.html +106 -0
- data/rdoc/RubyXL/CT_StretchInfoProperties.html +106 -0
- data/rdoc/RubyXL/CT_StyleMatrix.html +106 -0
- data/rdoc/RubyXL/CT_StyleMatrixReference.html +106 -0
- data/rdoc/RubyXL/CT_SupplementalFont.html +106 -0
- data/rdoc/RubyXL/CT_SystemColor.html +106 -0
- data/rdoc/RubyXL/CT_TextAutonumberBullet.html +106 -0
- data/rdoc/RubyXL/CT_TextBlipBullet.html +106 -0
- data/rdoc/RubyXL/CT_TextCharBullet.html +106 -0
- data/rdoc/RubyXL/CT_TextCharacterProperties.html +106 -0
- data/rdoc/RubyXL/CT_TextFont.html +106 -0
- data/rdoc/RubyXL/CT_TextListStyle.html +106 -0
- data/rdoc/RubyXL/CT_TextNormalAutofit.html +106 -0
- data/rdoc/RubyXL/CT_TextParagraphProperties.html +106 -0
- data/rdoc/RubyXL/CT_TextSpacing.html +106 -0
- data/rdoc/RubyXL/CT_TextTabStop.html +106 -0
- data/rdoc/RubyXL/CT_TextTabStopList.html +106 -0
- data/rdoc/RubyXL/CT_TileInfoProperties.html +106 -0
- data/rdoc/RubyXL/CT_TintEffect.html +106 -0
- data/rdoc/RubyXL/CT_Transform2D.html +106 -0
- data/rdoc/RubyXL/CT_TransformEffect.html +106 -0
- data/rdoc/RubyXL/CT_Vector3D.html +106 -0
- data/rdoc/RubyXL/CT_XYAdjustHandle.html +106 -0
- data/rdoc/RubyXL/CalculationChain.html +176 -0
- data/rdoc/RubyXL/CalculationChainCell.html +106 -0
- data/rdoc/RubyXL/CalculationProperties.html +106 -0
- data/rdoc/RubyXL/Cell.html +558 -0
- data/rdoc/RubyXL/CellConvenienceMethods.html +1211 -0
- data/rdoc/RubyXL/CellExt.html +106 -0
- data/rdoc/RubyXL/CellSmartTag.html +106 -0
- data/rdoc/RubyXL/CellSmartTagProperty.html +106 -0
- data/rdoc/RubyXL/CellSmartTags.html +106 -0
- data/rdoc/RubyXL/CellStyle.html +106 -0
- data/rdoc/RubyXL/CellStyleXFs.html +157 -0
- data/rdoc/RubyXL/CellStyles.html +157 -0
- data/rdoc/RubyXL/CellValue.html +158 -0
- data/rdoc/RubyXL/CellWatch.html +106 -0
- data/rdoc/RubyXL/CellWatches.html +106 -0
- data/rdoc/RubyXL/CellXFs.html +161 -0
- data/rdoc/RubyXL/ChartColorsFile.html +122 -0
- data/rdoc/RubyXL/ChartFile.html +189 -0
- data/rdoc/RubyXL/ChartStyleFile.html +122 -0
- data/rdoc/RubyXL/ChartUserShapesFile.html +122 -0
- data/rdoc/RubyXL/Chartsheet.html +260 -0
- data/rdoc/RubyXL/ChartsheetPageSetup.html +106 -0
- data/rdoc/RubyXL/ChartsheetProperties.html +106 -0
- data/rdoc/RubyXL/ChartsheetProtection.html +106 -0
- data/rdoc/RubyXL/ChartsheetView.html +106 -0
- data/rdoc/RubyXL/ChartsheetViews.html +106 -0
- data/rdoc/RubyXL/Color.html +175 -0
- data/rdoc/RubyXL/ColorFilter.html +106 -0
- data/rdoc/RubyXL/ColorScale.html +106 -0
- data/rdoc/RubyXL/ColorSet.html +106 -0
- data/rdoc/RubyXL/Colors.html +106 -0
- data/rdoc/RubyXL/ColumnRange.html +245 -0
- data/rdoc/RubyXL/ColumnRanges.html +289 -0
- data/rdoc/RubyXL/Comment.html +106 -0
- data/rdoc/RubyXL/CommentList.html +106 -0
- data/rdoc/RubyXL/CommentsFile.html +197 -0
- data/rdoc/RubyXL/ConditionalFormatValue.html +106 -0
- data/rdoc/RubyXL/ConditionalFormatting.html +106 -0
- data/rdoc/RubyXL/ConditionalFormattingRule.html +106 -0
- data/rdoc/RubyXL/ContentTypeDefault.html +103 -0
- data/rdoc/RubyXL/ContentTypeOverride.html +103 -0
- data/rdoc/RubyXL/ContentTypes.html +248 -0
- data/rdoc/RubyXL/ControlPropertiesFile.html +117 -0
- data/rdoc/RubyXL/CorePropertiesFile.html +474 -0
- data/rdoc/RubyXL/CustomColor.html +106 -0
- data/rdoc/RubyXL/CustomColorList.html +106 -0
- data/rdoc/RubyXL/CustomFilter.html +106 -0
- data/rdoc/RubyXL/CustomFilters.html +106 -0
- data/rdoc/RubyXL/CustomGeometry.html +106 -0
- data/rdoc/RubyXL/CustomProperties.html +106 -0
- data/rdoc/RubyXL/CustomPropertiesFile.html +122 -0
- data/rdoc/RubyXL/CustomProperty.html +106 -0
- data/rdoc/RubyXL/CustomSheetView.html +106 -0
- data/rdoc/RubyXL/CustomSheetViews.html +106 -0
- data/rdoc/RubyXL/CustomWorkbookView.html +106 -0
- data/rdoc/RubyXL/CustomWorkbookViews.html +106 -0
- data/rdoc/RubyXL/CustomXMLFile.html +117 -0
- data/rdoc/RubyXL/DXF.html +106 -0
- data/rdoc/RubyXL/DXFs.html +106 -0
- data/rdoc/RubyXL/DataBar.html +106 -0
- data/rdoc/RubyXL/DataConsolidate.html +106 -0
- data/rdoc/RubyXL/DataConsolidationReference.html +106 -0
- data/rdoc/RubyXL/DataConsolidationReferences.html +106 -0
- data/rdoc/RubyXL/DataType.html +143 -0
- data/rdoc/RubyXL/DataValidation.html +106 -0
- data/rdoc/RubyXL/DataValidations.html +106 -0
- data/rdoc/RubyXL/DateGroupItem.html +106 -0
- data/rdoc/RubyXL/DefinedName.html +106 -0
- data/rdoc/RubyXL/DefinedNameExt.html +106 -0
- data/rdoc/RubyXL/DefinedNames.html +106 -0
- data/rdoc/RubyXL/DefinedNamesExt.html +106 -0
- data/rdoc/RubyXL/DocumentPropertiesFile.html +255 -0
- data/rdoc/RubyXL/DrawingFile.html +188 -0
- data/rdoc/RubyXL/DynamicFilter.html +106 -0
- data/rdoc/RubyXL/EmbeddedControl.html +106 -0
- data/rdoc/RubyXL/EmbeddedControls.html +106 -0
- data/rdoc/RubyXL/Extension.html +106 -0
- data/rdoc/RubyXL/ExtensionStorageArea.html +106 -0
- data/rdoc/RubyXL/Extents.html +106 -0
- data/rdoc/RubyXL/ExternalBook.html +106 -0
- data/rdoc/RubyXL/ExternalLinksFile.html +184 -0
- data/rdoc/RubyXL/ExternalReference.html +106 -0
- data/rdoc/RubyXL/ExternalReferences.html +106 -0
- data/rdoc/RubyXL/ExtraColorSchemeList.html +106 -0
- data/rdoc/RubyXL/FieldItem.html +106 -0
- data/rdoc/RubyXL/FileRecoveryProperties.html +106 -0
- data/rdoc/RubyXL/FileSharing.html +106 -0
- data/rdoc/RubyXL/FileVersion.html +106 -0
- data/rdoc/RubyXL/Fill.html +157 -0
- data/rdoc/RubyXL/Fills.html +157 -0
- data/rdoc/RubyXL/FilterContainer.html +106 -0
- data/rdoc/RubyXL/FloatNode.html +103 -0
- data/rdoc/RubyXL/FloatValue.html +103 -0
- data/rdoc/RubyXL/Font.html +184 -0
- data/rdoc/RubyXL/FontConvenienceMethods.html +603 -0
- data/rdoc/RubyXL/FontScheme.html +106 -0
- data/rdoc/RubyXL/Fonts.html +157 -0
- data/rdoc/RubyXL/Formula.html +106 -0
- data/rdoc/RubyXL/FunctionGroup.html +106 -0
- data/rdoc/RubyXL/FunctionGroups.html +106 -0
- data/rdoc/RubyXL/GenericStorageObject.html +298 -0
- data/rdoc/RubyXL/GradientFill.html +106 -0
- data/rdoc/RubyXL/HeaderFooterSettings.html +106 -0
- data/rdoc/RubyXL/Hyperlink.html +106 -0
- data/rdoc/RubyXL/HyperlinkRelFile.html +117 -0
- data/rdoc/RubyXL/Hyperlinks.html +106 -0
- data/rdoc/RubyXL/IconFilter.html +106 -0
- data/rdoc/RubyXL/IconSet.html +106 -0
- data/rdoc/RubyXL/IgnoredError.html +106 -0
- data/rdoc/RubyXL/IgnoredErrors.html +106 -0
- data/rdoc/RubyXL/IndexedColors.html +106 -0
- data/rdoc/RubyXL/InputCells.html +106 -0
- data/rdoc/RubyXL/IntegerNode.html +103 -0
- data/rdoc/RubyXL/IntegerValue.html +103 -0
- data/rdoc/RubyXL/LegacyCell.html +181 -0
- data/rdoc/RubyXL/LegacyWorksheet.html +355 -0
- data/rdoc/RubyXL/MRUColors.html +106 -0
- data/rdoc/RubyXL/MacrosFile.html +122 -0
- data/rdoc/RubyXL/MergedCell.html +106 -0
- data/rdoc/RubyXL/MergedCells.html +106 -0
- data/rdoc/RubyXL/NumFmt.html +106 -0
- data/rdoc/RubyXL/NumberFormat.html +158 -0
- data/rdoc/RubyXL/NumberFormats.html +172 -0
- data/rdoc/RubyXL/OLEObject.html +106 -0
- data/rdoc/RubyXL/OLEObjectFile.html +122 -0
- data/rdoc/RubyXL/OLEObjects.html +106 -0
- data/rdoc/RubyXL/OLESize.html +106 -0
- data/rdoc/RubyXL/OOXMLContainerObject.html +394 -0
- data/rdoc/RubyXL/OOXMLObject.html +118 -0
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +532 -0
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +564 -0
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +603 -0
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +384 -0
- data/rdoc/RubyXL/Offset.html +106 -0
- data/rdoc/RubyXL/OutlineProperties.html +106 -0
- data/rdoc/RubyXL/PageMargins.html +106 -0
- data/rdoc/RubyXL/PageSetup.html +106 -0
- data/rdoc/RubyXL/PageSetupProperties.html +106 -0
- data/rdoc/RubyXL/Pane.html +106 -0
- data/rdoc/RubyXL/Parser.html +204 -0
- data/rdoc/RubyXL/PatternFill.html +106 -0
- data/rdoc/RubyXL/PhoneticProperties.html +106 -0
- data/rdoc/RubyXL/PhoneticRun.html +106 -0
- data/rdoc/RubyXL/PivotArea.html +106 -0
- data/rdoc/RubyXL/PivotCache.html +106 -0
- data/rdoc/RubyXL/PivotCacheDefinitionFile.html +133 -0
- data/rdoc/RubyXL/PivotCacheRecordsFile.html +122 -0
- data/rdoc/RubyXL/PivotCaches.html +106 -0
- data/rdoc/RubyXL/PivotReference.html +106 -0
- data/rdoc/RubyXL/PivotReferences.html +106 -0
- data/rdoc/RubyXL/PivotTableFile.html +133 -0
- data/rdoc/RubyXL/PivotTableSelection.html +106 -0
- data/rdoc/RubyXL/PresetGeometry.html +106 -0
- data/rdoc/RubyXL/PrintOptions.html +106 -0
- data/rdoc/RubyXL/PrinterSettingsFile.html +122 -0
- data/rdoc/RubyXL/ProtectedRange.html +106 -0
- data/rdoc/RubyXL/ProtectedRanges.html +106 -0
- data/rdoc/RubyXL/Protection.html +106 -0
- data/rdoc/RubyXL/RID.html +103 -0
- data/rdoc/RubyXL/RawOOXML.html +223 -0
- data/rdoc/RubyXL/Reference.html +640 -0
- data/rdoc/RubyXL/Relationship.html +103 -0
- data/rdoc/RubyXL/RelationshipSupport.html +419 -0
- data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +148 -0
- data/rdoc/RubyXL/RichText.html +159 -0
- data/rdoc/RubyXL/RichTextRun.html +157 -0
- data/rdoc/RubyXL/Row.html +439 -0
- data/rdoc/RubyXL/RowExt.html +106 -0
- data/rdoc/RubyXL/RunProperties.html +106 -0
- data/rdoc/RubyXL/Scenario.html +106 -0
- data/rdoc/RubyXL/Scenarios.html +106 -0
- data/rdoc/RubyXL/Selection.html +165 -0
- data/rdoc/RubyXL/ShapeGuide.html +106 -0
- data/rdoc/RubyXL/ShapeTextRectangle.html +106 -0
- data/rdoc/RubyXL/SharedStringsTable.html +424 -0
- data/rdoc/RubyXL/Sheet.html +106 -0
- data/rdoc/RubyXL/SheetCalculationProperties.html +106 -0
- data/rdoc/RubyXL/SheetData.html +192 -0
- data/rdoc/RubyXL/SheetDataExt.html +106 -0
- data/rdoc/RubyXL/SheetDataSet.html +106 -0
- data/rdoc/RubyXL/SheetName.html +106 -0
- data/rdoc/RubyXL/SheetNames.html +106 -0
- data/rdoc/RubyXL/Sheets.html +106 -0
- data/rdoc/RubyXL/SlicerCacheFile.html +122 -0
- data/rdoc/RubyXL/SlicerFile.html +122 -0
- data/rdoc/RubyXL/SmartTagProperties.html +106 -0
- data/rdoc/RubyXL/SmartTagType.html +106 -0
- data/rdoc/RubyXL/SmartTagTypes.html +106 -0
- data/rdoc/RubyXL/SmartTags.html +106 -0
- data/rdoc/RubyXL/SortCondition.html +106 -0
- data/rdoc/RubyXL/SortState.html +106 -0
- data/rdoc/RubyXL/Sqref.html +197 -0
- data/rdoc/RubyXL/Stop.html +106 -0
- data/rdoc/RubyXL/StringNode.html +103 -0
- data/rdoc/RubyXL/StringNodeW3C.html +197 -0
- data/rdoc/RubyXL/StringValue.html +103 -0
- data/rdoc/RubyXL/Stylesheet.html +354 -0
- data/rdoc/RubyXL/TableFile.html +122 -0
- data/rdoc/RubyXL/TableParts.html +103 -0
- data/rdoc/RubyXL/TableStyle.html +106 -0
- data/rdoc/RubyXL/TableStyles.html +106 -0
- data/rdoc/RubyXL/Text.html +216 -0
- data/rdoc/RubyXL/Theme.html +535 -0
- data/rdoc/RubyXL/ThemeElements.html +106 -0
- data/rdoc/RubyXL/ThumbnailFile.html +122 -0
- data/rdoc/RubyXL/Top10.html +106 -0
- data/rdoc/RubyXL/VMLDrawingFile.html +134 -0
- data/rdoc/RubyXL/Variant.html +106 -0
- data/rdoc/RubyXL/Vector.html +161 -0
- data/rdoc/RubyXL/VectorValue.html +103 -0
- data/rdoc/RubyXL/VisualProperties.html +106 -0
- data/rdoc/RubyXL/WebPublishObject.html +106 -0
- data/rdoc/RubyXL/WebPublishObjects.html +106 -0
- data/rdoc/RubyXL/WebPublishingItem.html +106 -0
- data/rdoc/RubyXL/WebPublishingItems.html +106 -0
- data/rdoc/RubyXL/WebPublishingProperties.html +106 -0
- data/rdoc/RubyXL/Workbook.html +633 -0
- data/rdoc/RubyXL/WorkbookConvenienceMethods.html +1321 -0
- data/rdoc/RubyXL/WorkbookProperties.html +106 -0
- data/rdoc/RubyXL/WorkbookProtection.html +106 -0
- data/rdoc/RubyXL/WorkbookRoot.html +402 -0
- data/rdoc/RubyXL/WorkbookView.html +106 -0
- data/rdoc/RubyXL/WorkbookViews.html +106 -0
- data/rdoc/RubyXL/Worksheet.html +433 -0
- data/rdoc/RubyXL/WorksheetConvenienceMethods.html +2861 -0
- data/rdoc/RubyXL/WorksheetDimensions.html +106 -0
- data/rdoc/RubyXL/WorksheetFormatProperties.html +103 -0
- data/rdoc/RubyXL/WorksheetProperties.html +106 -0
- data/rdoc/RubyXL/WorksheetProtection.html +106 -0
- data/rdoc/RubyXL/WorksheetView.html +106 -0
- data/rdoc/RubyXL/WorksheetViews.html +106 -0
- data/rdoc/RubyXL/XF.html +106 -0
- data/rdoc/created.rid +38 -0
- data/rdoc/css/fonts.css +167 -0
- data/rdoc/css/rdoc.css +590 -0
- data/rdoc/fonts/Lato-Light.ttf +0 -0
- data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
- data/rdoc/fonts/Lato-Regular.ttf +0 -0
- data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/arrow_up.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +796 -0
- data/rdoc/js/darkfish.js +161 -0
- data/rdoc/js/jquery.js +4 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/navigation.js.gz +0 -0
- data/rdoc/js/search.js +109 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/search_index.js.gz +0 -0
- data/rdoc/js/searcher.js +229 -0
- data/rdoc/js/searcher.js.gz +0 -0
- data/rdoc/table_of_contents.html +2758 -0
- data/rubyXL.gemspec +516 -0
- data/spec/lib/cell_spec.rb +515 -0
- data/spec/lib/color_spec.rb +13 -0
- data/spec/lib/parser_spec.rb +118 -0
- data/spec/lib/reference_spec.rb +28 -0
- data/spec/lib/stylesheet_spec.rb +28 -0
- data/spec/lib/text_spec.rb +29 -0
- data/spec/lib/workbook_spec.rb +174 -0
- data/spec/lib/worksheet_spec.rb +1363 -0
- data/spec/spec_helper.rb +11 -0
- data/test/input/.gitkeep +0 -0
- data/test/output/.gitkeep +0 -0
- data/test/test_parse_write.rb +15 -0
- data/tmp/.gitignore +1 -0
- metadata +615 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module RubyXL
|
|
2
|
+
class Parser
|
|
3
|
+
|
|
4
|
+
# Parse <tt>.xslx</tt> file by reading it from local disk.
|
|
5
|
+
def self.parse(src_file_path)
|
|
6
|
+
begin
|
|
7
|
+
::Zip::File.open(src_file_path) { |zip_file|
|
|
8
|
+
root = RubyXL::WorkbookRoot.parse_zip_file(zip_file)
|
|
9
|
+
root.source_file_path = src_file_path
|
|
10
|
+
root.workbook
|
|
11
|
+
}
|
|
12
|
+
rescue ::Zip::Error => e
|
|
13
|
+
raise e, "XLSX file format error: #{e}", e.backtrace
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Parse <tt>.xslx</tt> file contained in a stream (useful for receiving over HTTP).
|
|
18
|
+
def self.parse_buffer(buffer)
|
|
19
|
+
root = nil # Zip::File.open_buffer somehow fails to return the value from the block :(
|
|
20
|
+
begin
|
|
21
|
+
::Zip::File.open_buffer(buffer) { |zip_file| root = RubyXL::WorkbookRoot.parse_zip_file(zip_file) }
|
|
22
|
+
root.workbook
|
|
23
|
+
rescue ::Zip::Error => e
|
|
24
|
+
raise e, "XLSX file format error: #{e}", e.backtrace
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
module RubyXL
|
|
2
|
+
module LegacyWorksheet
|
|
3
|
+
include Enumerable
|
|
4
|
+
|
|
5
|
+
def initialize(params = {})
|
|
6
|
+
super
|
|
7
|
+
self.workbook = params[:workbook]
|
|
8
|
+
self.sheet_name = params[:sheet_name]
|
|
9
|
+
self.sheet_id = params[:sheet_id]
|
|
10
|
+
self.sheet_data = RubyXL::SheetData.new
|
|
11
|
+
self.cols = RubyXL::ColumnRanges.new
|
|
12
|
+
@comments = [] # Do not optimize! These are arrays, so they will share the pointer!
|
|
13
|
+
@printer_settings = []
|
|
14
|
+
@generic_storage = []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# allows for easier access to sheet_data
|
|
18
|
+
def [](row = 0)
|
|
19
|
+
sheet_data[row]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def each
|
|
23
|
+
sheet_data.rows.each { |row| yield(row) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def add_row(row_index = 0, params = {})
|
|
27
|
+
new_row = RubyXL::Row.new(params)
|
|
28
|
+
new_row.worksheet = self
|
|
29
|
+
sheet_data.rows[row_index] = new_row
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
|
|
33
|
+
validate_workbook
|
|
34
|
+
validate_nonnegative(row_index)
|
|
35
|
+
validate_nonnegative(column_index)
|
|
36
|
+
row = sheet_data.rows[row_index] || add_row(row_index)
|
|
37
|
+
|
|
38
|
+
c = row.cells[column_index]
|
|
39
|
+
|
|
40
|
+
if overwrite || c.nil?
|
|
41
|
+
c = RubyXL::Cell.new
|
|
42
|
+
c.worksheet = self
|
|
43
|
+
c.row = row_index
|
|
44
|
+
c.column = column_index
|
|
45
|
+
|
|
46
|
+
if formula then
|
|
47
|
+
c.formula = RubyXL::Formula.new(:expression => formula)
|
|
48
|
+
c.raw_value = data
|
|
49
|
+
else
|
|
50
|
+
case data
|
|
51
|
+
when Numeric then c.raw_value = data
|
|
52
|
+
when String then
|
|
53
|
+
c.raw_value = data
|
|
54
|
+
c.datatype = RubyXL::DataType::RAW_STRING
|
|
55
|
+
when RubyXL::RichText then
|
|
56
|
+
c.is = data
|
|
57
|
+
c.datatype = RubyXL::DataType::INLINE_STRING
|
|
58
|
+
when NilClass then nil
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
range = cols && cols.locate_range(column_index)
|
|
63
|
+
c.style_index = row.style_index || (range && range.style_index) || 0
|
|
64
|
+
row.cells[column_index] = c
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
c
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
#validates Workbook, ensures that this worksheet is in @workbook
|
|
73
|
+
def validate_workbook()
|
|
74
|
+
unless @workbook.nil? || @workbook.worksheets.nil?
|
|
75
|
+
return if @workbook.worksheets.any? { |sheet| sheet.equal?(self) }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
raise "This worksheet #{self} is not in workbook #{@workbook}"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Ensures that storage space for a cell with +row_index+ and +column_index+
|
|
82
|
+
# exists in +sheet_data+ arrays, growing them up if necessary.
|
|
83
|
+
def ensure_cell_exists(row_index, column_index = 0)
|
|
84
|
+
validate_nonnegative(row_index)
|
|
85
|
+
validate_nonnegative(column_index)
|
|
86
|
+
|
|
87
|
+
sheet_data.rows[row_index] || add_row(row_index)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def get_col_xf(column_index)
|
|
91
|
+
@workbook.cell_xfs[get_col_style(column_index)]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def get_row_xf(row)
|
|
95
|
+
validate_nonnegative(row)
|
|
96
|
+
@workbook.cell_xfs[get_row_style(row)]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def validate_nonnegative(row_or_col)
|
|
100
|
+
raise 'Row and Column arguments must be nonnegative' if row_or_col < 0
|
|
101
|
+
end
|
|
102
|
+
private :validate_nonnegative
|
|
103
|
+
|
|
104
|
+
end #end class
|
|
105
|
+
end
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>README - rubyXL 3.3.27</title>
|
|
8
|
+
|
|
9
|
+
<script type="text/javascript">
|
|
10
|
+
var rdoc_rel_prefix = "./";
|
|
11
|
+
var index_rel_prefix = "./";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script src="./js/jquery.js"></script>
|
|
15
|
+
<script src="./js/darkfish.js"></script>
|
|
16
|
+
|
|
17
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
18
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<body id="top" role="document" class="file">
|
|
23
|
+
<nav role="navigation">
|
|
24
|
+
<div id="project-navigation">
|
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
26
|
+
<h2>
|
|
27
|
+
<a href="./index.html" rel="home">Home</a>
|
|
28
|
+
</h2>
|
|
29
|
+
|
|
30
|
+
<div id="table-of-contents-navigation">
|
|
31
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
32
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
33
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
39
|
+
<div id="search-field-wrapper">
|
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
|
47
|
+
aria-busy="false" aria-expanded="false"
|
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
49
|
+
</form>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<div class="nav-section">
|
|
56
|
+
<h3>Table of Contents</h3>
|
|
57
|
+
|
|
58
|
+
<ul class="link-list" role="directory">
|
|
59
|
+
<li><a href="#label-rubyXL">rubyXL</a>
|
|
60
|
+
<li><a href="#label-To+Install-3A">To Install:</a>
|
|
61
|
+
<li><a href="#label-To+Use-3A">To Use:</a>
|
|
62
|
+
<li><a href="#label-Parsing+an+existing+workbook">Parsing an existing workbook</a>
|
|
63
|
+
<li><a href="#label-Creating+a+new+Workbook">Creating a new Workbook</a>
|
|
64
|
+
<li><a href="#label-Accessing">Accessing</a>
|
|
65
|
+
<li><a href="#label-Accessing+a+Worksheet">Accessing a Worksheet</a>
|
|
66
|
+
<li><a href="#label-Accessing+a+Row+-28Array+of+Cells-29">Accessing a Row (Array of Cells)</a>
|
|
67
|
+
<li><a href="#label-Accessing+a+Cell+object">Accessing a Cell object</a>
|
|
68
|
+
<li><a href="#label-Wrappers+for+accessing+Cell+properties">Wrappers for accessing Cell properties</a>
|
|
69
|
+
<li><a href="#label-Wrappers+for+accessing+Row+properties+">Wrappers for accessing Row properties </a>
|
|
70
|
+
<li><a href="#label-Accessing+column+properties">Accessing column properties</a>
|
|
71
|
+
<li><a href="#label-Table+reading">Table reading</a>
|
|
72
|
+
<li><a href="#label-Modifying">Modifying</a>
|
|
73
|
+
<li><a href="#label-Adding+Worksheets">Adding Worksheets</a>
|
|
74
|
+
<li><a href="#label-Renaming+Worksheets">Renaming Worksheets</a>
|
|
75
|
+
<li><a href="#label-Adding+Cells">Adding Cells</a>
|
|
76
|
+
<li><a href="#label-Changing+Cells">Changing Cells</a>
|
|
77
|
+
<li><a href="#label-Changing+Fonts">Changing Fonts</a>
|
|
78
|
+
<li><a href="#label-Changing+Fills+++++">Changing Fills </a>
|
|
79
|
+
<li><a href="#label-Changing+Borders">Changing Borders</a>
|
|
80
|
+
<li><a href="#label-Changing+Alignment">Changing Alignment</a>
|
|
81
|
+
<li><a href="#label-Horizontal">Horizontal</a>
|
|
82
|
+
<li><a href="#label-Vertical">Vertical</a>
|
|
83
|
+
<li><a href="#label-Changing+Row+Height">Changing Row Height</a>
|
|
84
|
+
<li><a href="#label-Changing+Column+Width">Changing Column Width</a>
|
|
85
|
+
<li><a href="#label-Merging+Cells">Merging Cells</a>
|
|
86
|
+
<li><a href="#label-Insert+Row">Insert Row</a>
|
|
87
|
+
<li><a href="#label-Insert+Column">Insert Column</a>
|
|
88
|
+
<li><a href="#label-Delete+Row">Delete Row</a>
|
|
89
|
+
<li><a href="#label-Delete+Column">Delete Column</a>
|
|
90
|
+
<li><a href="#label-Insert+Cell">Insert Cell</a>
|
|
91
|
+
<li><a href="#label-Delete+Cell">Delete Cell</a>
|
|
92
|
+
<li><a href="#label-Modifying+Cell+Format">Modifying Cell Format</a>
|
|
93
|
+
<li><a href="#label-I-2FO">I/O</a>
|
|
94
|
+
<li><a href="#label-Miscellaneous">Miscellaneous</a>
|
|
95
|
+
<li><a href="#label-For+more+information">For more information</a>
|
|
96
|
+
<li><a href="#label-Contributing+to+rubyXL">Contributing to rubyXL</a>
|
|
97
|
+
<li><a href="#label-Copyright">Copyright</a>
|
|
98
|
+
</ul>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<div id="project-metadata">
|
|
103
|
+
<div id="fileindex-section" class="nav-section">
|
|
104
|
+
<h3>Pages</h3>
|
|
105
|
+
|
|
106
|
+
<ul class="link-list">
|
|
107
|
+
|
|
108
|
+
<li><a href="./README_rdoc.html">README</a>
|
|
109
|
+
|
|
110
|
+
</ul>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
</nav>
|
|
115
|
+
|
|
116
|
+
<main role="main" aria-label="Page README.rdoc">
|
|
117
|
+
|
|
118
|
+
<h1 id="label-rubyXL">rubyXL<span><a href="#label-rubyXL">¶</a> <a href="#top">↑</a></span></h1>
|
|
119
|
+
|
|
120
|
+
<p><a href="http://badge.fury.io/rb/rubyXL"><img
|
|
121
|
+
src="https://badge.fury.io/rb/rubyXL.svg" alt="Gem Version" /></a> <a
|
|
122
|
+
href="https://codeclimate.com/github/weshatheleopard/rubyXL"><img
|
|
123
|
+
src="https://codeclimate.com/github/weshatheleopard/rubyXL.png" alt="Code
|
|
124
|
+
Climate" /></a></p>
|
|
125
|
+
|
|
126
|
+
<p>This gem supports operating on <code>xlsx</code> files (Open XML format).
|
|
127
|
+
While it is capable of properly parsing the entire OOXML structure, its
|
|
128
|
+
current main emphasis is on reading files produced by MS Excel, making
|
|
129
|
+
minor modifications to them and saving them to be opened again, while
|
|
130
|
+
preserving as much of the structure as possible.</p>
|
|
131
|
+
|
|
132
|
+
<p>Please note that proprietary binary <code>xls</code> format is
|
|
133
|
+
<strong>not</strong> supported.</p>
|
|
134
|
+
|
|
135
|
+
<h2 id="label-To+Install-3A">To Install:<span><a href="#label-To+Install-3A">¶</a> <a href="#top">↑</a></span></h2>
|
|
136
|
+
|
|
137
|
+
<pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">rubyXL</span>
|
|
138
|
+
</pre>
|
|
139
|
+
|
|
140
|
+
<h2 id="label-To+Use-3A">To Use:<span><a href="#label-To+Use-3A">¶</a> <a href="#top">↑</a></span></h2>
|
|
141
|
+
|
|
142
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'rubyXL'</span> <span class="ruby-comment"># Assuming rubygems is already required</span>
|
|
143
|
+
</pre>
|
|
144
|
+
|
|
145
|
+
<h3 id="label-Parsing+an+existing+workbook">Parsing an existing workbook<span><a href="#label-Parsing+an+existing+workbook">¶</a> <a href="#top">↑</a></span></h3>
|
|
146
|
+
|
|
147
|
+
<pre class="ruby"><span class="ruby-identifier">workbook</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">"path/to/Excel/file.xlsx"</span>)
|
|
148
|
+
</pre>
|
|
149
|
+
|
|
150
|
+
<h3 id="label-Creating+a+new+Workbook">Creating a new Workbook<span><a href="#label-Creating+a+new+Workbook">¶</a> <a href="#top">↑</a></span></h3>
|
|
151
|
+
|
|
152
|
+
<pre class="ruby"><span class="ruby-identifier">workbook</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Workbook</span>.<span class="ruby-identifier">new</span>
|
|
153
|
+
</pre>
|
|
154
|
+
|
|
155
|
+
<h3 id="label-Accessing">Accessing<span><a href="#label-Accessing">¶</a> <a href="#top">↑</a></span></h3>
|
|
156
|
+
|
|
157
|
+
<h4 id="label-Accessing+a+Worksheet">Accessing a Worksheet<span><a href="#label-Accessing+a+Worksheet">¶</a> <a href="#top">↑</a></span></h4>
|
|
158
|
+
|
|
159
|
+
<pre class="ruby"><span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">worksheets</span>[<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns first worksheet</span>
|
|
160
|
+
<span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns first worksheet</span>
|
|
161
|
+
<span class="ruby-identifier">workbook</span>[<span class="ruby-string">'Sheet1'</span>] <span class="ruby-comment"># Finds and returns worksheet titled "Sheet1"</span>
|
|
162
|
+
</pre>
|
|
163
|
+
|
|
164
|
+
<h4 id="label-Accessing+a+Row+-28Array+of+Cells-29">Accessing a Row (Array of Cells)<span><a href="#label-Accessing+a+Row+-28Array+of+Cells-29">¶</a> <a href="#top">↑</a></span></h4>
|
|
165
|
+
|
|
166
|
+
<p>Please note that worksheet is a <em>sparse</em> array of rows. Your code
|
|
167
|
+
<strong>must</strong> expect that any row it plucks from the array may be
|
|
168
|
+
<code>nil</code>.</p>
|
|
169
|
+
|
|
170
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>]
|
|
171
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns first row of the worksheet</span>
|
|
172
|
+
<span class="ruby-identifier">worksheet</span>[<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns first row of the worksheet</span>
|
|
173
|
+
</pre>
|
|
174
|
+
|
|
175
|
+
<h4 id="label-Accessing+a+Cell+object">Accessing a Cell object<span><a href="#label-Accessing+a+Cell+object">¶</a> <a href="#top">↑</a></span></h4>
|
|
176
|
+
|
|
177
|
+
<p>Please note that row is a <em>sparse</em> array of cells. Your code
|
|
178
|
+
<strong>must</strong> expect that any cell it plucks from the array may be
|
|
179
|
+
<code>nil</code>.</p>
|
|
180
|
+
|
|
181
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>]
|
|
182
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns cell A1 in the worksheet</span>
|
|
183
|
+
<span class="ruby-identifier">worksheet</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-comment"># Returns cell A1 in the worksheet</span>
|
|
184
|
+
</pre>
|
|
185
|
+
|
|
186
|
+
<h4 id="label-Wrappers+for+accessing+Cell+properties">Wrappers for accessing Cell properties<span><a href="#label-Wrappers+for+accessing+Cell+properties">¶</a> <a href="#top">↑</a></span></h4>
|
|
187
|
+
|
|
188
|
+
<pre class="ruby"><span class="ruby-identifier">cell</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
|
|
189
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">is_struckthrough</span> <span class="ruby-comment"># Returns +true+ if the cell is struckthrough, other boolean properties have same syntax</span>
|
|
190
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">font_name</span>
|
|
191
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">font_size</span>
|
|
192
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">font_color</span>
|
|
193
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">fill_color</span>
|
|
194
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">horizontal_alignment</span>
|
|
195
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">vertical_alignment</span>
|
|
196
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">get_border</span>(:<span class="ruby-identifier">top</span>)
|
|
197
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">get_border_color</span>(:<span class="ruby-identifier">top</span>)
|
|
198
|
+
</pre>
|
|
199
|
+
|
|
200
|
+
<h4 id="label-Wrappers+for+accessing+Row+properties+">Wrappers for accessing Row properties <span><a href="#label-Wrappers+for+accessing+Row+properties+">¶</a> <a href="#top">↑</a></span></h4>
|
|
201
|
+
|
|
202
|
+
<p>Please note: these methods are being phased out in favor of the OOXML
|
|
203
|
+
object model.</p>
|
|
204
|
+
|
|
205
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>]
|
|
206
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_fill</span>(<span class="ruby-value">0</span>)
|
|
207
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_font_name</span>(<span class="ruby-value">0</span>)
|
|
208
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_font_size</span>(<span class="ruby-value">0</span>)
|
|
209
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_font_color</span>(<span class="ruby-value">0</span>)
|
|
210
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">is_row_underlined</span>(<span class="ruby-value">0</span>)
|
|
211
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_height</span>(<span class="ruby-value">0</span>)
|
|
212
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-keyword">true</span>)
|
|
213
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-keyword">false</span>)
|
|
214
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_border</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">right</span>)
|
|
215
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_row_border_color</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">right</span>)
|
|
216
|
+
</pre>
|
|
217
|
+
|
|
218
|
+
<h4 id="label-Accessing+column+properties">Accessing column properties<span><a href="#label-Accessing+column+properties">¶</a> <a href="#top">↑</a></span></h4>
|
|
219
|
+
|
|
220
|
+
<p>Please note: these methods are being phased out in favor of the OOXML
|
|
221
|
+
object model.</p>
|
|
222
|
+
|
|
223
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>]
|
|
224
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_fill</span>(<span class="ruby-value">0</span>)
|
|
225
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_font_name</span>(<span class="ruby-value">0</span>)
|
|
226
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_font_size</span>(<span class="ruby-value">0</span>)
|
|
227
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_font_color</span>(<span class="ruby-value">0</span>)
|
|
228
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">is_column_underlined</span>(<span class="ruby-value">0</span>)
|
|
229
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_width</span>(<span class="ruby-value">0</span>)
|
|
230
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_alignment</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">horizontal</span>)
|
|
231
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_alignment</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">vertical</span>)
|
|
232
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_border</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">right</span>)
|
|
233
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_column_border_color</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">right</span>)
|
|
234
|
+
</pre>
|
|
235
|
+
|
|
236
|
+
<h4 id="label-Table+reading">Table reading<span><a href="#label-Table+reading">¶</a> <a href="#top">↑</a></span></h4>
|
|
237
|
+
|
|
238
|
+
<p>In order to discourage unnecessary reshuffling of data in memory, methods
|
|
239
|
+
<code>extract_data</code> and <code>get_table</code> are being deprecated.
|
|
240
|
+
You should access and iterate through rows and cells directly:</p>
|
|
241
|
+
|
|
242
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
|
|
243
|
+
<span class="ruby-identifier">row</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cell</span><span class="ruby-operator">|</span>
|
|
244
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">cell</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">cell</span>.<span class="ruby-identifier">value</span>
|
|
245
|
+
<span class="ruby-identifier">do_whatever_you_want</span>(<span class="ruby-identifier">val</span>)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
</pre>
|
|
249
|
+
|
|
250
|
+
<h3 id="label-Modifying">Modifying<span><a href="#label-Modifying">¶</a> <a href="#top">↑</a></span></h3>
|
|
251
|
+
|
|
252
|
+
<h4 id="label-Adding+Worksheets">Adding Worksheets<span><a href="#label-Adding+Worksheets">¶</a> <a href="#top">↑</a></span></h4>
|
|
253
|
+
|
|
254
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">add_worksheet</span>(<span class="ruby-string">'Sheet2'</span>)
|
|
255
|
+
</pre>
|
|
256
|
+
|
|
257
|
+
<h4 id="label-Renaming+Worksheets">Renaming Worksheets<span><a href="#label-Renaming+Worksheets">¶</a> <a href="#top">↑</a></span></h4>
|
|
258
|
+
|
|
259
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_name</span> = <span class="ruby-string">'Cool New Name'</span>
|
|
260
|
+
</pre>
|
|
261
|
+
|
|
262
|
+
<h4 id="label-Adding+Cells">Adding Cells<span><a href="#label-Adding+Cells">¶</a> <a href="#top">↑</a></span></h4>
|
|
263
|
+
|
|
264
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">add_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">'A1'</span>) <span class="ruby-comment"># Sets cell A1 to string "A1"</span>
|
|
265
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">add_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-string">''</span>, <span class="ruby-string">'A1'</span>) <span class="ruby-comment"># Sets formula in the cell B1 to '=A1'</span>
|
|
266
|
+
</pre>
|
|
267
|
+
|
|
268
|
+
<h4 id="label-Changing+Cells">Changing Cells<span><a href="#label-Changing+Cells">¶</a> <a href="#top">↑</a></span></h4>
|
|
269
|
+
|
|
270
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_contents</span>(<span class="ruby-string">""</span>, <span class="ruby-identifier">worksheet</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">formula</span>) <span class="ruby-comment"># Sets value of cell A1 to empty string, preserves formula</span>
|
|
271
|
+
</pre>
|
|
272
|
+
|
|
273
|
+
<h4 id="label-Changing+Fonts">Changing Fonts<span><a href="#label-Changing+Fonts">¶</a> <a href="#top">↑</a></span></h4>
|
|
274
|
+
|
|
275
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_font_bold</span>(<span class="ruby-keyword">true</span>) <span class="ruby-comment"># Makes A1 bold</span>
|
|
276
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_italics</span>(<span class="ruby-value">0</span>,<span class="ruby-keyword">true</span>) <span class="ruby-comment"># Makes first row italicized</span>
|
|
277
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_font_name</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'Courier'</span>) <span class="ruby-comment"># Makes first column have font Courier</span>
|
|
278
|
+
</pre>
|
|
279
|
+
|
|
280
|
+
<h4 id="label-Changing+Fills+++++">Changing Fills <span><a href="#label-Changing+Fills+++++">¶</a> <a href="#top">↑</a></span></h4>
|
|
281
|
+
|
|
282
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_fill</span>(<span class="ruby-string">'0ba53d'</span>) <span class="ruby-comment"># Sets A1 to have fill #0ba53d</span>
|
|
283
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_fill</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'0ba53d'</span>) <span class="ruby-comment"># Sets first row to have fill #0ba53d</span>
|
|
284
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_fill</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'0ba53d'</span>) <span class="ruby-comment"># Sets first column to have fill #0ba53d</span>
|
|
285
|
+
</pre>
|
|
286
|
+
|
|
287
|
+
<h4 id="label-Changing+Borders">Changing Borders<span><a href="#label-Changing+Borders">¶</a> <a href="#top">↑</a></span></h4>
|
|
288
|
+
|
|
289
|
+
<pre class="ruby"><span class="ruby-comment"># Possible weights: hairline, thin, medium, thick</span>
|
|
290
|
+
<span class="ruby-comment"># Possible "directions": top, bottom, left, right, diagonal</span>
|
|
291
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_border</span>(:<span class="ruby-identifier">top</span>, <span class="ruby-string">'thin'</span>) <span class="ruby-comment"># Sets A1 to have a top, thin border</span>
|
|
292
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_border</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">left</span>, <span class="ruby-string">'hairline'</span>) <span class="ruby-comment"># Sets first row to have a left, hairline border</span>
|
|
293
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_border</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">diagonal</span>, <span class="ruby-string">'medium'</span>) <span class="ruby-comment"># Sets first column to have diagonal, medium border</span>
|
|
294
|
+
|
|
295
|
+
<span class="ruby-comment"># Set the border style first so there's something to color.</span>
|
|
296
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_border_color</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">top</span>, <span class="ruby-string">'0ba53d'</span>) <span class="ruby-comment"># Sets first row to have a green top border</span>
|
|
297
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_border_color</span>(<span class="ruby-value">0</span>, :<span class="ruby-identifier">top</span>, <span class="ruby-string">'0ba53d'</span>) <span class="ruby-comment"># Sets first column to have a green top border</span>
|
|
298
|
+
</pre>
|
|
299
|
+
|
|
300
|
+
<h4 id="label-Changing+Alignment">Changing Alignment<span><a href="#label-Changing+Alignment">¶</a> <a href="#top">↑</a></span></h4>
|
|
301
|
+
|
|
302
|
+
<h5 id="label-Horizontal">Horizontal<span><a href="#label-Horizontal">¶</a> <a href="#top">↑</a></span></h5>
|
|
303
|
+
|
|
304
|
+
<p>center, distributed, justify, left, right</p>
|
|
305
|
+
|
|
306
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_horizontal_alignment</span>(<span class="ruby-string">'center'</span>) <span class="ruby-comment"># Sets A1 to be centered</span>
|
|
307
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_horizontal_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'justify'</span>) <span class="ruby-comment"># Sets first row to be justified</span>
|
|
308
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_horizontal_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'right'</span>) <span class="ruby-comment"># Sets first column to be right-aligned</span>
|
|
309
|
+
</pre>
|
|
310
|
+
|
|
311
|
+
<h5 id="label-Vertical">Vertical<span><a href="#label-Vertical">¶</a> <a href="#top">↑</a></span></h5>
|
|
312
|
+
|
|
313
|
+
<p>bottom, center, distributed, top</p>
|
|
314
|
+
|
|
315
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">sheet_data</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">change_vertical_alignment</span>(<span class="ruby-string">'bottom'</span>) <span class="ruby-comment"># Sets A1 to be bottom aligned</span>
|
|
316
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_vertical_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'distributed'</span>) <span class="ruby-comment"># Sets first row to be distributed vertically</span>
|
|
317
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_vertical_alignment</span>(<span class="ruby-value">0</span>, <span class="ruby-string">'top'</span>) <span class="ruby-comment"># Sets first column to be top aligned</span>
|
|
318
|
+
</pre>
|
|
319
|
+
|
|
320
|
+
<h4 id="label-Changing+Row+Height">Changing Row Height<span><a href="#label-Changing+Row+Height">¶</a> <a href="#top">↑</a></span></h4>
|
|
321
|
+
|
|
322
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_row_height</span>(<span class="ruby-value">0</span>, <span class="ruby-value">30</span>) <span class="ruby-comment"># Sets first row height to 30</span>
|
|
323
|
+
</pre>
|
|
324
|
+
|
|
325
|
+
<h4 id="label-Changing+Column+Width">Changing Column Width<span><a href="#label-Changing+Column+Width">¶</a> <a href="#top">↑</a></span></h4>
|
|
326
|
+
|
|
327
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">change_column_width</span>(<span class="ruby-value">0</span>, <span class="ruby-value">30</span>) <span class="ruby-comment"># Sets first column width to 30</span>
|
|
328
|
+
</pre>
|
|
329
|
+
|
|
330
|
+
<h4 id="label-Merging+Cells">Merging Cells<span><a href="#label-Merging+Cells">¶</a> <a href="#top">↑</a></span></h4>
|
|
331
|
+
|
|
332
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">merge_cells</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># Merges A1:B2</span>
|
|
333
|
+
</pre>
|
|
334
|
+
|
|
335
|
+
<h4 id="label-Insert+Row">Insert Row<span><a href="#label-Insert+Row">¶</a> <a href="#top">↑</a></span></h4>
|
|
336
|
+
|
|
337
|
+
<p>This method will insert a row at specified index, pushing all rows below it
|
|
338
|
+
down. It also copies styles from row above.</p>
|
|
339
|
+
|
|
340
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
341
|
+
have been moved, as the formulas do not adapt to the shifted rows</p>
|
|
342
|
+
|
|
343
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">insert_row</span>(<span class="ruby-value">1</span>)
|
|
344
|
+
</pre>
|
|
345
|
+
|
|
346
|
+
<h4 id="label-Insert+Column">Insert Column<span><a href="#label-Insert+Column">¶</a> <a href="#top">↑</a></span></h4>
|
|
347
|
+
|
|
348
|
+
<p>This method will insert a column at specified index, pushing all columns to
|
|
349
|
+
the right of it one to the right. It also copies styles from column to the
|
|
350
|
+
left</p>
|
|
351
|
+
|
|
352
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
353
|
+
have been moved, as the formulas do not adapt to the shifted columns</p>
|
|
354
|
+
|
|
355
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">insert_column</span>(<span class="ruby-value">1</span>)
|
|
356
|
+
</pre>
|
|
357
|
+
|
|
358
|
+
<h4 id="label-Delete+Row">Delete Row<span><a href="#label-Delete+Row">¶</a> <a href="#top">↑</a></span></h4>
|
|
359
|
+
|
|
360
|
+
<p>This method will delete a row at specified index, pushing all rows below it
|
|
361
|
+
up.</p>
|
|
362
|
+
|
|
363
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
364
|
+
have been moved, as the formulas do not adapt to the shifted rows</p>
|
|
365
|
+
|
|
366
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">delete_row</span>(<span class="ruby-value">1</span>)
|
|
367
|
+
</pre>
|
|
368
|
+
|
|
369
|
+
<h4 id="label-Delete+Column">Delete Column<span><a href="#label-Delete+Column">¶</a> <a href="#top">↑</a></span></h4>
|
|
370
|
+
|
|
371
|
+
<p>This method will delete a column at specified index, pushing all columns to
|
|
372
|
+
the right of it left.</p>
|
|
373
|
+
|
|
374
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
375
|
+
have been moved, as the formulas do not adapt to the shifted columns</p>
|
|
376
|
+
|
|
377
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">delete_column</span>(<span class="ruby-value">1</span>)
|
|
378
|
+
</pre>
|
|
379
|
+
|
|
380
|
+
<h4 id="label-Insert+Cell">Insert Cell<span><a href="#label-Insert+Cell">¶</a> <a href="#top">↑</a></span></h4>
|
|
381
|
+
|
|
382
|
+
<p>This method will insert a cell at specified position. It takes a :right or
|
|
383
|
+
:down option, to shift cells either left or down upon inserting (nil means
|
|
384
|
+
replacing the cell)</p>
|
|
385
|
+
|
|
386
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
387
|
+
have been moved, as the formulas do not adapt to the shifted cells</p>
|
|
388
|
+
|
|
389
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">insert_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">"blah"</span>, <span class="ruby-identifier">formula</span> = <span class="ruby-keyword">nil</span>, :<span class="ruby-identifier">right</span>) <span class="ruby-comment"># Inserts cell at A1, shifts cells in first row right</span>
|
|
390
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">insert_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">"blah"</span>, <span class="ruby-identifier">formula</span> = <span class="ruby-keyword">nil</span>, :<span class="ruby-identifier">down</span>) <span class="ruby-comment"># Inserts cell at A1, shifts cells in first column down</span>
|
|
391
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">insert_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">"blah"</span>) <span class="ruby-comment"># Inserts cell at A1, shifts nothing</span>
|
|
392
|
+
</pre>
|
|
393
|
+
|
|
394
|
+
<h4 id="label-Delete+Cell">Delete Cell<span><a href="#label-Delete+Cell">¶</a> <a href="#top">↑</a></span></h4>
|
|
395
|
+
|
|
396
|
+
<p>This method will delete a cell at specified position. It takes a :left or
|
|
397
|
+
:up option, to shift cells either up or left upon deletion (nil means
|
|
398
|
+
simply deleting the cell contents)</p>
|
|
399
|
+
|
|
400
|
+
<p>WARNING: Use of this method WILL break formulas referencing cells which
|
|
401
|
+
have been moved, as the formulas do not adapt to the shifted cells</p>
|
|
402
|
+
|
|
403
|
+
<pre class="ruby"><span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">delete_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, :<span class="ruby-identifier">left</span>) <span class="ruby-comment"># Deletes A1, shifts contents of first row left</span>
|
|
404
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">delete_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, :<span class="ruby-identifier">up</span>) <span class="ruby-comment"># Deletes A1, shifts contents of first column up</span>
|
|
405
|
+
<span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">delete_cell</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>) <span class="ruby-comment"># Deletes A1, does not shift cells</span>
|
|
406
|
+
</pre>
|
|
407
|
+
|
|
408
|
+
<h4 id="label-Modifying+Cell+Format">Modifying Cell Format<span><a href="#label-Modifying+Cell+Format">¶</a> <a href="#top">↑</a></span></h4>
|
|
409
|
+
|
|
410
|
+
<pre class="ruby"><span class="ruby-identifier">cell</span> = <span class="ruby-identifier">worksheet</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
|
|
411
|
+
<span class="ruby-identifier">cell</span>.<span class="ruby-identifier">set_number_format</span> <span class="ruby-string">'0.0000%'</span> <span class="ruby-comment"># For formats, see https://support.office.com/en-us/article/5026bbd6-04bc-48cd-bf33-80f18b4eae68</span>
|
|
412
|
+
</pre>
|
|
413
|
+
|
|
414
|
+
<h2 id="label-I-2FO">I/O<span><a href="#label-I-2FO">¶</a> <a href="#top">↑</a></span></h2>
|
|
415
|
+
|
|
416
|
+
<p>By default, the gem operates with files on the local filesystem:</p>
|
|
417
|
+
|
|
418
|
+
<pre class="ruby"><span class="ruby-identifier">workbook</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">"path/to/Excel/file.xlsx"</span>)
|
|
419
|
+
<span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">write</span>(<span class="ruby-string">"path/to/desired/Excel/file.xlsx"</span>)
|
|
420
|
+
</pre>
|
|
421
|
+
|
|
422
|
+
<p>It can also operate on <code>StringIO</code> objects, thus eliminating the
|
|
423
|
+
need to save the <code>xlsx</code> file to disk. This capability comes in
|
|
424
|
+
handy for web servers.</p>
|
|
425
|
+
|
|
426
|
+
<pre class="ruby"><span class="ruby-identifier">workbook</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_buffer</span>(<span class="ruby-identifier">buffer</span>)
|
|
427
|
+
<span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">stream</span>
|
|
428
|
+
</pre>
|
|
429
|
+
|
|
430
|
+
<h2 id="label-Miscellaneous">Miscellaneous<span><a href="#label-Miscellaneous">¶</a> <a href="#top">↑</a></span></h2>
|
|
431
|
+
|
|
432
|
+
<pre class="ruby"><span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">ind2ref</span>(<span class="ruby-value">0</span>,<span class="ruby-value">0</span>) <span class="ruby-operator">==</span> <span class="ruby-string">'A1'</span> <span class="ruby-comment"># Converts row and column index to Excel-style cell reference</span>
|
|
433
|
+
<span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">ref2ind</span>(<span class="ruby-string">'A1'</span>) <span class="ruby-operator">==</span> [<span class="ruby-value">0</span>, <span class="ruby-value">0</span>] <span class="ruby-comment"># Converts Excel-style cell reference to row and column index</span>
|
|
434
|
+
</pre>
|
|
435
|
+
|
|
436
|
+
<h2 id="label-For+more+information">For more information<span><a href="#label-For+more+information">¶</a> <a href="#top">↑</a></span></h2>
|
|
437
|
+
|
|
438
|
+
<p>Take a look at the files in spec/lib/ for rspecs on most methods</p>
|
|
439
|
+
|
|
440
|
+
<h2 id="label-Contributing+to+rubyXL">Contributing to rubyXL<span><a href="#label-Contributing+to+rubyXL">¶</a> <a href="#top">↑</a></span></h2>
|
|
441
|
+
<ul><li>
|
|
442
|
+
<p>Check out the latest master to make sure the feature hasn't been
|
|
443
|
+
implemented or the bug hasn't been fixed yet</p>
|
|
444
|
+
</li><li>
|
|
445
|
+
<p>Check out the issue tracker to make sure someone already hasn't
|
|
446
|
+
requested it and/or contributed it</p>
|
|
447
|
+
</li><li>
|
|
448
|
+
<p>Fork the project</p>
|
|
449
|
+
</li><li>
|
|
450
|
+
<p>Start a feature/bugfix branch</p>
|
|
451
|
+
</li><li>
|
|
452
|
+
<p>Commit and push until you are happy with your contribution</p>
|
|
453
|
+
</li><li>
|
|
454
|
+
<p>Make sure to add tests for it. This is important so I don't break it in
|
|
455
|
+
a future version unintentionally.</p>
|
|
456
|
+
</li><li>
|
|
457
|
+
<p>Please try not to mess with the Rakefile, version, or history. If you want
|
|
458
|
+
to have your own version, or is otherwise necessary, that is fine, but
|
|
459
|
+
please isolate to its own commit so I can cherry-pick around it.</p>
|
|
460
|
+
</li></ul>
|
|
461
|
+
|
|
462
|
+
<h2 id="label-Copyright">Copyright<span><a href="#label-Copyright">¶</a> <a href="#top">↑</a></span></h2>
|
|
463
|
+
|
|
464
|
+
<p>Copyright © 2011 Vivek Bhagwat, 2013-2016 Wesha. See LICENSE.txt for
|
|
465
|
+
further details.</p>
|
|
466
|
+
</main>
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
<footer id="validator-badges" role="contentinfo">
|
|
471
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
472
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
|
473
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
474
|
+
</footer>
|
|
475
|
+
|