rubyXL 2.5.7 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rubyXL.rb +4 -1
- data/lib/rubyXL/objects/calculation_chain.rb +4 -6
- data/lib/rubyXL/objects/chartsheet.rb +16 -13
- data/lib/rubyXL/objects/color.rb +1 -1
- data/lib/rubyXL/objects/comments.rb +46 -0
- data/lib/rubyXL/objects/content_types.rb +17 -55
- data/lib/rubyXL/objects/document_properties.rb +13 -15
- data/lib/rubyXL/objects/filters.rb +1 -1
- data/lib/rubyXL/objects/ooxml_object.rb +24 -11
- data/lib/rubyXL/objects/reference.rb +1 -1
- data/lib/rubyXL/objects/relationships.rb +147 -31
- data/lib/rubyXL/objects/root.rb +57 -0
- data/lib/rubyXL/objects/shared_strings.rb +4 -5
- data/lib/rubyXL/objects/sheet_data.rb +8 -2
- data/lib/rubyXL/objects/storage.rb +169 -0
- data/lib/rubyXL/objects/stylesheet.rb +4 -5
- data/lib/rubyXL/objects/text.rb +3 -3
- data/lib/rubyXL/objects/theme.rb +4 -6
- data/lib/rubyXL/objects/workbook.rb +50 -22
- data/lib/rubyXL/objects/worksheet.rb +36 -12
- data/lib/rubyXL/parser.rb +23 -97
- data/lib/rubyXL/workbook.rb +29 -41
- data/lib/rubyXL/worksheet.rb +3 -0
- data/rdoc/README_rdoc.html +1 -1
- data/rdoc/RubyXL.html +1 -1
- data/rdoc/RubyXL/AExtension.html +1 -1
- data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/AdjustHandleList.html +1 -1
- data/rdoc/RubyXL/Alignment.html +1 -1
- data/rdoc/RubyXL/AlternateContent.html +1 -1
- data/rdoc/RubyXL/Authors.html +105 -0
- data/rdoc/RubyXL/AutoFilter.html +1 -1
- data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
- data/rdoc/RubyXL/BinaryImageFile.html +105 -0
- data/rdoc/RubyXL/BodyProperties.html +1 -1
- data/rdoc/RubyXL/BooleanNode.html +1 -1
- data/rdoc/RubyXL/BooleanValue.html +1 -1
- data/rdoc/RubyXL/Border.html +1 -1
- data/rdoc/RubyXL/BorderEdge.html +1 -1
- data/rdoc/RubyXL/Borders.html +1 -1
- data/rdoc/RubyXL/Break.html +1 -1
- data/rdoc/RubyXL/BreakList.html +1 -1
- data/rdoc/RubyXL/CT_AdjPoint2D.html +1 -1
- data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +1 -1
- data/rdoc/RubyXL/CT_AlphaModulateEffect.html +1 -1
- data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +1 -1
- data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +1 -1
- data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +1 -1
- data/rdoc/RubyXL/CT_Backdrop.html +1 -1
- data/rdoc/RubyXL/CT_Bevel.html +1 -1
- data/rdoc/RubyXL/CT_BiLevelEffect.html +1 -1
- data/rdoc/RubyXL/CT_BlendEffect.html +1 -1
- data/rdoc/RubyXL/CT_Blip.html +1 -1
- data/rdoc/RubyXL/CT_BlipFillProperties.html +1 -1
- data/rdoc/RubyXL/CT_BlurEffect.html +1 -1
- data/rdoc/RubyXL/CT_Camera.html +1 -1
- data/rdoc/RubyXL/CT_Color.html +1 -1
- data/rdoc/RubyXL/CT_ColorChangeEffect.html +1 -1
- data/rdoc/RubyXL/CT_ColorMapping.html +1 -1
- data/rdoc/RubyXL/CT_ColorScheme.html +1 -1
- data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +1 -1
- data/rdoc/RubyXL/CT_ConnectionSite.html +1 -1
- data/rdoc/RubyXL/CT_ConnectionSiteList.html +1 -1
- data/rdoc/RubyXL/CT_DashStop.html +1 -1
- data/rdoc/RubyXL/CT_DashStopList.html +1 -1
- data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +1 -1
- data/rdoc/RubyXL/CT_DuotoneEffect.html +1 -1
- data/rdoc/RubyXL/CT_EffectContainer.html +1 -1
- data/rdoc/RubyXL/CT_EffectList.html +1 -1
- data/rdoc/RubyXL/CT_EffectReference.html +1 -1
- data/rdoc/RubyXL/CT_EffectStyleItem.html +1 -1
- data/rdoc/RubyXL/CT_EffectStyleList.html +1 -1
- data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +1 -1
- data/rdoc/RubyXL/CT_FillEffect.html +1 -1
- data/rdoc/RubyXL/CT_FillOverlayEffect.html +1 -1
- data/rdoc/RubyXL/CT_FillStyleList.html +1 -1
- data/rdoc/RubyXL/CT_FlatText.html +1 -1
- data/rdoc/RubyXL/CT_FontCollection.html +1 -1
- data/rdoc/RubyXL/CT_FontReference.html +1 -1
- data/rdoc/RubyXL/CT_GeomGuideList.html +1 -1
- data/rdoc/RubyXL/CT_GlowEffect.html +1 -1
- data/rdoc/RubyXL/CT_GradientFillProperties.html +1 -1
- data/rdoc/RubyXL/CT_GradientStop.html +1 -1
- data/rdoc/RubyXL/CT_GradientStopList.html +1 -1
- data/rdoc/RubyXL/CT_HSLEffect.html +1 -1
- data/rdoc/RubyXL/CT_HslColor.html +1 -1
- data/rdoc/RubyXL/CT_Hyperlink.html +1 -1
- data/rdoc/RubyXL/CT_InnerShadowEffect.html +1 -1
- data/rdoc/RubyXL/CT_LightRig.html +1 -1
- data/rdoc/RubyXL/CT_LineEndProperties.html +1 -1
- data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +1 -1
- data/rdoc/RubyXL/CT_LineProperties.html +1 -1
- data/rdoc/RubyXL/CT_LineStyleList.html +1 -1
- data/rdoc/RubyXL/CT_LinearShadeProperties.html +1 -1
- data/rdoc/RubyXL/CT_LuminanceEffect.html +1 -1
- data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +1 -1
- data/rdoc/RubyXL/CT_OuterShadowEffect.html +1 -1
- data/rdoc/RubyXL/CT_Path2D.html +1 -1
- data/rdoc/RubyXL/CT_Path2DArcTo.html +1 -1
- data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +1 -1
- data/rdoc/RubyXL/CT_Path2DList.html +1 -1
- data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +1 -1
- data/rdoc/RubyXL/CT_Path2DTo.html +1 -1
- data/rdoc/RubyXL/CT_PathShadeProperties.html +1 -1
- data/rdoc/RubyXL/CT_PatternFillProperties.html +1 -1
- data/rdoc/RubyXL/CT_Point3D.html +1 -1
- data/rdoc/RubyXL/CT_PolarAdjustHandle.html +1 -1
- data/rdoc/RubyXL/CT_PresetColor.html +1 -1
- data/rdoc/RubyXL/CT_PresetLineDashProperties.html +1 -1
- data/rdoc/RubyXL/CT_PresetShadowEffect.html +1 -1
- data/rdoc/RubyXL/CT_PresetTextShape.html +1 -1
- data/rdoc/RubyXL/CT_ReflectionEffect.html +1 -1
- data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +1 -1
- data/rdoc/RubyXL/CT_RelativeRect.html +1 -1
- data/rdoc/RubyXL/CT_SRgbColor.html +1 -1
- data/rdoc/RubyXL/CT_ScRgbColor.html +1 -1
- data/rdoc/RubyXL/CT_Scene3D.html +1 -1
- data/rdoc/RubyXL/CT_SchemeColor.html +1 -1
- data/rdoc/RubyXL/CT_Shape3D.html +1 -1
- data/rdoc/RubyXL/CT_ShapeStyle.html +1 -1
- data/rdoc/RubyXL/CT_SoftEdgesEffect.html +1 -1
- data/rdoc/RubyXL/CT_SphereCoords.html +1 -1
- data/rdoc/RubyXL/CT_StretchInfoProperties.html +1 -1
- data/rdoc/RubyXL/CT_StyleMatrix.html +1 -1
- data/rdoc/RubyXL/CT_StyleMatrixReference.html +1 -1
- data/rdoc/RubyXL/CT_SupplementalFont.html +1 -1
- data/rdoc/RubyXL/CT_SystemColor.html +1 -1
- data/rdoc/RubyXL/CT_TextAutonumberBullet.html +1 -1
- data/rdoc/RubyXL/CT_TextBlipBullet.html +1 -1
- data/rdoc/RubyXL/CT_TextCharBullet.html +1 -1
- data/rdoc/RubyXL/CT_TextCharacterProperties.html +1 -1
- data/rdoc/RubyXL/CT_TextFont.html +1 -1
- data/rdoc/RubyXL/CT_TextListStyle.html +1 -1
- data/rdoc/RubyXL/CT_TextNormalAutofit.html +1 -1
- data/rdoc/RubyXL/CT_TextParagraphProperties.html +1 -1
- data/rdoc/RubyXL/CT_TextSpacing.html +1 -1
- data/rdoc/RubyXL/CT_TextTabStop.html +1 -1
- data/rdoc/RubyXL/CT_TextTabStopList.html +1 -1
- data/rdoc/RubyXL/CT_TileInfoProperties.html +1 -1
- data/rdoc/RubyXL/CT_TintEffect.html +1 -1
- data/rdoc/RubyXL/CT_Transform2D.html +1 -1
- data/rdoc/RubyXL/CT_TransformEffect.html +1 -1
- data/rdoc/RubyXL/CT_Vector3D.html +1 -1
- data/rdoc/RubyXL/CT_XYAdjustHandle.html +1 -1
- data/rdoc/RubyXL/CalculationChain.html +26 -42
- data/rdoc/RubyXL/CalculationChainCell.html +1 -1
- data/rdoc/RubyXL/CalculationProperties.html +1 -1
- data/rdoc/RubyXL/Cell.html +13 -13
- data/rdoc/RubyXL/CellSmartTag.html +1 -1
- data/rdoc/RubyXL/CellSmartTagProperty.html +1 -1
- data/rdoc/RubyXL/CellSmartTags.html +1 -1
- data/rdoc/RubyXL/CellStyle.html +1 -1
- data/rdoc/RubyXL/CellStyleXFs.html +1 -1
- data/rdoc/RubyXL/CellStyles.html +1 -1
- data/rdoc/RubyXL/CellValue.html +53 -1
- data/rdoc/RubyXL/CellWatch.html +1 -1
- data/rdoc/RubyXL/CellWatches.html +1 -1
- data/rdoc/RubyXL/CellXFs.html +1 -1
- data/rdoc/RubyXL/ChartColorsFile.html +105 -0
- data/rdoc/RubyXL/ChartFile.html +105 -0
- data/rdoc/RubyXL/ChartRelationshipsFile.html +105 -0
- data/rdoc/RubyXL/ChartStyleFile.html +105 -0
- data/rdoc/RubyXL/ChartUserShapesFile.html +105 -0
- data/rdoc/RubyXL/Chartsheet.html +1 -1
- data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
- data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
- data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
- data/rdoc/RubyXL/ChartsheetView.html +1 -1
- data/rdoc/RubyXL/ChartsheetViews.html +1 -1
- data/rdoc/RubyXL/Color.html +2 -2
- data/rdoc/RubyXL/ColorFilter.html +1 -1
- data/rdoc/RubyXL/ColorScale.html +1 -1
- data/rdoc/RubyXL/ColorSet.html +1 -1
- data/rdoc/RubyXL/Colors.html +1 -1
- data/rdoc/RubyXL/ColumnRange.html +1 -1
- data/rdoc/RubyXL/ColumnRanges.html +1 -1
- data/rdoc/RubyXL/Comment.html +108 -0
- data/rdoc/RubyXL/CommentList.html +105 -0
- data/rdoc/RubyXL/{CoreProperties.html → CommentsFile.html} +4 -4
- data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
- data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
- data/rdoc/RubyXL/ContentTypeDefault.html +1 -1
- data/rdoc/RubyXL/ContentTypeOverride.html +1 -1
- data/rdoc/RubyXL/ContentTypes.html +87 -63
- data/rdoc/RubyXL/ControlPropertiesFile.html +105 -0
- data/rdoc/RubyXL/CorePropertiesFile.html +105 -0
- data/rdoc/RubyXL/CustomColor.html +1 -1
- data/rdoc/RubyXL/CustomColorList.html +1 -1
- data/rdoc/RubyXL/CustomFilter.html +1 -1
- data/rdoc/RubyXL/CustomFilters.html +1 -1
- data/rdoc/RubyXL/CustomGeometry.html +1 -1
- data/rdoc/RubyXL/CustomProperties.html +1 -1
- data/rdoc/RubyXL/CustomPropertiesFile.html +105 -0
- data/rdoc/RubyXL/CustomProperty.html +1 -1
- data/rdoc/RubyXL/CustomSheetView.html +1 -1
- data/rdoc/RubyXL/CustomSheetViews.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
- data/rdoc/RubyXL/CustomXMLFile.html +105 -0
- data/rdoc/RubyXL/DXF.html +1 -1
- data/rdoc/RubyXL/DXFs.html +1 -1
- data/rdoc/RubyXL/DataBar.html +1 -1
- data/rdoc/RubyXL/DataConsolidate.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
- data/rdoc/RubyXL/DataType.html +1 -1
- data/rdoc/RubyXL/DataValidation.html +1 -1
- data/rdoc/RubyXL/DataValidations.html +1 -1
- data/rdoc/RubyXL/DateGroupItem.html +1 -1
- data/rdoc/RubyXL/DefinedName.html +1 -1
- data/rdoc/RubyXL/DefinedNames.html +1 -1
- data/rdoc/RubyXL/{DocumentProperties.html → DocumentPropertiesFile.html} +59 -83
- data/rdoc/RubyXL/DrawingFile.html +225 -0
- data/rdoc/RubyXL/DrawingRelationshipsFile.html +105 -0
- data/rdoc/RubyXL/DynamicFilter.html +1 -1
- data/rdoc/RubyXL/EmbeddedControl.html +1 -1
- data/rdoc/RubyXL/EmbeddedControls.html +1 -1
- data/rdoc/RubyXL/Extension.html +1 -1
- data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/Extents.html +1 -1
- data/rdoc/RubyXL/ExternalLinksFile.html +105 -0
- data/rdoc/RubyXL/ExternalReference.html +1 -1
- data/rdoc/RubyXL/ExternalReferences.html +1 -1
- data/rdoc/RubyXL/ExtraColorSchemeList.html +1 -1
- data/rdoc/RubyXL/FieldItem.html +1 -1
- data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
- data/rdoc/RubyXL/FileSharing.html +1 -1
- data/rdoc/RubyXL/FileVersion.html +1 -1
- data/rdoc/RubyXL/Fill.html +1 -1
- data/rdoc/RubyXL/Fills.html +1 -1
- data/rdoc/RubyXL/FilterContainer.html +1 -1
- data/rdoc/RubyXL/FloatNode.html +1 -1
- data/rdoc/RubyXL/FloatValue.html +1 -1
- data/rdoc/RubyXL/Font.html +1 -1
- data/rdoc/RubyXL/FontScheme.html +1 -1
- data/rdoc/RubyXL/Fonts.html +1 -1
- data/rdoc/RubyXL/Formula.html +1 -1
- data/rdoc/RubyXL/FunctionGroup.html +1 -1
- data/rdoc/RubyXL/FunctionGroups.html +1 -1
- data/rdoc/RubyXL/GenericStorageObject.html +352 -0
- data/rdoc/RubyXL/GradientFill.html +1 -1
- data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
- data/rdoc/RubyXL/Hyperlink.html +1 -1
- data/rdoc/RubyXL/HyperlinkRelFile.html +105 -0
- data/rdoc/RubyXL/Hyperlinks.html +1 -1
- data/rdoc/RubyXL/IconFilter.html +1 -1
- data/rdoc/RubyXL/IconSet.html +1 -1
- data/rdoc/RubyXL/IgnoredError.html +1 -1
- data/rdoc/RubyXL/IgnoredErrors.html +1 -1
- data/rdoc/RubyXL/IndexedColors.html +1 -1
- data/rdoc/RubyXL/InputCells.html +1 -1
- data/rdoc/RubyXL/IntegerNode.html +1 -1
- data/rdoc/RubyXL/IntegerValue.html +1 -1
- data/rdoc/RubyXL/LegacyCell.html +1 -1
- data/rdoc/RubyXL/LegacyWorkbook.html +48 -343
- data/rdoc/RubyXL/LegacyWorksheet.html +83 -80
- data/rdoc/RubyXL/MRUColors.html +1 -1
- data/rdoc/RubyXL/MacrosFile.html +105 -0
- data/rdoc/RubyXL/MergedCell.html +1 -1
- data/rdoc/RubyXL/MergedCells.html +1 -1
- data/rdoc/RubyXL/NumFmt.html +1 -1
- data/rdoc/RubyXL/NumberFormat.html +1 -1
- data/rdoc/RubyXL/NumberFormats.html +1 -1
- data/rdoc/RubyXL/OLEObject.html +1 -1
- data/rdoc/RubyXL/OLEObjects.html +1 -1
- data/rdoc/RubyXL/OLESize.html +1 -1
- data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObject.html +1 -1
- data/rdoc/RubyXL/OOXMLObjectClassMethods.html +3 -3
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +283 -20
- data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
- data/rdoc/RubyXL/Offset.html +1 -1
- data/rdoc/RubyXL/OutlineProperties.html +1 -1
- data/rdoc/RubyXL/PageMargins.html +1 -1
- data/rdoc/RubyXL/PageSetup.html +1 -1
- data/rdoc/RubyXL/PageSetupProperties.html +1 -1
- data/rdoc/RubyXL/Pane.html +1 -1
- data/rdoc/RubyXL/Parser.html +35 -139
- data/rdoc/RubyXL/PatternFill.html +1 -1
- data/rdoc/RubyXL/PhoneticProperties.html +1 -1
- data/rdoc/RubyXL/PhoneticRun.html +1 -1
- data/rdoc/RubyXL/PivotArea.html +1 -1
- data/rdoc/RubyXL/PivotCache.html +1 -1
- data/rdoc/RubyXL/PivotCacheDefinitionFile.html +105 -0
- data/rdoc/RubyXL/PivotCaches.html +1 -1
- data/rdoc/RubyXL/PivotReference.html +1 -1
- data/rdoc/RubyXL/PivotReferences.html +1 -1
- data/rdoc/RubyXL/PivotTableFile.html +105 -0
- data/rdoc/RubyXL/PivotTableSelection.html +1 -1
- data/rdoc/RubyXL/PresetGeometry.html +1 -1
- data/rdoc/RubyXL/PrintOptions.html +1 -1
- data/rdoc/RubyXL/PrinterSettingsFile.html +119 -0
- data/rdoc/RubyXL/ProtectedRange.html +1 -1
- data/rdoc/RubyXL/ProtectedRanges.html +1 -1
- data/rdoc/RubyXL/Protection.html +1 -1
- data/rdoc/RubyXL/RID.html +1 -1
- data/rdoc/RubyXL/RawOOXML.html +1 -1
- data/rdoc/RubyXL/Reference.html +2 -2
- data/rdoc/RubyXL/Relationship.html +1 -1
- data/rdoc/RubyXL/RelationshipSupport.html +98 -0
- data/rdoc/RubyXL/RichText.html +1 -1
- data/rdoc/RubyXL/RichTextRun.html +1 -1
- data/rdoc/RubyXL/RootRelationships.html +1 -1
- data/rdoc/RubyXL/Row.html +1 -1
- data/rdoc/RubyXL/RunProperties.html +1 -1
- data/rdoc/RubyXL/Scenario.html +1 -1
- data/rdoc/RubyXL/Scenarios.html +1 -1
- data/rdoc/RubyXL/Selection.html +1 -1
- data/rdoc/RubyXL/ShapeGuide.html +1 -1
- data/rdoc/RubyXL/ShapeTextRectangle.html +1 -1
- data/rdoc/RubyXL/SharedStringsTable.html +61 -77
- data/rdoc/RubyXL/Sheet.html +1 -1
- data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
- data/rdoc/RubyXL/SheetData.html +1 -1
- data/rdoc/RubyXL/SheetRelationshipsFile.html +105 -0
- data/rdoc/RubyXL/Sheets.html +1 -1
- data/rdoc/RubyXL/SlicerCacheFile.html +105 -0
- data/rdoc/RubyXL/SlicerFile.html +105 -0
- data/rdoc/RubyXL/SmartTagProperties.html +1 -1
- data/rdoc/RubyXL/SmartTagType.html +1 -1
- data/rdoc/RubyXL/SmartTagTypes.html +1 -1
- data/rdoc/RubyXL/SmartTags.html +1 -1
- data/rdoc/RubyXL/SortCondition.html +1 -1
- data/rdoc/RubyXL/SortState.html +1 -1
- data/rdoc/RubyXL/Sqref.html +1 -1
- data/rdoc/RubyXL/Stop.html +1 -1
- data/rdoc/RubyXL/StringNode.html +1 -1
- data/rdoc/RubyXL/StringNodeW3C.html +1 -1
- data/rdoc/RubyXL/StringValue.html +1 -1
- data/rdoc/RubyXL/Stylesheet.html +1 -1
- data/rdoc/RubyXL/TableFile.html +105 -0
- data/rdoc/RubyXL/TableParts.html +1 -1
- data/rdoc/RubyXL/TableStyle.html +1 -1
- data/rdoc/RubyXL/TableStyles.html +1 -1
- data/rdoc/RubyXL/Text.html +2 -2
- data/rdoc/RubyXL/Theme.html +1 -1
- data/rdoc/RubyXL/ThemeElements.html +1 -1
- data/rdoc/RubyXL/ThumbnailFile.html +105 -0
- data/rdoc/RubyXL/Top10.html +1 -1
- data/rdoc/RubyXL/VMLDrawingFile.html +105 -0
- data/rdoc/RubyXL/Variant.html +1 -1
- data/rdoc/RubyXL/Vector.html +1 -1
- data/rdoc/RubyXL/VectorValue.html +1 -1
- data/rdoc/RubyXL/VisualProperties.html +1 -1
- data/rdoc/RubyXL/WebPublishObject.html +1 -1
- data/rdoc/RubyXL/WebPublishObjects.html +1 -1
- data/rdoc/RubyXL/WebPublishingItem.html +1 -1
- data/rdoc/RubyXL/WebPublishingItems.html +1 -1
- data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
- data/rdoc/RubyXL/Workbook.html +1 -1
- data/rdoc/RubyXL/WorkbookProperties.html +1 -1
- data/rdoc/RubyXL/WorkbookProtection.html +1 -1
- data/rdoc/RubyXL/WorkbookRelationships.html +1 -1
- data/rdoc/RubyXL/WorkbookRoot.html +449 -0
- data/rdoc/RubyXL/WorkbookView.html +1 -1
- data/rdoc/RubyXL/WorkbookViews.html +1 -1
- data/rdoc/RubyXL/Worksheet.html +1 -1
- data/rdoc/RubyXL/WorksheetDimensions.html +1 -1
- data/rdoc/RubyXL/WorksheetFormatProperties.html +1 -1
- data/rdoc/RubyXL/WorksheetProperties.html +1 -1
- data/rdoc/RubyXL/WorksheetProtection.html +1 -1
- data/rdoc/RubyXL/WorksheetView.html +1 -1
- data/rdoc/RubyXL/WorksheetViews.html +1 -1
- data/rdoc/RubyXL/XF.html +1 -1
- data/rdoc/created.rid +30 -28
- data/rdoc/index.html +12 -4
- data/rdoc/js/search_index.js +1 -1
- data/rdoc/table_of_contents.html +160 -98
- data/rubyXL.gemspec +38 -7
- data/test/test_parse_write.rb +4 -4
- metadata +37 -6
- data/lib/rubyXL/generic_storage.rb +0 -42
- data/rdoc/RubyXL/GenericStorage.html +0 -346
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a09e59d3e1ba47212acd8cd808c8863d85016d7
|
4
|
+
data.tar.gz: f4ad0faaf011c66154a6d97f84c16ed255ddfd13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9553c04829bf02bc5918341deeb9a535086bc80cbc0d64ce964fcad89cbfd5f925f4dda11e72aad5d015d3f82dbaa0ebb26b650da2327de15dcd57c4fb00e1c3
|
7
|
+
data.tar.gz: a0f90671f4710d6f1a5589e6d9462b171ed84873bdd5427c63d8daa24a6c1c845178f54775b7508bde5da07a3d487844e9f80de19081b1a3adb8209520f083b1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/lib/rubyXL.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubyXL/objects/relationships'
|
1
2
|
require 'rubyXL/workbook'
|
2
3
|
require 'rubyXL/worksheet'
|
3
4
|
require 'rubyXL/cell'
|
@@ -10,9 +11,11 @@ require 'rubyXL/objects/chartsheet'
|
|
10
11
|
require 'rubyXL/objects/calculation_chain'
|
11
12
|
require 'rubyXL/objects/content_types'
|
12
13
|
require 'rubyXL/objects/theme'
|
14
|
+
require 'rubyXL/objects/comments'
|
15
|
+
require 'rubyXL/objects/root'
|
13
16
|
require 'rubyXL/objects/workbook'
|
14
17
|
require 'rubyXL/objects/document_properties'
|
15
|
-
require 'rubyXL/objects/
|
18
|
+
require 'rubyXL/objects/storage'
|
16
19
|
require 'rubyXL/parser'
|
17
20
|
|
18
21
|
module RubyXL
|
@@ -15,19 +15,17 @@ module RubyXL
|
|
15
15
|
|
16
16
|
# http://www.schemacentral.com/sc/ooxml/e-ssml_calcChain.html
|
17
17
|
class CalculationChain < OOXMLTopLevelObject
|
18
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml'
|
19
|
+
REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain'
|
20
|
+
|
18
21
|
define_child_node(RubyXL::CalculationChainCell, :collection => true, :accessor => :cells)
|
19
22
|
define_child_node(RubyXL::ExtensionStorageArea)
|
20
23
|
|
21
24
|
define_element_name 'calcChain'
|
22
25
|
set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => '')
|
23
26
|
|
24
|
-
def
|
27
|
+
def xlsx_path
|
25
28
|
File.join('xl', 'calcChain.xml')
|
26
29
|
end
|
27
|
-
|
28
|
-
def self.content_type
|
29
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml'
|
30
|
-
end
|
31
|
-
|
32
30
|
end
|
33
31
|
end
|
@@ -57,6 +57,14 @@ module RubyXL
|
|
57
57
|
|
58
58
|
# http://www.schemacentral.com/sc/ooxml/e-ssml_chartsheet.html
|
59
59
|
class Chartsheet < OOXMLTopLevelObject
|
60
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml'
|
61
|
+
REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet'
|
62
|
+
|
63
|
+
include RubyXL::RelationshipSupport
|
64
|
+
|
65
|
+
attr_accessor :state, :rels
|
66
|
+
attr_accessor :workbook, :sheet_name, :sheet_id
|
67
|
+
|
60
68
|
define_child_node(RubyXL::ChartsheetProperties)
|
61
69
|
define_child_node(RubyXL::ChartsheetViews)
|
62
70
|
define_child_node(RubyXL::ChartsheetProtection)
|
@@ -74,26 +82,21 @@ module RubyXL
|
|
74
82
|
set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => '',
|
75
83
|
'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r')
|
76
84
|
|
77
|
-
attr_accessor :state
|
78
|
-
|
79
|
-
def sheet_index
|
80
|
-
@workbook.worksheets.select{ |sheet| sheet.is_a?(self.class) }.index{ |sheet| sheet.equal?(self) }
|
81
|
-
end
|
82
|
-
|
83
85
|
def xlsx_path
|
84
|
-
File.join('xl', 'chartsheets', "sheet#{
|
86
|
+
File.join('xl', 'chartsheets', "sheet#{file_index}.xml")
|
85
87
|
end
|
86
88
|
|
87
|
-
def
|
88
|
-
|
89
|
+
def relationship_file_class
|
90
|
+
RubyXL::SheetRelationshipsFile
|
89
91
|
end
|
90
92
|
|
91
|
-
def
|
92
|
-
|
93
|
+
def attach_relationship(rid, rf)
|
94
|
+
case rf
|
95
|
+
when RubyXL::DrawingFile then store_relationship(rf) # TODO
|
96
|
+
else store_relationship(rf, :unknown)
|
97
|
+
end
|
93
98
|
end
|
94
99
|
|
95
|
-
attr_accessor :workbook, :sheet_name, :sheet_id
|
96
|
-
|
97
100
|
end
|
98
101
|
|
99
102
|
end
|
data/lib/rubyXL/objects/color.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubyXL/objects/ooxml_object'
|
2
|
+
require 'rubyXL/objects/extensions'
|
3
|
+
|
4
|
+
module RubyXL
|
5
|
+
|
6
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_comment-1.html
|
7
|
+
class Comment < OOXMLObject
|
8
|
+
define_child_node(RubyXL::RichText, :node_name => 'text')
|
9
|
+
define_attribute(:ref, :ref, :required => true)
|
10
|
+
define_attribute(:authorId, :int, :required => true)
|
11
|
+
define_attribute(:guid, :string)
|
12
|
+
define_element_name 'comment'
|
13
|
+
end
|
14
|
+
|
15
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_authors-1.html
|
16
|
+
class CommentList < OOXMLContainerObject
|
17
|
+
define_child_node(RubyXL::Comment, :collection => :true)
|
18
|
+
define_element_name 'commentList'
|
19
|
+
end
|
20
|
+
|
21
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_authors-1.html
|
22
|
+
class Authors < OOXMLContainerObject
|
23
|
+
define_child_node(RubyXL::StringNode, :node_name => :author, :collection => :true)
|
24
|
+
define_element_name 'authors'
|
25
|
+
end
|
26
|
+
|
27
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_comments.html
|
28
|
+
class CommentsFile < OOXMLTopLevelObject
|
29
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
|
30
|
+
REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments'
|
31
|
+
|
32
|
+
define_child_node(RubyXL::Authors)
|
33
|
+
define_child_node(RubyXL::CommentList)
|
34
|
+
define_child_node(RubyXL::ExtensionStorageArea)
|
35
|
+
define_element_name 'comments'
|
36
|
+
set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => '')
|
37
|
+
|
38
|
+
attr_accessor :workbook
|
39
|
+
|
40
|
+
def xlsx_path
|
41
|
+
File.join('xl', "comments#{file_index}.xml")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -15,7 +15,7 @@ module RubyXL
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class ContentTypes < OOXMLTopLevelObject
|
18
|
-
attr_accessor :
|
18
|
+
attr_accessor :owner
|
19
19
|
|
20
20
|
define_child_node(RubyXL::ContentTypeDefault, :collection => true, :accessor => :defaults)
|
21
21
|
define_child_node(RubyXL::ContentTypeOverride, :collection => true, :accessor => :overrides)
|
@@ -27,13 +27,22 @@ module RubyXL
|
|
27
27
|
'[Content_Types].xml'
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def xlsx_path
|
31
|
+
self.class.xlsx_path
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.save_order
|
35
|
+
999 # Must be saved last, so it has time to accumulate overrides from all others.
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_override(obj)
|
39
|
+
return unless obj.class.const_defined?(:CONTENT_TYPE)
|
40
|
+
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{obj.xlsx_path}", :content_type => obj.class::CONTENT_TYPE)
|
32
41
|
end
|
33
42
|
|
34
43
|
def before_write_xml
|
35
44
|
self.defaults = []
|
36
|
-
|
45
|
+
if owner.rels_hash[RubyXL::PrinterSettingsFile] then
|
37
46
|
defaults << RubyXL::ContentTypeDefault.new(:extension => 'bin',
|
38
47
|
:content_type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings')
|
39
48
|
end
|
@@ -45,58 +54,11 @@ module RubyXL
|
|
45
54
|
:content_type => 'application/xml' )
|
46
55
|
|
47
56
|
# TODO: Need to only write these types when respective content is actually present.
|
48
|
-
defaults << RubyXL::ContentTypeDefault.new(:extension => 'jpeg', :content_type => 'image/jpeg'
|
49
|
-
defaults << RubyXL::ContentTypeDefault.new(:extension => 'png', :content_type => 'image/png'
|
50
|
-
|
51
|
-
|
52
|
-
overrides << generate_override(workbook)
|
53
|
-
workbook.worksheets.each { |sheet| overrides << generate_override(sheet) }
|
54
|
-
overrides << generate_override(workbook.stylesheet)
|
55
|
-
overrides << generate_override(workbook.document_properties)
|
56
|
-
overrides << generate_override(workbook.core_properties)
|
57
|
-
overrides << generate_override(workbook.shared_strings_container) if workbook.shared_strings_container && !workbook.shared_strings_container.empty?
|
58
|
-
overrides << generate_override(workbook.calculation_chain)
|
59
|
-
overrides << generate_override(workbook.theme)
|
60
|
-
|
61
|
-
workbook.charts.each_pair { |k, v|
|
62
|
-
case k
|
63
|
-
when /^chart\d*.xml$/ then
|
64
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
65
|
-
:content_type => 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml')
|
66
|
-
when /^style\d*.xml$/ then
|
67
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
68
|
-
:content_type => 'application/vnd.ms-office.chartstyle+xml')
|
69
|
-
when /^colors\d*.xml$/ then
|
70
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.charts.local_dir_path}/#{k}",
|
71
|
-
:content_type => 'application/vnd.ms-office.chartcolorstyle+xml')
|
72
|
-
end
|
73
|
-
}
|
74
|
-
|
75
|
-
workbook.drawings.each_pair { |k, v|
|
76
|
-
case k
|
77
|
-
when /.xml$/ then
|
78
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.drawings.local_dir_path}/#{k}",
|
79
|
-
:content_type => 'application/vnd.openxmlformats-officedocument.drawing+xml')
|
80
|
-
when /.vml$/ then
|
81
|
-
# more proper fix: <Default Extension="vml" ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>
|
82
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{@workbook.drawings.local_dir_path}/#{k}",
|
83
|
-
:content_type => 'application/vnd.openxmlformats-officedocument.vmlDrawing')
|
84
|
-
end
|
85
|
-
}
|
86
|
-
|
87
|
-
unless workbook.external_links.nil?
|
88
|
-
1.upto(workbook.external_links.size - 1) { |i|
|
89
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => "/xl/externalLinks/externalLink#{i}.xml",
|
90
|
-
:content_type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml')
|
91
|
-
}
|
92
|
-
end
|
93
|
-
|
94
|
-
unless @workbook.macros.empty?
|
95
|
-
overrides << RubyXL::ContentTypeOverride.new(:part_name => '/xl/vbaProject.bin',
|
96
|
-
:content_type => 'application/vnd.ms-office.vbaProject')
|
97
|
-
end
|
57
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'jpeg', :content_type => 'image/jpeg')
|
58
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'png', :content_type => 'image/png')
|
59
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'wmf', :content_type => 'image/x-wmf')
|
60
|
+
defaults << RubyXL::ContentTypeDefault.new(:extension => 'vml', :content_type => 'application/vnd.openxmlformats-officedocument.vmlDrawing')
|
98
61
|
|
99
|
-
overrides.compact!
|
100
62
|
true
|
101
63
|
end
|
102
64
|
|
@@ -4,7 +4,10 @@ require 'rubyXL/objects/container_nodes'
|
|
4
4
|
module RubyXL
|
5
5
|
|
6
6
|
# http://www.schemacentral.com/sc/ooxml/e-extended-properties_Properties.html
|
7
|
-
class
|
7
|
+
class DocumentPropertiesFile < OOXMLTopLevelObject
|
8
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.extended-properties+xml'
|
9
|
+
REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'
|
10
|
+
|
8
11
|
attr_accessor :workbook
|
9
12
|
|
10
13
|
define_child_node(RubyXL::StringNode, :node_name => :Template)
|
@@ -58,27 +61,26 @@ module RubyXL
|
|
58
61
|
add_parts_count('Worksheets', @workbook.worksheets.size)
|
59
62
|
@workbook.worksheets.each { |sheet| add_part_title(sheet.sheet_name) }
|
60
63
|
|
61
|
-
if @workbook.
|
62
|
-
add_parts_count('Named Ranges', @workbook.
|
63
|
-
@workbook.
|
64
|
+
if @workbook.defined_names then
|
65
|
+
add_parts_count('Named Ranges', @workbook.defined_names.size)
|
66
|
+
@workbook.defined_names.each { |defined_name| add_part_title(defined_name.name) }
|
64
67
|
end
|
65
68
|
end
|
66
69
|
|
67
70
|
true
|
68
71
|
end
|
69
72
|
|
70
|
-
def
|
73
|
+
def xlsx_path
|
71
74
|
File.join('docProps', 'app.xml')
|
72
75
|
end
|
73
76
|
|
74
|
-
def self.content_type
|
75
|
-
'application/vnd.openxmlformats-officedocument.extended-properties+xml'
|
76
|
-
end
|
77
|
-
|
78
77
|
end
|
79
78
|
|
80
79
|
|
81
|
-
class
|
80
|
+
class CorePropertiesFile < OOXMLTopLevelObject
|
81
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-package.core-properties+xml'
|
82
|
+
REL_TYPE = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'
|
83
|
+
|
82
84
|
attr_accessor :workbook
|
83
85
|
|
84
86
|
define_child_node(RubyXL::StringNode, :node_name => 'dc:creator')
|
@@ -105,14 +107,10 @@ module RubyXL
|
|
105
107
|
'http://www.w3.org/2001/XMLSchema-instance' => 'xsi')
|
106
108
|
define_element_name 'cp:coreProperties'
|
107
109
|
|
108
|
-
def
|
110
|
+
def xlsx_path
|
109
111
|
File.join('docProps', 'core.xml')
|
110
112
|
end
|
111
113
|
|
112
|
-
def self.content_type
|
113
|
-
'application/vnd.openxmlformats-package.core-properties+xml'
|
114
|
-
end
|
115
|
-
|
116
114
|
def creator
|
117
115
|
dc_creator && dc_creator.value
|
118
116
|
end
|
@@ -103,7 +103,7 @@ module RubyXL
|
|
103
103
|
define_attribute(:caseSensitive, :bool, :default => false)
|
104
104
|
define_attribute(:sortMethod, RubyXL::ST_SortMethod, :default => 'none')
|
105
105
|
define_attribute(:ref, :ref, :required => true)
|
106
|
-
define_child_node(RubyXL::SortCondition, :
|
106
|
+
define_child_node(RubyXL::SortCondition, :collection => true)
|
107
107
|
define_child_node(RubyXL::ExtensionStorageArea)
|
108
108
|
define_element_name 'sortState'
|
109
109
|
end
|
@@ -63,7 +63,7 @@ module RubyXL
|
|
63
63
|
# ==== Examples
|
64
64
|
# define_child_node(RubyXL::Alignment)
|
65
65
|
# Define a singular child node parsed by the RubyXL::BorderEdge.parse() and accessed by the default <tt>obj.alignment</tt> accessor
|
66
|
-
# define_child_node(RubyXL::Hyperlink, :
|
66
|
+
# define_child_node(RubyXL::Hyperlink, :collection => true, :accessor => :hyperlinks)
|
67
67
|
# Define an array of nodes accessed by <tt>obj.hyperlinks</tt> accessor, each of which will be parsed by the RubyXL::Hyperlink.parse()
|
68
68
|
# define_child_node(RubyXL::BorderEdge, :node_name => :left)
|
69
69
|
# define_child_node(RubyXL::BorderEdge, :node_name => :right)
|
@@ -109,7 +109,7 @@ module RubyXL
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def parse(node, known_namespaces = nil)
|
112
|
-
node = Nokogiri::XML.parse(node) if node.is_a?(IO) || node.is_a?(String)
|
112
|
+
node = Nokogiri::XML.parse(node) if node.is_a?(IO) || node.is_a?(String) || node.is_a?(Zip::InputStream)
|
113
113
|
|
114
114
|
if node.is_a?(Nokogiri::XML::Document) then
|
115
115
|
@namespaces = node.namespaces
|
@@ -274,7 +274,7 @@ module RubyXL
|
|
274
274
|
val = val &&
|
275
275
|
case v[:attr_type]
|
276
276
|
when :bool then val ? '1' : '0'
|
277
|
-
when :float then val.to_s.gsub(/\.0
|
277
|
+
when :float then val.to_s.gsub(/\.0*\Z/, '') # Trim trailing zeroes
|
278
278
|
else val
|
279
279
|
end
|
280
280
|
|
@@ -396,11 +396,11 @@ module RubyXL
|
|
396
396
|
# Prototype method. For top-level OOXML object, returns the path at which the current object's XML file
|
397
397
|
# is located within the <tt>.xslx</tt> zip container.
|
398
398
|
def xlsx_path
|
399
|
-
|
399
|
+
raise 'Subclass responsebility'
|
400
400
|
end
|
401
401
|
|
402
|
-
def self.
|
403
|
-
|
402
|
+
def self.save_order
|
403
|
+
500
|
404
404
|
end
|
405
405
|
|
406
406
|
# Sets the list of namespaces on this object to be added when writing out XML. Valid only on top-level objects.
|
@@ -417,11 +417,20 @@ module RubyXL
|
|
417
417
|
# directory containing the unzipped contents of <tt>.xslx</tt>
|
418
418
|
# === Parameters
|
419
419
|
# * +dirpath+ - path to the directory with the unzipped <tt>.xslx</tt> contents.
|
420
|
-
def self.parse_file(dirpath)
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
420
|
+
def self.parse_file(dirpath, file_path = nil)
|
421
|
+
file_path = Pathname.new(file_path || self.xlsx_path)
|
422
|
+
|
423
|
+
case dirpath
|
424
|
+
when String then
|
425
|
+
full_path = File.join(dirpath, file_path)
|
426
|
+
return nil unless File.exist?(full_path)
|
427
|
+
# Making sure that the file will be automatically closed immediately after it has been read
|
428
|
+
File.open(full_path, 'r') { |f| parse(f) }
|
429
|
+
when Zip::File then
|
430
|
+
file_path = file_path.relative_path_from(Pathname.new("/")) if file_path.absolute? # Zip doesn't like absolute paths.
|
431
|
+
entry = dirpath.find_entry(file_path)
|
432
|
+
entry && (entry.get_input_stream { |f| parse(f) })
|
433
|
+
end
|
425
434
|
end
|
426
435
|
|
427
436
|
# Saves the contents of the object as XML to respective location in <tt>.xslx</tt> zip container.
|
@@ -433,6 +442,10 @@ module RubyXL
|
|
433
442
|
zipfile.get_output_stream(self.xlsx_path) { |f| f << xml_string }
|
434
443
|
end
|
435
444
|
|
445
|
+
def file_index
|
446
|
+
@workbook.root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
|
447
|
+
end
|
448
|
+
|
436
449
|
end
|
437
450
|
|
438
451
|
end
|
@@ -87,7 +87,7 @@ module RubyXL
|
|
87
87
|
|
88
88
|
# Converts Excel-style cell reference to +row+ and +col+ zero-based indices.
|
89
89
|
def self.ref2ind(str)
|
90
|
-
return [ -1, -1 ] unless str =~
|
90
|
+
return [ -1, -1 ] unless str =~ /\A([A-Z]+)(\d+)\Z/
|
91
91
|
|
92
92
|
col = 0
|
93
93
|
$1.each_byte { |chr| col = col * 26 + (chr - 64) }
|
@@ -7,9 +7,10 @@ module RubyXL
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class Relationship < OOXMLObject
|
10
|
-
define_attribute(:Id,
|
11
|
-
define_attribute(:Type,
|
12
|
-
define_attribute(:Target,
|
10
|
+
define_attribute(:Id, :string)
|
11
|
+
define_attribute(:Type, :string)
|
12
|
+
define_attribute(:Target, :string)
|
13
|
+
define_attribute(:TargetMode, :string)
|
13
14
|
define_element_name 'Relationship'
|
14
15
|
end
|
15
16
|
|
@@ -18,19 +19,28 @@ module RubyXL
|
|
18
19
|
define_element_name 'Relationships'
|
19
20
|
set_namespaces('http://schemas.openxmlformats.org/package/2006/relationships' => '')
|
20
21
|
|
21
|
-
|
22
|
+
attr_accessor :related_files, :owner
|
23
|
+
|
24
|
+
@@debug = nil # Change to 0 to enable debug output
|
25
|
+
|
26
|
+
def new_relationship(target, type)
|
22
27
|
RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
|
23
|
-
:type =>
|
28
|
+
:type => type,
|
24
29
|
:target => target)
|
25
30
|
end
|
26
|
-
protected :
|
31
|
+
protected :new_relationship
|
27
32
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
def add_relationship(obj)
|
34
|
+
return if obj.nil?
|
35
|
+
relationships << RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
|
36
|
+
:type => obj.class::REL_TYPE,
|
37
|
+
:target => obj.xlsx_path)
|
38
|
+
end
|
39
|
+
protected :add_relationship
|
40
|
+
|
41
|
+
def self.save_order
|
42
|
+
0
|
32
43
|
end
|
33
|
-
protected :metadata_relationship
|
34
44
|
|
35
45
|
def find_by_rid(r_id)
|
36
46
|
relationships.find { |r| r.id == r_id }
|
@@ -39,9 +49,70 @@ module RubyXL
|
|
39
49
|
def find_by_target(target)
|
40
50
|
relationships.find { |r| r.target == target }
|
41
51
|
end
|
42
|
-
end
|
43
52
|
|
53
|
+
def self.get_class_by_rel_type(rel_type)
|
54
|
+
unless defined?(@@rel_hash)
|
55
|
+
@@rel_hash = {}
|
56
|
+
RubyXL.constants.each { |c|
|
57
|
+
klass = RubyXL.const_get(c)
|
58
|
+
|
59
|
+
if klass.is_a?(Class) && klass.const_defined?(:REL_TYPE) then
|
60
|
+
@@rel_hash[klass::REL_TYPE] = klass
|
61
|
+
end
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
@@rel_hash[rel_type]
|
66
|
+
end
|
67
|
+
|
68
|
+
def load_related_files(zipdir_path, base_file_name = '')
|
69
|
+
self.related_files = {}
|
70
|
+
|
71
|
+
@@debug +=2 if @@debug
|
72
|
+
|
73
|
+
self.relationships.each { |rel|
|
74
|
+
next if rel.target_mode == 'External'
|
75
|
+
|
76
|
+
file_path = Pathname.new(rel.target)
|
77
|
+
|
78
|
+
if !file_path.absolute? then
|
79
|
+
file_path = (Pathname.new(File.dirname(base_file_name)) + file_path).cleanpath
|
80
|
+
end
|
81
|
+
|
82
|
+
klass = RubyXL::OOXMLRelationshipsFile.get_class_by_rel_type(rel.type)
|
83
|
+
|
84
|
+
if klass.nil? then
|
85
|
+
puts "*** WARNING: storage class not found for #{rel.target} (#{rel.type})"
|
86
|
+
klass = GenericStorageObject
|
87
|
+
end
|
88
|
+
|
89
|
+
puts "--> DEBUG:#{' ' * @@debug}Loading #{klass} (#{rel.id}): #{file_path}" if @@debug
|
90
|
+
|
91
|
+
obj = klass.parse_file(zipdir_path, file_path)
|
92
|
+
obj.load_relationships(zipdir_path, file_path) if obj.respond_to?(:load_relationships)
|
93
|
+
self.related_files[rel.id] = obj
|
94
|
+
}
|
95
|
+
|
96
|
+
@@debug -=2 if @@debug
|
97
|
+
|
98
|
+
related_files
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.load_relationship_file(zipdir_path, base_file_path)
|
102
|
+
rel_file_path = Pathname.new(File.join(File.dirname(base_file_path), '_rels', File.basename(base_file_path) + '.rels')).cleanpath
|
103
|
+
|
104
|
+
puts "--> DEBUG: #{' ' * @@debug}Loading .rel file: #{rel_file_path}" if @@debug
|
105
|
+
|
106
|
+
parse_file(zipdir_path, rel_file_path)
|
107
|
+
end
|
108
|
+
|
109
|
+
def xlsx_path
|
110
|
+
file_path = owner.xlsx_path
|
111
|
+
File.join(File.dirname(file_path), '_rels', File.basename(file_path) + '.rels')
|
112
|
+
end
|
44
113
|
|
114
|
+
end
|
115
|
+
|
45
116
|
class WorkbookRelationships < OOXMLRelationshipsFile
|
46
117
|
|
47
118
|
attr_accessor :workbook
|
@@ -50,51 +121,96 @@ module RubyXL
|
|
50
121
|
self.relationships = []
|
51
122
|
|
52
123
|
@workbook.worksheets.each_with_index { |sheet, i|
|
53
|
-
relationships <<
|
124
|
+
relationships << new_relationship(sheet.xlsx_path.gsub(/\Axl\//, ''), sheet.class::REL_TYPE)
|
54
125
|
}
|
55
126
|
|
56
|
-
@workbook.external_links.each_key { |k|
|
57
|
-
relationships <<
|
58
|
-
}
|
127
|
+
# @workbook.external_links.each_key { |k|
|
128
|
+
# relationships << new_relationship("externalLinks/#{k}", 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink')
|
129
|
+
# }
|
59
130
|
|
60
|
-
relationships <<
|
61
|
-
relationships <<
|
131
|
+
relationships << new_relationship('theme/theme1.xml', @workbook.theme.class::REL_TYPE) if @workbook.theme
|
132
|
+
relationships << new_relationship('styles.xml', @workbook.stylesheet.class::REL_TYPE) if @workbook.stylesheet
|
62
133
|
|
63
134
|
if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then
|
64
|
-
relationships <<
|
135
|
+
relationships << new_relationship('sharedStrings.xml', @workbook.shared_strings_container.class::REL_TYPE)
|
65
136
|
end
|
66
137
|
|
67
138
|
if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then
|
68
|
-
relationships <<
|
139
|
+
relationships << new_relationship('calcChain.xml', @workbook.calculation_chain.class::REL_TYPE)
|
69
140
|
end
|
70
141
|
|
71
142
|
true
|
72
143
|
end
|
73
144
|
|
74
|
-
def self.xlsx_path
|
75
|
-
File.join('xl', '_rels', 'workbook.xml.rels')
|
76
|
-
end
|
77
|
-
|
78
145
|
end
|
79
146
|
|
80
147
|
class RootRelationships < OOXMLRelationshipsFile
|
81
148
|
|
82
|
-
attr_accessor :workbook
|
83
|
-
|
84
149
|
def before_write_xml
|
85
150
|
self.relationships = []
|
86
151
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
152
|
+
add_relationship(owner.workbook)
|
153
|
+
add_relationship(owner.thumbnail)
|
154
|
+
add_relationship(owner.core_properties)
|
155
|
+
add_relationship(owner.document_properties)
|
91
156
|
|
92
157
|
true
|
93
158
|
end
|
94
159
|
|
95
|
-
def
|
160
|
+
def xlsx_path
|
96
161
|
File.join('_rels', '.rels')
|
97
162
|
end
|
98
163
|
end
|
99
164
|
|
165
|
+
class SheetRelationshipsFile < OOXMLRelationshipsFile
|
166
|
+
# Insert class specific stuff here once we get to implementing it
|
167
|
+
end
|
168
|
+
|
169
|
+
class DrawingRelationshipsFile < OOXMLRelationshipsFile
|
170
|
+
# Insert class specific stuff here once we get to implementing it
|
171
|
+
end
|
172
|
+
|
173
|
+
class ChartRelationshipsFile < OOXMLRelationshipsFile
|
174
|
+
# Insert class specific stuff here once we get to implementing it
|
175
|
+
end
|
176
|
+
|
177
|
+
module RelationshipSupport
|
178
|
+
|
179
|
+
attr_accessor :generic_storage, :relationship_container
|
180
|
+
def related_objects # Override this method
|
181
|
+
[]
|
182
|
+
end
|
183
|
+
|
184
|
+
def collect_related_objects
|
185
|
+
res = related_objects.compact # Avoid tainting +related_objects+ array
|
186
|
+
|
187
|
+
res += generic_storage if generic_storage
|
188
|
+
|
189
|
+
if relationship_container then
|
190
|
+
relationship_container.owner = self
|
191
|
+
res << relationship_container
|
192
|
+
end
|
193
|
+
|
194
|
+
res.each { |o| res += o.collect_related_objects if o.respond_to?(:collect_related_objects) }
|
195
|
+
|
196
|
+
res
|
197
|
+
end
|
198
|
+
|
199
|
+
def store_relationship(related_file, unknown = false)
|
200
|
+
self.generic_storage ||= []
|
201
|
+
puts "WARNING: #{self.class} is not aware what to do with #{related_file.class}" if unknown
|
202
|
+
self.generic_storage << related_file
|
203
|
+
end
|
204
|
+
|
205
|
+
def load_relationships(dir_path, base_file_name = '')
|
206
|
+
self.relationship_container = relationship_file_class.load_relationship_file(dir_path, base_file_name)
|
207
|
+
return if relationship_container.nil?
|
208
|
+
|
209
|
+
relationship_container.load_related_files(dir_path, base_file_name).each_pair { |rid, related_file|
|
210
|
+
attach_relationship(rid, related_file) if related_file
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
100
216
|
end
|