rubyXL 1.2.10 → 3.4.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +60 -0
- data/.codeclimate.yml +3 -0
- data/.rubocop.yml +124 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +18 -14
- data/LICENSE.txt +1 -1
- data/README.rdoc +170 -100
- data/Rakefile +76 -26
- data/VERSION +1 -1
- data/lib/rubyXL/cell.rb +13 -447
- data/lib/rubyXL/convenience_methods/cell.rb +276 -0
- data/lib/rubyXL/convenience_methods/color.rb +156 -0
- data/lib/rubyXL/convenience_methods/font.rb +63 -0
- data/lib/rubyXL/convenience_methods/workbook.rb +137 -0
- data/lib/rubyXL/convenience_methods/worksheet.rb +734 -0
- data/lib/rubyXL/convenience_methods.rb +5 -0
- data/lib/rubyXL/objects/border.rb +71 -0
- data/lib/rubyXL/objects/calculation_chain.rb +31 -0
- data/lib/rubyXL/objects/cell_style.rb +63 -0
- data/lib/rubyXL/objects/chartsheet.rb +88 -0
- data/lib/rubyXL/objects/color.rb +25 -0
- data/lib/rubyXL/objects/column_range.rb +93 -0
- data/lib/rubyXL/objects/comments.rb +44 -0
- data/lib/rubyXL/objects/connection.rb +175 -0
- data/lib/rubyXL/objects/container_nodes.rb +131 -0
- data/lib/rubyXL/objects/content_types.rb +74 -0
- data/lib/rubyXL/objects/data_validation.rb +37 -0
- data/lib/rubyXL/objects/document_properties.rb +156 -0
- data/lib/rubyXL/objects/extensions.rb +51 -0
- data/lib/rubyXL/objects/external_links.rb +115 -0
- data/lib/rubyXL/objects/fill.rb +52 -0
- data/lib/rubyXL/objects/filters.rb +118 -0
- data/lib/rubyXL/objects/font.rb +43 -0
- data/lib/rubyXL/objects/formula.rb +22 -0
- data/lib/rubyXL/objects/ooxml_object.rb +469 -0
- data/lib/rubyXL/objects/query_table.rb +106 -0
- data/lib/rubyXL/objects/reference.rb +119 -0
- data/lib/rubyXL/objects/relationships.rb +213 -0
- data/lib/rubyXL/objects/root.rb +84 -0
- data/lib/rubyXL/objects/shared_strings.rb +67 -0
- data/lib/rubyXL/objects/sheet_common.rb +49 -0
- data/lib/rubyXL/objects/sheet_data.rb +219 -0
- data/lib/rubyXL/objects/simple_types.rb +249 -0
- data/lib/rubyXL/objects/storage.rb +193 -0
- data/lib/rubyXL/objects/stylesheet.rb +224 -0
- data/lib/rubyXL/objects/text.rb +92 -0
- data/lib/rubyXL/objects/theme.rb +1730 -0
- data/lib/rubyXL/objects/workbook.rb +572 -0
- data/lib/rubyXL/objects/worksheet.rb +762 -0
- data/lib/rubyXL/parser.rb +18 -459
- data/lib/rubyXL/worksheet.rb +73 -1461
- data/lib/rubyXL.rb +9 -7
- data/rdoc/README_rdoc.html +534 -0
- data/rdoc/RubyXL/AExtension.html +187 -0
- data/rdoc/RubyXL/AExtensionStorageArea.html +97 -0
- data/rdoc/RubyXL/ActiveX.html +156 -0
- data/rdoc/RubyXL/ActiveXBinary.html +106 -0
- data/rdoc/RubyXL/AdjustHandleList.html +99 -0
- data/rdoc/RubyXL/Alignment.html +99 -0
- data/rdoc/RubyXL/AlternateContent.html +97 -0
- data/rdoc/RubyXL/AlternateUrls.html +99 -0
- data/rdoc/RubyXL/Authors.html +99 -0
- data/rdoc/RubyXL/AutoFilter.html +99 -0
- data/rdoc/RubyXL/AutoFilterColumn.html +99 -0
- data/rdoc/RubyXL/BinaryImageFile.html +108 -0
- data/rdoc/RubyXL/BodyProperties.html +99 -0
- data/rdoc/RubyXL/BooleanNode.html +97 -0
- data/rdoc/RubyXL/BooleanValue.html +97 -0
- data/rdoc/RubyXL/Border.html +223 -0
- data/rdoc/RubyXL/BorderEdge.html +160 -0
- data/rdoc/RubyXL/Borders.html +138 -0
- data/rdoc/RubyXL/Break.html +99 -0
- data/rdoc/RubyXL/BreakList.html +99 -0
- data/rdoc/RubyXL/CT_AdjPoint2D.html +99 -0
- data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +99 -0
- data/rdoc/RubyXL/CT_AlphaModulateEffect.html +99 -0
- data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +99 -0
- data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +99 -0
- data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +99 -0
- data/rdoc/RubyXL/CT_Backdrop.html +99 -0
- data/rdoc/RubyXL/CT_Bevel.html +99 -0
- data/rdoc/RubyXL/CT_BiLevelEffect.html +99 -0
- data/rdoc/RubyXL/CT_BlendEffect.html +99 -0
- data/rdoc/RubyXL/CT_Blip.html +99 -0
- data/rdoc/RubyXL/CT_BlipFillProperties.html +99 -0
- data/rdoc/RubyXL/CT_BlurEffect.html +99 -0
- data/rdoc/RubyXL/CT_Camera.html +99 -0
- data/rdoc/RubyXL/CT_Color.html +99 -0
- data/rdoc/RubyXL/CT_ColorChangeEffect.html +99 -0
- data/rdoc/RubyXL/CT_ColorMapping.html +99 -0
- data/rdoc/RubyXL/CT_ColorScheme.html +99 -0
- data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +99 -0
- data/rdoc/RubyXL/CT_ConnectionSite.html +99 -0
- data/rdoc/RubyXL/CT_ConnectionSiteList.html +99 -0
- data/rdoc/RubyXL/CT_DashStop.html +99 -0
- data/rdoc/RubyXL/CT_DashStopList.html +99 -0
- data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +99 -0
- data/rdoc/RubyXL/CT_DuotoneEffect.html +99 -0
- data/rdoc/RubyXL/CT_EffectContainer.html +99 -0
- data/rdoc/RubyXL/CT_EffectList.html +99 -0
- data/rdoc/RubyXL/CT_EffectReference.html +99 -0
- data/rdoc/RubyXL/CT_EffectStyleItem.html +99 -0
- data/rdoc/RubyXL/CT_EffectStyleList.html +99 -0
- data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +99 -0
- data/rdoc/RubyXL/CT_FillEffect.html +99 -0
- data/rdoc/RubyXL/CT_FillOverlayEffect.html +99 -0
- data/rdoc/RubyXL/CT_FillStyleList.html +99 -0
- data/rdoc/RubyXL/CT_FlatText.html +99 -0
- data/rdoc/RubyXL/CT_FontCollection.html +99 -0
- data/rdoc/RubyXL/CT_FontReference.html +99 -0
- data/rdoc/RubyXL/CT_GeomGuideList.html +99 -0
- data/rdoc/RubyXL/CT_GlowEffect.html +99 -0
- data/rdoc/RubyXL/CT_GradientFillProperties.html +99 -0
- data/rdoc/RubyXL/CT_GradientStop.html +99 -0
- data/rdoc/RubyXL/CT_GradientStopList.html +99 -0
- data/rdoc/RubyXL/CT_HSLEffect.html +99 -0
- data/rdoc/RubyXL/CT_HslColor.html +99 -0
- data/rdoc/RubyXL/CT_Hyperlink.html +99 -0
- data/rdoc/RubyXL/CT_InnerShadowEffect.html +99 -0
- data/rdoc/RubyXL/CT_LightRig.html +99 -0
- data/rdoc/RubyXL/CT_LineEndProperties.html +99 -0
- data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +99 -0
- data/rdoc/RubyXL/CT_LineProperties.html +99 -0
- data/rdoc/RubyXL/CT_LineStyleList.html +99 -0
- data/rdoc/RubyXL/CT_LinearShadeProperties.html +99 -0
- data/rdoc/RubyXL/CT_LuminanceEffect.html +99 -0
- data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +99 -0
- data/rdoc/RubyXL/CT_OuterShadowEffect.html +99 -0
- data/rdoc/RubyXL/CT_Path2D.html +99 -0
- data/rdoc/RubyXL/CT_Path2DArcTo.html +99 -0
- data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +99 -0
- data/rdoc/RubyXL/CT_Path2DList.html +99 -0
- data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +99 -0
- data/rdoc/RubyXL/CT_Path2DTo.html +99 -0
- data/rdoc/RubyXL/CT_PathShadeProperties.html +99 -0
- data/rdoc/RubyXL/CT_PatternFillProperties.html +99 -0
- data/rdoc/RubyXL/CT_Point3D.html +99 -0
- data/rdoc/RubyXL/CT_PolarAdjustHandle.html +99 -0
- data/rdoc/RubyXL/CT_PresetColor.html +99 -0
- data/rdoc/RubyXL/CT_PresetLineDashProperties.html +99 -0
- data/rdoc/RubyXL/CT_PresetShadowEffect.html +99 -0
- data/rdoc/RubyXL/CT_PresetTextShape.html +99 -0
- data/rdoc/RubyXL/CT_ReflectionEffect.html +99 -0
- data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +99 -0
- data/rdoc/RubyXL/CT_RelativeRect.html +99 -0
- data/rdoc/RubyXL/CT_SRgbColor.html +99 -0
- data/rdoc/RubyXL/CT_ScRgbColor.html +99 -0
- data/rdoc/RubyXL/CT_Scene3D.html +99 -0
- data/rdoc/RubyXL/CT_SchemeColor.html +99 -0
- data/rdoc/RubyXL/CT_Shape3D.html +99 -0
- data/rdoc/RubyXL/CT_ShapeStyle.html +99 -0
- data/rdoc/RubyXL/CT_SoftEdgesEffect.html +99 -0
- data/rdoc/RubyXL/CT_SphereCoords.html +99 -0
- data/rdoc/RubyXL/CT_StretchInfoProperties.html +99 -0
- data/rdoc/RubyXL/CT_StyleMatrix.html +99 -0
- data/rdoc/RubyXL/CT_StyleMatrixReference.html +99 -0
- data/rdoc/RubyXL/CT_SupplementalFont.html +99 -0
- data/rdoc/RubyXL/CT_SystemColor.html +99 -0
- data/rdoc/RubyXL/CT_TextAutonumberBullet.html +99 -0
- data/rdoc/RubyXL/CT_TextBlipBullet.html +99 -0
- data/rdoc/RubyXL/CT_TextCharBullet.html +99 -0
- data/rdoc/RubyXL/CT_TextCharacterProperties.html +99 -0
- data/rdoc/RubyXL/CT_TextFont.html +99 -0
- data/rdoc/RubyXL/CT_TextListStyle.html +99 -0
- data/rdoc/RubyXL/CT_TextNormalAutofit.html +99 -0
- data/rdoc/RubyXL/CT_TextParagraphProperties.html +99 -0
- data/rdoc/RubyXL/CT_TextSpacing.html +99 -0
- data/rdoc/RubyXL/CT_TextTabStop.html +99 -0
- data/rdoc/RubyXL/CT_TextTabStopList.html +99 -0
- data/rdoc/RubyXL/CT_TileInfoProperties.html +99 -0
- data/rdoc/RubyXL/CT_TintEffect.html +99 -0
- data/rdoc/RubyXL/CT_Transform2D.html +99 -0
- data/rdoc/RubyXL/CT_TransformEffect.html +99 -0
- data/rdoc/RubyXL/CT_Vector3D.html +99 -0
- data/rdoc/RubyXL/CT_XYAdjustHandle.html +99 -0
- data/rdoc/RubyXL/CalculationChain.html +149 -0
- data/rdoc/RubyXL/CalculationChainCell.html +99 -0
- data/rdoc/RubyXL/CalculationProperties.html +99 -0
- data/rdoc/RubyXL/Cell.html +510 -0
- data/rdoc/RubyXL/CellConvenienceMethods.html +1077 -0
- data/rdoc/RubyXL/CellExt.html +99 -0
- data/rdoc/RubyXL/CellSmartTag.html +99 -0
- data/rdoc/RubyXL/CellSmartTagProperty.html +99 -0
- data/rdoc/RubyXL/CellSmartTags.html +99 -0
- data/rdoc/RubyXL/CellStyle.html +99 -0
- data/rdoc/RubyXL/CellStyleXFs.html +138 -0
- data/rdoc/RubyXL/CellStyles.html +138 -0
- data/rdoc/RubyXL/CellValue.html +139 -0
- data/rdoc/RubyXL/CellWatch.html +99 -0
- data/rdoc/RubyXL/CellWatches.html +99 -0
- data/rdoc/RubyXL/CellXFs.html +139 -0
- data/rdoc/RubyXL/ChartColorsFile.html +108 -0
- data/rdoc/RubyXL/ChartFile.html +160 -0
- data/rdoc/RubyXL/ChartStyleFile.html +108 -0
- data/rdoc/RubyXL/ChartUserShapesFile.html +108 -0
- data/rdoc/RubyXL/Chartsheet.html +213 -0
- data/rdoc/RubyXL/ChartsheetPageSetup.html +99 -0
- data/rdoc/RubyXL/ChartsheetProperties.html +99 -0
- data/rdoc/RubyXL/ChartsheetProtection.html +99 -0
- data/rdoc/RubyXL/ChartsheetView.html +99 -0
- data/rdoc/RubyXL/ChartsheetViews.html +99 -0
- data/rdoc/RubyXL/Color.html +151 -0
- data/rdoc/RubyXL/ColorConvenienceClasses/HlsColor.html +246 -0
- data/rdoc/RubyXL/ColorConvenienceClasses/RgbColor.html +285 -0
- data/rdoc/RubyXL/ColorConvenienceClasses.html +91 -0
- data/rdoc/RubyXL/ColorConvenienceMethods.html +139 -0
- data/rdoc/RubyXL/ColorFilter.html +99 -0
- data/rdoc/RubyXL/ColorScale.html +99 -0
- data/rdoc/RubyXL/ColorSet.html +99 -0
- data/rdoc/RubyXL/Colors.html +99 -0
- data/rdoc/RubyXL/ColumnRange.html +230 -0
- data/rdoc/RubyXL/ColumnRanges.html +237 -0
- data/rdoc/RubyXL/Comment.html +99 -0
- data/rdoc/RubyXL/CommentList.html +99 -0
- data/rdoc/RubyXL/CommentsFile.html +165 -0
- data/rdoc/RubyXL/ConditionalFormatValue.html +99 -0
- data/rdoc/RubyXL/ConditionalFormatting.html +99 -0
- data/rdoc/RubyXL/ConditionalFormattingRule.html +99 -0
- data/rdoc/RubyXL/Connection.html +99 -0
- data/rdoc/RubyXL/ConnectionTable.html +99 -0
- data/rdoc/RubyXL/ConnectionTables.html +99 -0
- data/rdoc/RubyXL/ConnectionTextField.html +99 -0
- data/rdoc/RubyXL/ConnectionTextFields.html +99 -0
- data/rdoc/RubyXL/Connections.html +149 -0
- data/rdoc/RubyXL/ContentTypeDefault.html +97 -0
- data/rdoc/RubyXL/ContentTypeOverride.html +97 -0
- data/rdoc/RubyXL/ContentTypes.html +211 -0
- data/rdoc/RubyXL/ControlPropertiesFile.html +108 -0
- data/rdoc/RubyXL/CorePropertiesFile.html +355 -0
- data/rdoc/RubyXL/CustomColor.html +99 -0
- data/rdoc/RubyXL/CustomColorList.html +99 -0
- data/rdoc/RubyXL/CustomFilter.html +99 -0
- data/rdoc/RubyXL/CustomFilters.html +99 -0
- data/rdoc/RubyXL/CustomGeometry.html +99 -0
- data/rdoc/RubyXL/CustomProperties.html +99 -0
- data/rdoc/RubyXL/CustomPropertiesFile.html +108 -0
- data/rdoc/RubyXL/CustomProperty.html +99 -0
- data/rdoc/RubyXL/CustomPropertyFile.html +108 -0
- data/rdoc/RubyXL/CustomSheetView.html +99 -0
- data/rdoc/RubyXL/CustomSheetViews.html +99 -0
- data/rdoc/RubyXL/CustomWorkbookView.html +99 -0
- data/rdoc/RubyXL/CustomWorkbookViews.html +99 -0
- data/rdoc/RubyXL/CustomXMLFile.html +106 -0
- data/rdoc/RubyXL/DXF.html +99 -0
- data/rdoc/RubyXL/DXFs.html +99 -0
- data/rdoc/RubyXL/DataBar.html +99 -0
- data/rdoc/RubyXL/DataConsolidate.html +99 -0
- data/rdoc/RubyXL/DataConsolidationReference.html +99 -0
- data/rdoc/RubyXL/DataConsolidationReferences.html +99 -0
- data/rdoc/RubyXL/DataType.html +114 -0
- data/rdoc/RubyXL/DataValidation.html +99 -0
- data/rdoc/RubyXL/DataValidations.html +99 -0
- data/rdoc/RubyXL/DateGroupItem.html +99 -0
- data/rdoc/RubyXL/DefinedName.html +99 -0
- data/rdoc/RubyXL/DefinedNameExt.html +99 -0
- data/rdoc/RubyXL/DefinedNames.html +99 -0
- data/rdoc/RubyXL/DefinedNamesExt.html +99 -0
- data/rdoc/RubyXL/DocumentPropertiesFile.html +213 -0
- data/rdoc/RubyXL/DrawingFile.html +159 -0
- data/rdoc/RubyXL/DynamicFilter.html +99 -0
- data/rdoc/RubyXL/EmbeddedControl.html +99 -0
- data/rdoc/RubyXL/EmbeddedControls.html +99 -0
- data/rdoc/RubyXL/Extension.html +99 -0
- data/rdoc/RubyXL/ExtensionStorageArea.html +99 -0
- data/rdoc/RubyXL/Extents.html +99 -0
- data/rdoc/RubyXL/ExternalBook.html +99 -0
- data/rdoc/RubyXL/ExternalLinksFile.html +155 -0
- data/rdoc/RubyXL/ExternalReference.html +99 -0
- data/rdoc/RubyXL/ExternalReferences.html +99 -0
- data/rdoc/RubyXL/ExtraColorSchemeList.html +99 -0
- data/rdoc/RubyXL/FieldItem.html +99 -0
- data/rdoc/RubyXL/FileRecoveryProperties.html +99 -0
- data/rdoc/RubyXL/FileSharing.html +99 -0
- data/rdoc/RubyXL/FileVersion.html +99 -0
- data/rdoc/RubyXL/Fill.html +138 -0
- data/rdoc/RubyXL/Fills.html +138 -0
- data/rdoc/RubyXL/FilterContainer.html +99 -0
- data/rdoc/RubyXL/FloatNode.html +97 -0
- data/rdoc/RubyXL/FloatValue.html +97 -0
- data/rdoc/RubyXL/Font.html +148 -0
- data/rdoc/RubyXL/FontConvenienceMethods.html +442 -0
- data/rdoc/RubyXL/FontScheme.html +99 -0
- data/rdoc/RubyXL/Fonts.html +138 -0
- data/rdoc/RubyXL/Formula.html +99 -0
- data/rdoc/RubyXL/FunctionGroup.html +99 -0
- data/rdoc/RubyXL/FunctionGroups.html +99 -0
- data/rdoc/RubyXL/GenericStorageObject.html +241 -0
- data/rdoc/RubyXL/GradientFill.html +99 -0
- data/rdoc/RubyXL/HeaderFooterSettings.html +99 -0
- data/rdoc/RubyXL/Hyperlink.html +99 -0
- data/rdoc/RubyXL/HyperlinkRelFile.html +106 -0
- data/rdoc/RubyXL/Hyperlinks.html +99 -0
- data/rdoc/RubyXL/IconFilter.html +99 -0
- data/rdoc/RubyXL/IconSet.html +99 -0
- data/rdoc/RubyXL/IgnoredError.html +99 -0
- data/rdoc/RubyXL/IgnoredErrors.html +99 -0
- data/rdoc/RubyXL/IndexedColors.html +99 -0
- data/rdoc/RubyXL/InputCells.html +99 -0
- data/rdoc/RubyXL/IntegerNode.html +97 -0
- data/rdoc/RubyXL/IntegerValue.html +97 -0
- data/rdoc/RubyXL/LegacyCell.html +130 -0
- data/rdoc/RubyXL/LegacyWorksheet.html +306 -0
- data/rdoc/RubyXL/MRUColors.html +99 -0
- data/rdoc/RubyXL/MacrosFile.html +108 -0
- data/rdoc/RubyXL/MergedCell.html +99 -0
- data/rdoc/RubyXL/MergedCells.html +99 -0
- data/rdoc/RubyXL/NumFmt.html +99 -0
- data/rdoc/RubyXL/NumberFormat.html +139 -0
- data/rdoc/RubyXL/NumberFormats.html +147 -0
- data/rdoc/RubyXL/OLEObject.html +99 -0
- data/rdoc/RubyXL/OLEObjectFile.html +108 -0
- data/rdoc/RubyXL/OLEObjects.html +99 -0
- data/rdoc/RubyXL/OLESize.html +99 -0
- data/rdoc/RubyXL/OOXMLContainerObject.html +309 -0
- data/rdoc/RubyXL/OOXMLIgnored.html +167 -0
- data/rdoc/RubyXL/OOXMLObject.html +107 -0
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +455 -0
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +442 -0
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +470 -0
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +297 -0
- data/rdoc/RubyXL/OdbcOleDbProperties.html +99 -0
- data/rdoc/RubyXL/Offset.html +99 -0
- data/rdoc/RubyXL/OlapProperties.html +99 -0
- data/rdoc/RubyXL/OleItem.html +99 -0
- data/rdoc/RubyXL/OleItems.html +99 -0
- data/rdoc/RubyXL/OleLink.html +99 -0
- data/rdoc/RubyXL/OutlineProperties.html +99 -0
- data/rdoc/RubyXL/PageMargins.html +99 -0
- data/rdoc/RubyXL/PageSetup.html +99 -0
- data/rdoc/RubyXL/PageSetupProperties.html +99 -0
- data/rdoc/RubyXL/Pane.html +99 -0
- data/rdoc/RubyXL/Parser.html +174 -0
- data/rdoc/RubyXL/PatternFill.html +99 -0
- data/rdoc/RubyXL/PersonMetadata.html +108 -0
- data/rdoc/RubyXL/PhoneticProperties.html +99 -0
- data/rdoc/RubyXL/PhoneticRun.html +99 -0
- data/rdoc/RubyXL/PivotArea.html +99 -0
- data/rdoc/RubyXL/PivotCache.html +99 -0
- data/rdoc/RubyXL/PivotCacheDefinitionFile.html +116 -0
- data/rdoc/RubyXL/PivotCacheRecordsFile.html +108 -0
- data/rdoc/RubyXL/PivotCaches.html +99 -0
- data/rdoc/RubyXL/PivotReference.html +99 -0
- data/rdoc/RubyXL/PivotReferences.html +99 -0
- data/rdoc/RubyXL/PivotTableFile.html +116 -0
- data/rdoc/RubyXL/PivotTableSelection.html +99 -0
- data/rdoc/RubyXL/PresetGeometry.html +99 -0
- data/rdoc/RubyXL/PrintOptions.html +99 -0
- data/rdoc/RubyXL/PrinterSettingsFile.html +108 -0
- data/rdoc/RubyXL/ProtectedRange.html +99 -0
- data/rdoc/RubyXL/ProtectedRanges.html +99 -0
- data/rdoc/RubyXL/Protection.html +99 -0
- data/rdoc/RubyXL/QueryParameter.html +99 -0
- data/rdoc/RubyXL/QueryParameters.html +99 -0
- data/rdoc/RubyXL/QueryTable.html +157 -0
- data/rdoc/RubyXL/QueryTableDeletedField.html +99 -0
- data/rdoc/RubyXL/QueryTableDeletedFields.html +99 -0
- data/rdoc/RubyXL/QueryTableField.html +99 -0
- data/rdoc/RubyXL/QueryTableFields.html +99 -0
- data/rdoc/RubyXL/QueryTableRefresh.html +99 -0
- data/rdoc/RubyXL/RID.html +97 -0
- data/rdoc/RubyXL/RawOOXML.html +187 -0
- data/rdoc/RubyXL/Reference.html +510 -0
- data/rdoc/RubyXL/Relationship.html +97 -0
- data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +131 -0
- data/rdoc/RubyXL/RelationshipSupport.html +336 -0
- data/rdoc/RubyXL/RevisionPointer.html +99 -0
- data/rdoc/RubyXL/RichText.html +141 -0
- data/rdoc/RubyXL/RichTextRun.html +138 -0
- data/rdoc/RubyXL/Row.html +357 -0
- data/rdoc/RubyXL/RowExt.html +99 -0
- data/rdoc/RubyXL/RunProperties.html +99 -0
- data/rdoc/RubyXL/Scenario.html +99 -0
- data/rdoc/RubyXL/Scenarios.html +99 -0
- data/rdoc/RubyXL/Selection.html +146 -0
- data/rdoc/RubyXL/ShapeGuide.html +99 -0
- data/rdoc/RubyXL/ShapeTextRectangle.html +99 -0
- data/rdoc/RubyXL/SharedStringsTable.html +328 -0
- data/rdoc/RubyXL/Sheet.html +99 -0
- data/rdoc/RubyXL/SheetCalculationProperties.html +99 -0
- data/rdoc/RubyXL/SheetData.html +162 -0
- data/rdoc/RubyXL/SheetDataExt.html +99 -0
- data/rdoc/RubyXL/SheetDataSet.html +99 -0
- data/rdoc/RubyXL/SheetMetadata.html +108 -0
- data/rdoc/RubyXL/SheetName.html +99 -0
- data/rdoc/RubyXL/SheetNames.html +99 -0
- data/rdoc/RubyXL/Sheets.html +99 -0
- data/rdoc/RubyXL/SlicerCacheFile.html +108 -0
- data/rdoc/RubyXL/SlicerFile.html +108 -0
- data/rdoc/RubyXL/SmartTagProperties.html +99 -0
- data/rdoc/RubyXL/SmartTagType.html +99 -0
- data/rdoc/RubyXL/SmartTagTypes.html +99 -0
- data/rdoc/RubyXL/SmartTags.html +99 -0
- data/rdoc/RubyXL/SortCondition.html +99 -0
- data/rdoc/RubyXL/SortState.html +99 -0
- data/rdoc/RubyXL/Sqref.html +167 -0
- data/rdoc/RubyXL/Stop.html +99 -0
- data/rdoc/RubyXL/StringNode.html +97 -0
- data/rdoc/RubyXL/StringNodeW3C.html +167 -0
- data/rdoc/RubyXL/StringValue.html +97 -0
- data/rdoc/RubyXL/Stylesheet.html +281 -0
- data/rdoc/RubyXL/TableFile.html +108 -0
- data/rdoc/RubyXL/TableParts.html +97 -0
- data/rdoc/RubyXL/TableStyle.html +99 -0
- data/rdoc/RubyXL/TableStyles.html +99 -0
- data/rdoc/RubyXL/Text.html +175 -0
- data/rdoc/RubyXL/TextImportSettings.html +99 -0
- data/rdoc/RubyXL/Theme.html +535 -0
- data/rdoc/RubyXL/ThemeElements.html +99 -0
- data/rdoc/RubyXL/ThumbnailFile.html +108 -0
- data/rdoc/RubyXL/Top10.html +99 -0
- data/rdoc/RubyXL/VMLDrawingFile.html +116 -0
- data/rdoc/RubyXL/Variant.html +99 -0
- data/rdoc/RubyXL/Vector.html +142 -0
- data/rdoc/RubyXL/VectorValue.html +97 -0
- data/rdoc/RubyXL/VisualProperties.html +99 -0
- data/rdoc/RubyXL/WebPublishObject.html +99 -0
- data/rdoc/RubyXL/WebPublishObjects.html +99 -0
- data/rdoc/RubyXL/WebPublishingItem.html +99 -0
- data/rdoc/RubyXL/WebPublishingItems.html +99 -0
- data/rdoc/RubyXL/WebPublishingProperties.html +99 -0
- data/rdoc/RubyXL/WebQueryProperties.html +99 -0
- data/rdoc/RubyXL/Workbook.html +948 -0
- data/rdoc/RubyXL/WorkbookConvenienceMethods.html +596 -0
- data/rdoc/RubyXL/WorkbookProperties.html +99 -0
- data/rdoc/RubyXL/WorkbookProtection.html +99 -0
- data/rdoc/RubyXL/WorkbookRoot.html +325 -0
- data/rdoc/RubyXL/WorkbookView.html +99 -0
- data/rdoc/RubyXL/WorkbookViews.html +99 -0
- data/rdoc/RubyXL/Worksheet.html +418 -0
- data/rdoc/RubyXL/WorksheetConvenienceMethods.html +2205 -0
- data/rdoc/RubyXL/WorksheetDimensions.html +99 -0
- data/rdoc/RubyXL/WorksheetFormatProperties.html +97 -0
- data/rdoc/RubyXL/WorksheetProperties.html +99 -0
- data/rdoc/RubyXL/WorksheetProtection.html +99 -0
- data/rdoc/RubyXL/WorksheetView.html +99 -0
- data/rdoc/RubyXL/WorksheetViews.html +99 -0
- data/rdoc/RubyXL/XF.html +99 -0
- data/rdoc/RubyXL.html +338 -0
- data/rdoc/created.rid +45 -0
- data/rdoc/css/fonts.css +167 -0
- data/rdoc/css/rdoc.css +687 -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 +477 -0
- data/rdoc/js/darkfish.js +97 -0
- data/rdoc/js/navigation.js +105 -0
- data/rdoc/js/navigation.js.gz +0 -0
- data/rdoc/js/search.js +110 -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 +3021 -0
- data/rubyXL.gemspec +521 -60
- data/spec/lib/cell_spec.rb +386 -143
- data/spec/lib/color_spec.rb +11 -4
- data/spec/lib/parser_spec.rb +90 -38
- data/spec/lib/reference_spec.rb +64 -0
- data/spec/lib/rgb_color_spec.rb +29 -0
- data/spec/lib/stylesheet_spec.rb +27 -0
- data/spec/lib/text_spec.rb +27 -0
- data/spec/lib/workbook_spec.rb +168 -22
- data/spec/lib/worksheet_spec.rb +1207 -1220
- data/spec/spec_helper.rb +13 -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 +634 -168
- data/Gemfile.lock +0 -34
- data/lib/.DS_Store +0 -0
- data/lib/rubyXL/Hash.rb +0 -60
- data/lib/rubyXL/color.rb +0 -14
- data/lib/rubyXL/private_class.rb +0 -265
- data/lib/rubyXL/workbook.rb +0 -450
- data/lib/rubyXL/writer/app_writer.rb +0 -62
- data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
- data/lib/rubyXL/writer/content_types_writer.rb +0 -77
- data/lib/rubyXL/writer/core_writer.rb +0 -51
- data/lib/rubyXL/writer/root_rels_writer.rb +0 -25
- data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
- data/lib/rubyXL/writer/styles_writer.rb +0 -407
- data/lib/rubyXL/writer/theme_writer.rb +0 -343
- data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
- data/lib/rubyXL/writer/workbook_writer.rb +0 -77
- data/lib/rubyXL/writer/worksheet_writer.rb +0 -230
- data/lib/rubyXL/zip.rb +0 -20
- data/spec/lib/hash_spec.rb +0 -28
data/lib/rubyXL/workbook.rb
DELETED
@@ -1,450 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','content_types_writer'))
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','root_rels_writer'))
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','app_writer'))
|
4
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','core_writer'))
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','theme_writer'))
|
6
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','workbook_rels_writer'))
|
7
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','workbook_writer'))
|
8
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','styles_writer'))
|
9
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','shared_strings_writer'))
|
10
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'writer','worksheet_writer'))
|
11
|
-
require 'rubyXL/zip'
|
12
|
-
require 'date'
|
13
|
-
|
14
|
-
module RubyXL
|
15
|
-
class Workbook
|
16
|
-
include Enumerable
|
17
|
-
attr_accessor :worksheets, :filepath, :creator, :modifier, :created_at,
|
18
|
-
:modified_at, :company, :application, :appversion, :num_fmts, :num_fmts_hash, :fonts, :fills,
|
19
|
-
:borders, :cell_xfs, :cell_style_xfs, :cell_styles, :shared_strings, :calc_chain,
|
20
|
-
:num_strings, :size, :date1904, :external_links, :style_corrector, :drawings,
|
21
|
-
:worksheet_rels, :printer_settings, :macros, :colors, :shared_strings_XML, :defined_names, :column_lookup_hash
|
22
|
-
|
23
|
-
|
24
|
-
APPLICATION = 'Microsoft Macintosh Excel'
|
25
|
-
APPVERSION = '12.0000'
|
26
|
-
SHEET_NAME = 'Sheet1'
|
27
|
-
def initialize(worksheets=[], filepath=nil, creator=nil, modifier=nil, created_at=nil,
|
28
|
-
company='', application=APPLICATION,
|
29
|
-
appversion=APPVERSION, date1904=0)
|
30
|
-
if worksheets.nil? || worksheets.empty?
|
31
|
-
@worksheets = [Worksheet.new(self,SHEET_NAME)]
|
32
|
-
else
|
33
|
-
@worksheets = worksheets
|
34
|
-
end
|
35
|
-
@filepath = filepath
|
36
|
-
@creator = creator
|
37
|
-
@modifier = modifier
|
38
|
-
@company = company
|
39
|
-
@application = application
|
40
|
-
@appversion = appversion
|
41
|
-
@num_fmts = nil
|
42
|
-
@num_fmts_hash = nil
|
43
|
-
@fonts = nil
|
44
|
-
@fills = nil
|
45
|
-
@borders = nil
|
46
|
-
@cell_xfs = nil
|
47
|
-
@cell_style_xfs = nil
|
48
|
-
@cell_styles = nil
|
49
|
-
@shared_strings = nil
|
50
|
-
@calc_chain = nil #unnecessary?
|
51
|
-
@num_strings = 0 #num strings total
|
52
|
-
@size = 0 #num strings in shared_strings array
|
53
|
-
@date1904 = date1904 > 0
|
54
|
-
@external_links = nil
|
55
|
-
@style_corrector = nil
|
56
|
-
@drawings = nil
|
57
|
-
@worksheet_rels = nil
|
58
|
-
@printer_settings = nil
|
59
|
-
@macros = nil
|
60
|
-
@colors = nil
|
61
|
-
@shared_strings_XML = nil
|
62
|
-
@defined_names = nil
|
63
|
-
@column_lookup_hash = {}
|
64
|
-
|
65
|
-
begin
|
66
|
-
@created_at = DateTime.parse(created_at).strftime('%Y-%m-%dT%TZ')
|
67
|
-
rescue
|
68
|
-
t = Time.now
|
69
|
-
@created_at = t.strftime('%Y-%m-%dT%TZ')
|
70
|
-
end
|
71
|
-
@modified_at = @created_at
|
72
|
-
|
73
|
-
fill_styles()
|
74
|
-
fill_shared_strings()
|
75
|
-
end
|
76
|
-
|
77
|
-
# allows easier access to worksheets
|
78
|
-
def [](worksheet)
|
79
|
-
return worksheets[worksheet]
|
80
|
-
end
|
81
|
-
|
82
|
-
def each
|
83
|
-
worksheets.each{|i| yield i}
|
84
|
-
end
|
85
|
-
|
86
|
-
def num_fmts_by_id
|
87
|
-
|
88
|
-
return @num_fmts_hash unless @num_fmts_hash.nil?
|
89
|
-
if num_fmts
|
90
|
-
@num_fmts_hash={}
|
91
|
-
num_fmts[:numFmt].each do |num_fmt|
|
92
|
-
@num_fmts_hash[num_fmt[:attributes][:numFmtId]]=num_fmt
|
93
|
-
end
|
94
|
-
@num_fmts_hash
|
95
|
-
else
|
96
|
-
{}
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
#filepath of xlsx file (including file itself)
|
101
|
-
def write(filepath=@filepath)
|
102
|
-
validate_before_write
|
103
|
-
if !(filepath =~ /(.+)\.xls(x|m)/)
|
104
|
-
raise "Only xlsx and xlsm files are supported. Unsupported type for file: #{filepath}"
|
105
|
-
end
|
106
|
-
dirpath = ''
|
107
|
-
extension = 'xls'
|
108
|
-
if(filepath =~ /((.|\s)*)\.xls(x|m)$/)
|
109
|
-
dirpath = $1.to_s()
|
110
|
-
extension += $3.to_s
|
111
|
-
end
|
112
|
-
filename = ''
|
113
|
-
if(filepath =~ /\/((.|\s)*)\/((.|\s)*)\.xls(x|m)$/)
|
114
|
-
filename = $3.to_s()
|
115
|
-
end
|
116
|
-
|
117
|
-
#creates zip file, writes each type of file to zip folder
|
118
|
-
#zips package and renames it to xlsx.
|
119
|
-
zippath = File.join(dirpath, filename + '.zip')
|
120
|
-
File.unlink(zippath) if File.exists?(zippath)
|
121
|
-
FileUtils.mkdir_p(File.join(dirpath,zippath))
|
122
|
-
Zip::ZipFile.open(zippath, Zip::ZipFile::CREATE) do |zipfile|
|
123
|
-
writer = Writer::ContentTypesWriter.new(dirpath,self)
|
124
|
-
zipfile.get_output_stream('[Content_Types].xml') {|f| f.puts(writer.write())}
|
125
|
-
|
126
|
-
writer = Writer::RootRelsWriter.new(dirpath,self)
|
127
|
-
zipfile.get_output_stream(File.join('_rels','.rels')) {|f| f.puts(writer.write())}
|
128
|
-
|
129
|
-
writer = Writer::AppWriter.new(dirpath,self)
|
130
|
-
zipfile.get_output_stream(File.join('docProps','app.xml')) {|f| f.puts(writer.write())}
|
131
|
-
|
132
|
-
writer = Writer::CoreWriter.new(dirpath,self)
|
133
|
-
zipfile.get_output_stream(File.join('docProps','core.xml')) {|f| f.puts(writer.write())}
|
134
|
-
|
135
|
-
writer = Writer::ThemeWriter.new(dirpath,self)
|
136
|
-
zipfile.get_output_stream(File.join('xl','theme','theme1.xml')) {|f| f.puts(writer.write())}
|
137
|
-
|
138
|
-
writer = Writer::WorkbookRelsWriter.new(dirpath,self)
|
139
|
-
zipfile.get_output_stream(File.join('xl','_rels','workbook.xml.rels')) {|f| f.puts(writer.write())}
|
140
|
-
|
141
|
-
writer = Writer::WorkbookWriter.new(dirpath,self)
|
142
|
-
zipfile.get_output_stream(File.join('xl','workbook.xml')) {|f| f.puts(writer.write())}
|
143
|
-
|
144
|
-
writer = Writer::StylesWriter.new(dirpath,self)
|
145
|
-
zipfile.get_output_stream(File.join('xl','styles.xml')) {|f| f.puts(writer.write())}
|
146
|
-
|
147
|
-
unless @shared_strings.nil?
|
148
|
-
writer = Writer::SharedStringsWriter.new(dirpath,self)
|
149
|
-
zipfile.get_output_stream(File.join('xl','sharedStrings.xml')) {|f| f.puts(writer.write())}
|
150
|
-
end
|
151
|
-
|
152
|
-
#preserves external links (exactly, no modification allowed)
|
153
|
-
unless @external_links.nil?
|
154
|
-
#-1 because of rels
|
155
|
-
1.upto(@external_links.size-1) do |i|
|
156
|
-
zipfile.get_output_stream(
|
157
|
-
File.join('xl','externalLinks',"externalLink#{i}.xml")) {|f|
|
158
|
-
f.puts(@external_links[i])
|
159
|
-
}
|
160
|
-
end
|
161
|
-
@external_links['rels'].each_index do |i|
|
162
|
-
unless @external_links['rels'][i].nil?
|
163
|
-
zipfile.get_output_stream(
|
164
|
-
File.join('xl','externalLinks','_rels',"externalLink#{i}.xml.rels")) {|f|
|
165
|
-
f.puts(@external_links['rels'][i])
|
166
|
-
}
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
#preserves drawings (exactly, no modification allowed)
|
172
|
-
unless @drawings.nil?
|
173
|
-
1.upto(@drawings.size) do |i|
|
174
|
-
zipfile.get_output_stream(
|
175
|
-
File.join('xl','drawings',"vmlDrawing#{i}.vml")) {|f|
|
176
|
-
f.puts(@drawings[i])
|
177
|
-
}
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
unless @printer_settings.nil?
|
182
|
-
1.upto(@printer_settings.size) do |i|
|
183
|
-
zipfile.get_output_stream(
|
184
|
-
File.join('xl','printerSettings',"printerSettings#{i}.bin")) {|f|
|
185
|
-
f.puts(@printer_settings[i])
|
186
|
-
}
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
unless @worksheet_rels.nil?
|
191
|
-
1.upto(@worksheet_rels.size) do |i|
|
192
|
-
zipfile.get_output_stream(
|
193
|
-
File.join('xl','worksheets','_rels',"sheet#{i}.xml.rels")) {|f|
|
194
|
-
f.puts(@worksheet_rels[i])
|
195
|
-
}
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
unless @macros.nil?
|
200
|
-
zipfile.get_output_stream(File.join('xl','vbaProject.bin')) {|f| f.puts(@macros)}
|
201
|
-
end
|
202
|
-
|
203
|
-
@worksheets.each_with_index do |sheet,i|
|
204
|
-
writer = Writer::WorksheetWriter.new(dirpath,self,i)
|
205
|
-
zipfile.get_output_stream(File.join('xl','worksheets',"sheet#{i+1}.xml")) {|f| f.puts(writer.write())}
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
FileUtils.cp(zippath,File.join(dirpath,filename+".#{extension}"))
|
210
|
-
FileUtils.cp(File.join(dirpath,filename+".#{extension}"),filepath)
|
211
|
-
if File.exist?(filepath)
|
212
|
-
FileUtils.rm_rf(dirpath)
|
213
|
-
end
|
214
|
-
return filepath
|
215
|
-
end
|
216
|
-
|
217
|
-
def date_to_num(date)
|
218
|
-
return nil if date.nil?
|
219
|
-
if @date1904
|
220
|
-
compare_date = DateTime.parse('December 31, 1903')
|
221
|
-
else
|
222
|
-
compare_date = DateTime.parse('December 31, 1899')
|
223
|
-
end
|
224
|
-
# add one day to compare date for erroneous 1900 leap year compatibility
|
225
|
-
date.ajd + 1 - compare_date.ajd
|
226
|
-
end
|
227
|
-
|
228
|
-
def num_to_date(num)
|
229
|
-
return nil if num.nil?
|
230
|
-
if @date1904
|
231
|
-
compare_date = DateTime.parse('December 31, 1903')
|
232
|
-
else
|
233
|
-
compare_date = DateTime.parse('December 31, 1899')
|
234
|
-
end
|
235
|
-
# subtract one day to compare date for erroneous 1900 leap year compatibility
|
236
|
-
compare_date - 1 + num
|
237
|
-
end
|
238
|
-
|
239
|
-
def date_num_fmt?(num_fmt)
|
240
|
-
@num_fmt_date_hash ||= {}
|
241
|
-
if @num_fmt_date_hash[num_fmt].nil?
|
242
|
-
@num_fmt_date_hash[num_fmt] = is_date_format?(num_fmt)
|
243
|
-
end
|
244
|
-
return @num_fmt_date_hash[num_fmt]
|
245
|
-
end
|
246
|
-
|
247
|
-
def is_date_format?(num_fmt)
|
248
|
-
skip_chars = ['$', '-', '+', '/', '(', ')', ':', ' ']
|
249
|
-
num_chars = ['0', '#', '?']
|
250
|
-
non_date_formats = ['0.00E+00', '##0.0E+0', 'General', 'GENERAL', 'general', '@']
|
251
|
-
date_chars = ['y','m','d','h','s']
|
252
|
-
|
253
|
-
state = 0
|
254
|
-
s = ''
|
255
|
-
num_fmt.split(//).each do |c|
|
256
|
-
if state == 0
|
257
|
-
if c == '"'
|
258
|
-
state = 1
|
259
|
-
elsif ['\\', '_', '*'].include?(c)
|
260
|
-
state = 2
|
261
|
-
elsif skip_chars.include?(c)
|
262
|
-
next
|
263
|
-
else
|
264
|
-
s << c
|
265
|
-
end
|
266
|
-
elsif state == 1
|
267
|
-
if c == '"'
|
268
|
-
state = 0
|
269
|
-
end
|
270
|
-
elsif state == 2
|
271
|
-
state = 0
|
272
|
-
end
|
273
|
-
end
|
274
|
-
s.gsub!(/\[[^\]]*\]/, '')
|
275
|
-
if non_date_formats.include?(s)
|
276
|
-
return false
|
277
|
-
end
|
278
|
-
separator = ';'
|
279
|
-
got_sep = 0
|
280
|
-
date_count = 0
|
281
|
-
num_count = 0
|
282
|
-
s.split(//).each do |c|
|
283
|
-
if date_chars.include?(c)
|
284
|
-
date_count += 1
|
285
|
-
elsif num_chars.include?(c)
|
286
|
-
num_count += 1
|
287
|
-
elsif c == separator
|
288
|
-
got_sep = 1
|
289
|
-
end
|
290
|
-
end
|
291
|
-
if date_count > 0 && num_count == 0
|
292
|
-
return true
|
293
|
-
elsif num_count > 0 && date_count == 0
|
294
|
-
return false
|
295
|
-
elsif date_count
|
296
|
-
# ambiguous result
|
297
|
-
elsif got_sep == 0
|
298
|
-
# constant result
|
299
|
-
end
|
300
|
-
return date_count > num_count
|
301
|
-
end
|
302
|
-
|
303
|
-
#gets style object from style array given index
|
304
|
-
def get_style(style_index)
|
305
|
-
if !@cell_xfs[:xf].is_a?Array
|
306
|
-
@cell_xfs[:xf] = [@cell_xfs[:xf]]
|
307
|
-
end
|
308
|
-
|
309
|
-
xf_obj = @cell_xfs[:xf]
|
310
|
-
if xf_obj.is_a?Array
|
311
|
-
xf_obj = xf_obj[Integer(style_index)]
|
312
|
-
end
|
313
|
-
xf_obj
|
314
|
-
end
|
315
|
-
|
316
|
-
#gets attributes of above style object
|
317
|
-
#necessary because can take the form of hash or array,
|
318
|
-
#based on odd behavior of Nokogiri
|
319
|
-
def get_style_attributes(xf_obj)
|
320
|
-
if xf_obj.is_a?Array
|
321
|
-
xf = xf_obj[1]
|
322
|
-
else
|
323
|
-
xf = xf_obj[:attributes]
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
def get_fill_color(xf_attributes)
|
328
|
-
if @fills[xf_attributes[:fillId]].nil? || @fills[xf_attributes[:fillId]][:fill].nil? || @fills[xf_attributes[:fillId]][:fill][:patternFill].nil? || @fills[xf_attributes[:fillId]][:fill][:patternFill][:fgColor].nil?
|
329
|
-
'ffffff' #white
|
330
|
-
else
|
331
|
-
@fills[xf_attributes[:fillId]][:fill][:patternFill][:fgColor][:attributes][:rgb]
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
|
336
|
-
private
|
337
|
-
|
338
|
-
# Do not change. Excel requires that some of these styles be default,
|
339
|
-
# and will simply assume that the 0 and 1 indexed fonts are the default values.
|
340
|
-
def fill_styles()
|
341
|
-
@fonts = {
|
342
|
-
'0' => {
|
343
|
-
:font => {
|
344
|
-
:sz => { :attributes => { :val => 10 } },
|
345
|
-
:name => { :attributes => { :val => "Verdana" } }
|
346
|
-
},
|
347
|
-
:count=>1
|
348
|
-
},
|
349
|
-
'1' => {
|
350
|
-
:font => {
|
351
|
-
:sz => { :attributes => { :val => 8 } },
|
352
|
-
:name => { :attributes => { :val => "Verdana" } }
|
353
|
-
},
|
354
|
-
:count=>0
|
355
|
-
}
|
356
|
-
}
|
357
|
-
|
358
|
-
@fills = {
|
359
|
-
'0' => {
|
360
|
-
:fill => {
|
361
|
-
:patternFill => { :attributes => { :patternType => "none" } }
|
362
|
-
},
|
363
|
-
:count=>1} ,
|
364
|
-
'1' => {
|
365
|
-
:fill => {
|
366
|
-
:patternFill => { :attributes => { :patternType => "gray125" } }
|
367
|
-
},
|
368
|
-
:count=>0
|
369
|
-
}
|
370
|
-
}
|
371
|
-
|
372
|
-
@borders = {
|
373
|
-
'0' => {
|
374
|
-
:border => {
|
375
|
-
:left => { },
|
376
|
-
:right => { },
|
377
|
-
:top => { },
|
378
|
-
:bottom => { },
|
379
|
-
:diagonal => { }
|
380
|
-
},
|
381
|
-
:count => 1 #count = how many styles reference it
|
382
|
-
}
|
383
|
-
}
|
384
|
-
|
385
|
-
@cell_style_xfs = {
|
386
|
-
:attributes => {
|
387
|
-
:count => 1
|
388
|
-
},
|
389
|
-
:xf => {
|
390
|
-
:attributes => { :numFmtId => 0, :fontId => 0, :fillId => 0, :borderId => 0 }
|
391
|
-
}
|
392
|
-
}
|
393
|
-
@cell_xfs = {
|
394
|
-
:attributes => {
|
395
|
-
:count => 1
|
396
|
-
},
|
397
|
-
:xf => {
|
398
|
-
:attributes => { :numFmtId => 0, :fontId => 0, :fillId => 0, :borderId => 0, :xfId => 0 }
|
399
|
-
}
|
400
|
-
}
|
401
|
-
@cell_styles = {
|
402
|
-
:cellStyle => {
|
403
|
-
:attributes => { :builtinId=>0, :name=>"Normal", :xfId=>0 }
|
404
|
-
},
|
405
|
-
:attributes => { :count => 1 }
|
406
|
-
}
|
407
|
-
end
|
408
|
-
|
409
|
-
|
410
|
-
#fills shared strings hash, contains each unique string
|
411
|
-
def fill_shared_strings()
|
412
|
-
if @shared_strings.nil?
|
413
|
-
string_hash = {}
|
414
|
-
string_index = 0
|
415
|
-
@num_strings = 0
|
416
|
-
#fill hash for shared strings
|
417
|
-
@worksheets.each do |sheet|
|
418
|
-
unless sheet.nil?
|
419
|
-
sheet.sheet_data.each do |row|
|
420
|
-
row.each do |cell|
|
421
|
-
unless cell.nil? || cell.value.nil?
|
422
|
-
#if string not already seen, add it to hash
|
423
|
-
if cell.datatype == 's'
|
424
|
-
if string_hash[cell.value.to_s].nil?
|
425
|
-
string_hash[string_index]=cell.value.to_s
|
426
|
-
string_hash[cell.value.to_s]=string_index
|
427
|
-
string_index += 1
|
428
|
-
end
|
429
|
-
@num_strings += 1
|
430
|
-
end
|
431
|
-
end
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
end
|
436
|
-
|
437
|
-
if string_hash.empty?
|
438
|
-
@shared_strings = nil
|
439
|
-
else
|
440
|
-
@shared_strings = string_hash
|
441
|
-
@size = string_index
|
442
|
-
end
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
|
-
def validate_before_write
|
447
|
-
## TODO CHECK IF STYLE IS OK if not raise
|
448
|
-
end
|
449
|
-
end
|
450
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
|
2
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
|
3
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
|
4
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'color'))
|
5
|
-
require 'rubygems'
|
6
|
-
require 'nokogiri'
|
7
|
-
|
8
|
-
module RubyXL
|
9
|
-
module Writer
|
10
|
-
class AppWriter
|
11
|
-
attr_accessor :dirpath, :filepath, :workbook
|
12
|
-
|
13
|
-
def initialize(dirpath, wb)
|
14
|
-
@dirpath = dirpath
|
15
|
-
@filepath = dirpath+'/docProps/app.xml'
|
16
|
-
@workbook = wb
|
17
|
-
end
|
18
|
-
|
19
|
-
def write()
|
20
|
-
|
21
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
22
|
-
xml.Properties('xmlns' => 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties',
|
23
|
-
'xmlns:vt'=>'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes') {
|
24
|
-
xml.Application @workbook.application
|
25
|
-
xml.DocSecurity '0'
|
26
|
-
xml.ScaleCrop 'false'
|
27
|
-
xml.HeadingPairs {
|
28
|
-
xml['vt'].vector(:size => '2', :baseType => 'variant') {
|
29
|
-
xml['vt'].variant {
|
30
|
-
xml['vt'].lpstr 'Worksheets'
|
31
|
-
}
|
32
|
-
xml['vt'].variant {
|
33
|
-
xml['vt'].i4 @workbook.worksheets.size.to_s()
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
xml.TitlesOfParts {
|
38
|
-
xml['vt'].vector(:size=>@workbook.worksheets.size.to_s(), :baseType=>"lpstr") {
|
39
|
-
@workbook.worksheets.each do |sheet|
|
40
|
-
xml['vt'].lpstr sheet.sheet_name
|
41
|
-
end
|
42
|
-
}
|
43
|
-
}
|
44
|
-
xml.Company @workbook.company
|
45
|
-
xml.LinksUpToDate 'false'
|
46
|
-
xml.SharedDoc 'false'
|
47
|
-
xml.HyperlinksChanged 'false'
|
48
|
-
xml.AppVersion @workbook.appversion
|
49
|
-
}
|
50
|
-
end
|
51
|
-
contents = builder.to_xml
|
52
|
-
if(contents =~ /xmlns:vt=\"(.*)\" xmlns=\"(.*)\"/)
|
53
|
-
contents.sub(/xmlns:vt=\"(.*)\" xmlns=\"(.*)\"<A/,'xmlns="'+$2+'" xmlns:vt="'+$1+'"<A')
|
54
|
-
end
|
55
|
-
contents = contents.gsub(/\n/,'')
|
56
|
-
contents = contents.gsub(/>(\s)+</,'><')
|
57
|
-
contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
58
|
-
contents
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
|
2
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
|
3
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
|
4
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'color'))
|
5
|
-
require 'rubygems'
|
6
|
-
require 'nokogiri'
|
7
|
-
|
8
|
-
module RubyXL
|
9
|
-
module Writer
|
10
|
-
|
11
|
-
|
12
|
-
#TODO
|
13
|
-
class CalcChainWriter
|
14
|
-
attr_accessor :dirpath, :filepath, :workbook
|
15
|
-
|
16
|
-
def initialize(dirpath, wb)
|
17
|
-
@dirpath = dirpath
|
18
|
-
@workbook = wb
|
19
|
-
@filepath = dirpath + '/xl/calcChain.xml'
|
20
|
-
end
|
21
|
-
|
22
|
-
def write()
|
23
|
-
contents = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n"
|
24
|
-
contents += ''
|
25
|
-
# file = File.new(@filepath, 'w+')
|
26
|
-
# file.write(contents)
|
27
|
-
# file.close
|
28
|
-
contents
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
|
2
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
|
3
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
|
4
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'color'))
|
5
|
-
require 'rubygems'
|
6
|
-
require 'nokogiri'
|
7
|
-
|
8
|
-
|
9
|
-
module RubyXL
|
10
|
-
module Writer
|
11
|
-
class ContentTypesWriter
|
12
|
-
attr_accessor :dirpath, :filepath, :workbook
|
13
|
-
def initialize(dirpath, wb)
|
14
|
-
@dirpath = dirpath
|
15
|
-
@workbook = wb
|
16
|
-
@filepath = dirpath + '/[Content_Types].xml'
|
17
|
-
end
|
18
|
-
|
19
|
-
def write()
|
20
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
21
|
-
xml.Types('xmlns'=>"http://schemas.openxmlformats.org/package/2006/content-types") {
|
22
|
-
xml.Default('Extension'=>'xml', 'ContentType'=>'application/xml')
|
23
|
-
unless @workbook.shared_strings.nil?
|
24
|
-
xml.Override('PartName'=>'/xl/sharedStrings.xml',
|
25
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml")
|
26
|
-
end
|
27
|
-
if @workbook.macros.nil? && @workbook.drawings.nil?
|
28
|
-
xml.Override('PartName'=>'/xl/workbook.xml',
|
29
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml")
|
30
|
-
else
|
31
|
-
xml.Override('PartName'=>'/xl/workbook.xml',
|
32
|
-
'ContentType'=>"application/vnd.ms-excel.sheet.macroEnabled.main+xml")
|
33
|
-
end
|
34
|
-
xml.Override('PartName'=>"/xl/styles.xml",
|
35
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml")
|
36
|
-
xml.Default('Extension'=>'rels','ContentType'=>'application/vnd.openxmlformats-package.relationships+xml')
|
37
|
-
unless @workbook.external_links.nil?
|
38
|
-
1.upto(@workbook.external_links.size-1) do |i|
|
39
|
-
xml.Override('PartName'=>"/xl/externalLinks/externalLink#{i}.xml",
|
40
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
unless @workbook.macros.nil?
|
44
|
-
xml.Override('PartName'=>'/xl/vbaProject.bin',
|
45
|
-
'ContentType'=>'application/vnd.ms-office.vbaProject')
|
46
|
-
end
|
47
|
-
unless @workbook.printer_settings.nil?
|
48
|
-
xml.Default('Extension'=>'bin',
|
49
|
-
'ContentType'=>'application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings')
|
50
|
-
end
|
51
|
-
unless @workbook.drawings.nil?
|
52
|
-
xml.Default('Extension'=>'vml',
|
53
|
-
'ContentType'=>'application/vnd.openxmlformats-officedocument.vmlDrawing')
|
54
|
-
end
|
55
|
-
xml.Override('PartName'=>'/xl/theme/theme1.xml',
|
56
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.theme+xml")
|
57
|
-
@workbook.worksheets.each_with_index do |sheet,i|
|
58
|
-
xml.Override('PartName'=>"/xl/worksheets/sheet#{i+1}.xml",
|
59
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml")
|
60
|
-
end
|
61
|
-
xml.Override('PartName'=>'/docProps/core.xml',
|
62
|
-
'ContentType'=>"application/vnd.openxmlformats-package.core-properties+xml")
|
63
|
-
xml.Override('PartName'=>'/docProps/app.xml',
|
64
|
-
'ContentType'=>"application/vnd.openxmlformats-officedocument.extended-properties+xml")
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
contents = builder.to_xml
|
69
|
-
contents = contents.gsub(/\n/,'')
|
70
|
-
contents = contents.gsub(/>(\s)+</,'><')
|
71
|
-
contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
72
|
-
|
73
|
-
contents
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
|
2
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
|
3
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
|
4
|
-
# require File.expand_path(File.join(File.dirname(__FILE__),'color'))
|
5
|
-
require 'rubygems'
|
6
|
-
require 'nokogiri'
|
7
|
-
|
8
|
-
module RubyXL
|
9
|
-
module Writer
|
10
|
-
class CoreWriter
|
11
|
-
attr_accessor :dirpath, :filepath, :workbook
|
12
|
-
|
13
|
-
def initialize(dirpath, wb)
|
14
|
-
@dirpath = dirpath
|
15
|
-
@workbook = wb
|
16
|
-
@filepath = @dirpath + '/docProps/core.xml'
|
17
|
-
end
|
18
|
-
|
19
|
-
def write()
|
20
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
21
|
-
xml.coreProperties('xmlns:cp'=>"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
|
22
|
-
'xmlns:dc'=>"http://purl.org/dc/elements/1.1/", 'xmlns:dcterms'=>"http://purl.org/dc/terms/",
|
23
|
-
'xmlns:dcmitype'=>"http://purl.org/dc/dcmitype/", 'xmlns:xsi'=>"http://www.w3.org/2001/XMLSchema-instance") {
|
24
|
-
xml['dc'].creator @workbook.creator.to_s
|
25
|
-
xml['cp'].lastModifiedBy @workbook.modifier.to_s
|
26
|
-
xml['dcterms'].created('xsi:type' => 'dcterms:W3CDTF') do
|
27
|
-
@workbook.created_at
|
28
|
-
end
|
29
|
-
|
30
|
-
xml['dcterms'].modified('xsi:type' => 'dcterms:W3CDTF')
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
contents = builder.to_xml
|
35
|
-
contents = contents.gsub(/coreProperties/,'cp:coreProperties')
|
36
|
-
contents = contents.gsub(/\n/,'')
|
37
|
-
contents = contents.gsub(/>(\s)+</,'><')
|
38
|
-
|
39
|
-
#seems hack-y..
|
40
|
-
contents = contents.gsub(/<dcterms:created xsi:type=\"dcterms:W3CDTF\"\/>/,
|
41
|
-
'<dcterms:created xsi:type="dcterms:W3CDTF">'+@workbook.created_at+'</dcterms:created>')
|
42
|
-
contents = contents.gsub(/<dcterms:modified xsi:type=\"dcterms:W3CDTF\"\/>/,
|
43
|
-
'<dcterms:modified xsi:type="dcterms:W3CDTF">'+@workbook.modified_at+'</dcterms:modified>')
|
44
|
-
|
45
|
-
contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
46
|
-
|
47
|
-
return contents
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|