rubyXL 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -1
- data/VERSION +1 -1
- data/lib/rubyXL.rb +6 -1
- data/lib/rubyXL/objects/border.rb +13 -31
- data/lib/rubyXL/objects/calculation_chain.rb +31 -31
- data/lib/rubyXL/objects/cell_style.rb +65 -79
- data/lib/rubyXL/objects/chartsheet.rb +85 -85
- data/lib/rubyXL/objects/column_range.rb +40 -40
- data/lib/rubyXL/objects/comments.rb +21 -21
- data/lib/rubyXL/objects/content_types.rb +69 -78
- data/lib/rubyXL/objects/data_validation.rb +37 -37
- data/lib/rubyXL/objects/document_properties.rb +157 -157
- data/lib/rubyXL/objects/extensions.rb +17 -17
- data/lib/rubyXL/objects/fill.rb +48 -48
- data/lib/rubyXL/objects/filters.rb +119 -119
- data/lib/rubyXL/objects/font.rb +0 -10
- data/lib/rubyXL/objects/formula.rb +24 -24
- data/lib/rubyXL/objects/ooxml_object.rb +443 -456
- data/lib/rubyXL/objects/reference.rb +110 -110
- data/lib/rubyXL/objects/relationships.rb +3 -10
- data/lib/rubyXL/objects/root.rb +81 -81
- data/lib/rubyXL/objects/shared_strings.rb +60 -60
- data/lib/rubyXL/objects/sheet_common.rb +51 -51
- data/lib/rubyXL/objects/sheet_data.rb +173 -173
- data/lib/rubyXL/objects/simple_types.rb +229 -229
- data/lib/rubyXL/objects/storage.rb +141 -158
- data/lib/rubyXL/objects/stylesheet.rb +57 -57
- data/lib/rubyXL/objects/text.rb +87 -87
- data/lib/rubyXL/objects/theme.rb +21 -21
- data/lib/rubyXL/objects/workbook.rb +3 -3
- data/lib/rubyXL/objects/worksheet.rb +724 -723
- data/lib/rubyXL/parser.rb +0 -1
- data/lib/rubyXL/workbook.rb +1 -2
- data/rdoc/README_rdoc.html +6 -3
- data/rdoc/RubyXL.html +53 -1
- data/rdoc/RubyXL/AExtension.html +1 -1
- data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/AdjustHandleList.html +1 -1
- data/rdoc/RubyXL/Alignment.html +1 -1
- data/rdoc/RubyXL/AlternateContent.html +1 -1
- data/rdoc/RubyXL/Authors.html +1 -1
- data/rdoc/RubyXL/AutoFilter.html +1 -1
- data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
- data/rdoc/RubyXL/BinaryImageFile.html +1 -1
- data/rdoc/RubyXL/BodyProperties.html +1 -1
- data/rdoc/RubyXL/BooleanNode.html +1 -1
- data/rdoc/RubyXL/BooleanValue.html +1 -1
- data/rdoc/RubyXL/Border.html +1 -1
- data/rdoc/RubyXL/BorderEdge.html +1 -52
- 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 +3 -3
- data/rdoc/RubyXL/CalculationChainCell.html +1 -1
- data/rdoc/RubyXL/CalculationProperties.html +1 -1
- data/rdoc/RubyXL/Cell.html +36 -36
- 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 +4 -4
- data/rdoc/RubyXL/CellWatch.html +1 -1
- data/rdoc/RubyXL/CellWatches.html +1 -1
- data/rdoc/RubyXL/CellXFs.html +1 -1
- data/rdoc/RubyXL/ChartColorsFile.html +1 -1
- data/rdoc/RubyXL/ChartFile.html +1 -1
- data/rdoc/RubyXL/ChartStyleFile.html +1 -1
- data/rdoc/RubyXL/ChartUserShapesFile.html +1 -1
- data/rdoc/RubyXL/Chartsheet.html +1 -1
- data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
- data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
- data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
- data/rdoc/RubyXL/ChartsheetView.html +1 -1
- data/rdoc/RubyXL/ChartsheetViews.html +1 -1
- data/rdoc/RubyXL/Color.html +1 -1
- data/rdoc/RubyXL/ColorFilter.html +1 -1
- data/rdoc/RubyXL/ColorScale.html +1 -1
- data/rdoc/RubyXL/ColorSet.html +1 -1
- data/rdoc/RubyXL/Colors.html +1 -1
- data/rdoc/RubyXL/ColumnRange.html +1 -1
- data/rdoc/RubyXL/ColumnRanges.html +22 -22
- data/rdoc/RubyXL/Comment.html +1 -1
- data/rdoc/RubyXL/CommentList.html +1 -1
- data/rdoc/RubyXL/CommentsFile.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
- data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
- data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
- data/rdoc/RubyXL/ContentTypeDefault.html +1 -1
- data/rdoc/RubyXL/ContentTypeOverride.html +1 -1
- data/rdoc/RubyXL/ContentTypes.html +47 -91
- data/rdoc/RubyXL/ControlPropertiesFile.html +1 -1
- data/rdoc/RubyXL/CorePropertiesFile.html +1 -1
- data/rdoc/RubyXL/CustomColor.html +1 -1
- data/rdoc/RubyXL/CustomColorList.html +1 -1
- data/rdoc/RubyXL/CustomFilter.html +1 -1
- data/rdoc/RubyXL/CustomFilters.html +1 -1
- data/rdoc/RubyXL/CustomGeometry.html +1 -1
- data/rdoc/RubyXL/CustomProperties.html +1 -1
- data/rdoc/RubyXL/CustomPropertiesFile.html +1 -1
- data/rdoc/RubyXL/CustomProperty.html +1 -1
- data/rdoc/RubyXL/CustomSheetView.html +1 -1
- data/rdoc/RubyXL/CustomSheetViews.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
- data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
- data/rdoc/RubyXL/CustomXMLFile.html +1 -1
- data/rdoc/RubyXL/DXF.html +1 -1
- data/rdoc/RubyXL/DXFs.html +1 -1
- data/rdoc/RubyXL/DataBar.html +1 -1
- data/rdoc/RubyXL/DataConsolidate.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
- data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
- data/rdoc/RubyXL/DataType.html +1 -1
- data/rdoc/RubyXL/DataValidation.html +1 -1
- data/rdoc/RubyXL/DataValidations.html +2 -2
- data/rdoc/RubyXL/DateGroupItem.html +1 -1
- data/rdoc/RubyXL/DefinedName.html +1 -1
- data/rdoc/RubyXL/DefinedNames.html +1 -1
- data/rdoc/RubyXL/DocumentPropertiesFile.html +28 -28
- data/rdoc/RubyXL/DrawingFile.html +1 -86
- data/rdoc/RubyXL/DynamicFilter.html +1 -1
- data/rdoc/RubyXL/EmbeddedControl.html +1 -1
- data/rdoc/RubyXL/EmbeddedControls.html +1 -1
- data/rdoc/RubyXL/Extension.html +1 -1
- data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
- data/rdoc/RubyXL/Extents.html +1 -1
- data/rdoc/RubyXL/ExternalLinksFile.html +1 -1
- data/rdoc/RubyXL/ExternalReference.html +1 -1
- data/rdoc/RubyXL/ExternalReferences.html +1 -1
- data/rdoc/RubyXL/ExtraColorSchemeList.html +1 -1
- data/rdoc/RubyXL/FieldItem.html +1 -1
- data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
- data/rdoc/RubyXL/FileSharing.html +1 -1
- data/rdoc/RubyXL/FileVersion.html +1 -1
- data/rdoc/RubyXL/Fill.html +1 -1
- data/rdoc/RubyXL/Fills.html +1 -1
- data/rdoc/RubyXL/FilterContainer.html +1 -1
- data/rdoc/RubyXL/FloatNode.html +1 -1
- data/rdoc/RubyXL/FloatValue.html +1 -1
- data/rdoc/RubyXL/Font.html +15 -56
- 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 +14 -31
- data/rdoc/RubyXL/GradientFill.html +1 -1
- data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
- data/rdoc/RubyXL/Hyperlink.html +1 -1
- data/rdoc/RubyXL/HyperlinkRelFile.html +1 -1
- data/rdoc/RubyXL/Hyperlinks.html +1 -1
- data/rdoc/RubyXL/IconFilter.html +1 -1
- data/rdoc/RubyXL/IconSet.html +1 -1
- data/rdoc/RubyXL/IgnoredError.html +1 -1
- data/rdoc/RubyXL/IgnoredErrors.html +1 -1
- data/rdoc/RubyXL/IndexedColors.html +1 -1
- data/rdoc/RubyXL/InputCells.html +1 -1
- data/rdoc/RubyXL/IntegerNode.html +1 -1
- data/rdoc/RubyXL/IntegerValue.html +1 -1
- data/rdoc/RubyXL/LegacyCell.html +1 -1
- data/rdoc/RubyXL/LegacyWorkbook.html +22 -22
- data/rdoc/RubyXL/LegacyWorksheet.html +1 -1
- data/rdoc/RubyXL/MRUColors.html +1 -1
- data/rdoc/RubyXL/MacrosFile.html +1 -1
- data/rdoc/RubyXL/MergedCell.html +1 -1
- data/rdoc/RubyXL/MergedCells.html +1 -1
- data/rdoc/RubyXL/NumFmt.html +1 -1
- data/rdoc/RubyXL/NumberFormat.html +2 -2
- 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 +99 -99
- data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
- data/rdoc/RubyXL/OOXMLRelationshipsFile.html +12 -19
- 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 +4 -4
- data/rdoc/RubyXL/PatternFill.html +1 -1
- data/rdoc/RubyXL/PhoneticProperties.html +1 -1
- data/rdoc/RubyXL/PhoneticRun.html +1 -1
- data/rdoc/RubyXL/PivotArea.html +1 -1
- data/rdoc/RubyXL/PivotCache.html +1 -1
- data/rdoc/RubyXL/PivotCacheDefinitionFile.html +1 -1
- data/rdoc/RubyXL/PivotCaches.html +1 -1
- data/rdoc/RubyXL/PivotReference.html +1 -1
- data/rdoc/RubyXL/PivotReferences.html +1 -1
- data/rdoc/RubyXL/PivotTableFile.html +1 -1
- data/rdoc/RubyXL/PivotTableSelection.html +1 -1
- data/rdoc/RubyXL/PresetGeometry.html +1 -1
- data/rdoc/RubyXL/PrintOptions.html +1 -1
- data/rdoc/RubyXL/PrinterSettingsFile.html +1 -20
- 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 +60 -60
- data/rdoc/RubyXL/Relationship.html +1 -1
- data/rdoc/RubyXL/RelationshipSupport.html +1 -1
- data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +1 -1
- data/rdoc/RubyXL/RichText.html +1 -1
- data/rdoc/RubyXL/RichTextRun.html +1 -1
- data/rdoc/RubyXL/Row.html +1 -1
- data/rdoc/RubyXL/RunProperties.html +1 -1
- data/rdoc/RubyXL/Scenario.html +2 -2
- 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 +25 -25
- data/rdoc/RubyXL/Sheet.html +1 -1
- data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
- data/rdoc/RubyXL/SheetData.html +1 -1
- data/rdoc/RubyXL/Sheets.html +1 -1
- data/rdoc/RubyXL/SlicerCacheFile.html +1 -1
- data/rdoc/RubyXL/SlicerFile.html +1 -1
- data/rdoc/RubyXL/SmartTagProperties.html +1 -1
- data/rdoc/RubyXL/SmartTagType.html +1 -1
- data/rdoc/RubyXL/SmartTagTypes.html +1 -1
- data/rdoc/RubyXL/SmartTags.html +1 -1
- data/rdoc/RubyXL/SortCondition.html +1 -1
- data/rdoc/RubyXL/SortState.html +1 -1
- data/rdoc/RubyXL/Sqref.html +5 -5
- data/rdoc/RubyXL/Stop.html +1 -1
- data/rdoc/RubyXL/StringNode.html +1 -1
- data/rdoc/RubyXL/StringNodeW3C.html +1 -1
- data/rdoc/RubyXL/StringValue.html +1 -1
- data/rdoc/RubyXL/Stylesheet.html +1 -1
- data/rdoc/RubyXL/TableFile.html +1 -1
- data/rdoc/RubyXL/TableParts.html +1 -1
- data/rdoc/RubyXL/TableStyle.html +1 -1
- data/rdoc/RubyXL/TableStyles.html +1 -1
- data/rdoc/RubyXL/Text.html +6 -6
- data/rdoc/RubyXL/Theme.html +1 -1
- data/rdoc/RubyXL/ThemeElements.html +1 -1
- data/rdoc/RubyXL/ThumbnailFile.html +1 -1
- data/rdoc/RubyXL/Top10.html +1 -1
- data/rdoc/RubyXL/VMLDrawingFile.html +1 -1
- data/rdoc/RubyXL/Variant.html +1 -1
- data/rdoc/RubyXL/Vector.html +1 -1
- data/rdoc/RubyXL/VectorValue.html +1 -1
- data/rdoc/RubyXL/VisualProperties.html +1 -1
- data/rdoc/RubyXL/WebPublishObject.html +1 -1
- data/rdoc/RubyXL/WebPublishObjects.html +1 -1
- data/rdoc/RubyXL/WebPublishingItem.html +1 -1
- data/rdoc/RubyXL/WebPublishingItems.html +1 -1
- data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
- data/rdoc/RubyXL/Workbook.html +1 -1
- data/rdoc/RubyXL/WorkbookProperties.html +1 -1
- data/rdoc/RubyXL/WorkbookProtection.html +1 -1
- data/rdoc/RubyXL/WorkbookRoot.html +46 -46
- 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 +37 -37
- data/rdoc/index.html +2 -8
- data/rdoc/js/search_index.js +1 -1
- data/rdoc/table_of_contents.html +77 -101
- data/rubyXL.gemspec +4 -4
- metadata +3 -3
@@ -17,20 +17,20 @@ module RubyXL
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_ext-1.html
|
21
|
-
class Extension < RawOOXML
|
22
|
-
define_attribute(:uri, :string)
|
23
|
-
define_element_name 'ext'
|
24
|
-
end
|
25
|
-
|
26
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_extLst-1.html
|
27
|
-
class ExtensionStorageArea < OOXMLObject
|
28
|
-
define_child_node(RubyXL::Extension, :collection => true)
|
29
|
-
define_element_name 'extLst'
|
30
|
-
end
|
31
|
-
|
32
|
-
class AlternateContent < RawOOXML
|
33
|
-
define_element_name 'mc:AlternateContent'
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
20
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_ext-1.html
|
21
|
+
class Extension < RawOOXML
|
22
|
+
define_attribute(:uri, :string)
|
23
|
+
define_element_name 'ext'
|
24
|
+
end
|
25
|
+
|
26
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_extLst-1.html
|
27
|
+
class ExtensionStorageArea < OOXMLObject
|
28
|
+
define_child_node(RubyXL::Extension, :collection => true)
|
29
|
+
define_element_name 'extLst'
|
30
|
+
end
|
31
|
+
|
32
|
+
class AlternateContent < RawOOXML
|
33
|
+
define_element_name 'mc:AlternateContent'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/lib/rubyXL/objects/fill.rb
CHANGED
@@ -3,51 +3,51 @@ require 'rubyXL/objects/simple_types'
|
|
3
3
|
|
4
4
|
module RubyXL
|
5
5
|
|
6
|
-
# http://www.datypic.com/sc/ooxml/e-ssml_stop-1.html
|
7
|
-
class Stop < OOXMLObject
|
8
|
-
define_attribute(:position, :double, :required => true)
|
9
|
-
define_child_node(RubyXL::Color)
|
10
|
-
define_element_name 'stop'
|
11
|
-
end
|
12
|
-
|
13
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_patternFill-1.html
|
14
|
-
class PatternFill < OOXMLObject
|
15
|
-
define_attribute(:patternType, RubyXL::ST_PatternType)
|
16
|
-
define_child_node(RubyXL::Color, :node_name => :fgColor )
|
17
|
-
define_child_node(RubyXL::Color, :node_name => :bgColor )
|
18
|
-
define_element_name 'patternFill'
|
19
|
-
end
|
20
|
-
|
21
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_gradientFill-1.html
|
22
|
-
class GradientFill < OOXMLObject
|
23
|
-
define_attribute(:type, RubyXL::ST_GradientType, :default => 'linear')
|
24
|
-
define_attribute(:degree, :double, :default => 0)
|
25
|
-
define_attribute(:left, :double, :default => 0)
|
26
|
-
define_attribute(:right, :double, :default => 0)
|
27
|
-
define_attribute(:top, :double, :default => 0)
|
28
|
-
define_attribute(:bottom, :double, :default => 0)
|
29
|
-
define_child_node(RubyXL::Stop, :collection => true)
|
30
|
-
define_element_name 'gradientFill'
|
31
|
-
end
|
32
|
-
|
33
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_fill-1.html
|
34
|
-
class Fill < OOXMLObject
|
35
|
-
define_child_node(RubyXL::PatternFill)
|
36
|
-
define_child_node(RubyXL::GradientFill)
|
37
|
-
define_element_name 'fill'
|
38
|
-
end
|
39
|
-
|
40
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_fills-1.html
|
41
|
-
class Fills < OOXMLContainerObject
|
42
|
-
define_child_node(RubyXL::Fill, :collection => :with_count)
|
43
|
-
define_element_name 'fills'
|
44
|
-
|
45
|
-
def self.defaults
|
46
|
-
self.new(:_ => [
|
47
|
-
RubyXL::Fill.new(:pattern_fill => RubyXL::PatternFill.new(:pattern_type => 'none')),
|
48
|
-
RubyXL::Fill.new(:pattern_fill => RubyXL::PatternFill.new(:pattern_type => 'gray125'))
|
49
|
-
])
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
6
|
+
# http://www.datypic.com/sc/ooxml/e-ssml_stop-1.html
|
7
|
+
class Stop < OOXMLObject
|
8
|
+
define_attribute(:position, :double, :required => true)
|
9
|
+
define_child_node(RubyXL::Color)
|
10
|
+
define_element_name 'stop'
|
11
|
+
end
|
12
|
+
|
13
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_patternFill-1.html
|
14
|
+
class PatternFill < OOXMLObject
|
15
|
+
define_attribute(:patternType, RubyXL::ST_PatternType)
|
16
|
+
define_child_node(RubyXL::Color, :node_name => :fgColor )
|
17
|
+
define_child_node(RubyXL::Color, :node_name => :bgColor )
|
18
|
+
define_element_name 'patternFill'
|
19
|
+
end
|
20
|
+
|
21
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_gradientFill-1.html
|
22
|
+
class GradientFill < OOXMLObject
|
23
|
+
define_attribute(:type, RubyXL::ST_GradientType, :default => 'linear')
|
24
|
+
define_attribute(:degree, :double, :default => 0)
|
25
|
+
define_attribute(:left, :double, :default => 0)
|
26
|
+
define_attribute(:right, :double, :default => 0)
|
27
|
+
define_attribute(:top, :double, :default => 0)
|
28
|
+
define_attribute(:bottom, :double, :default => 0)
|
29
|
+
define_child_node(RubyXL::Stop, :collection => true)
|
30
|
+
define_element_name 'gradientFill'
|
31
|
+
end
|
32
|
+
|
33
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_fill-1.html
|
34
|
+
class Fill < OOXMLObject
|
35
|
+
define_child_node(RubyXL::PatternFill)
|
36
|
+
define_child_node(RubyXL::GradientFill)
|
37
|
+
define_element_name 'fill'
|
38
|
+
end
|
39
|
+
|
40
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_fills-1.html
|
41
|
+
class Fills < OOXMLContainerObject
|
42
|
+
define_child_node(RubyXL::Fill, :collection => :with_count)
|
43
|
+
define_element_name 'fills'
|
44
|
+
|
45
|
+
def self.defaults
|
46
|
+
self.new(:_ => [
|
47
|
+
RubyXL::Fill.new(:pattern_fill => RubyXL::PatternFill.new(:pattern_type => 'none')),
|
48
|
+
RubyXL::Fill.new(:pattern_fill => RubyXL::PatternFill.new(:pattern_type => 'gray125'))
|
49
|
+
])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -1,120 +1,120 @@
|
|
1
|
-
require 'rubyXL/objects/ooxml_object'
|
2
|
-
require 'rubyXL/objects/simple_types'
|
3
|
-
require 'rubyXL/objects/extensions'
|
4
|
-
|
5
|
-
module RubyXL
|
6
|
-
|
7
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_dateGroupItem-1.html
|
8
|
-
class DateGroupItem < OOXMLObject
|
9
|
-
define_attribute(:year, :int, :required => true)
|
10
|
-
define_attribute(:month, :int)
|
11
|
-
define_attribute(:day, :int)
|
12
|
-
define_attribute(:hour, :int)
|
13
|
-
define_attribute(:minute, :int)
|
14
|
-
define_attribute(:second, :int)
|
15
|
-
define_attribute(:dateTimeGrouping, RubyXL::ST_DateTimeGrouping)
|
16
|
-
define_element_name 'dateGroupItem'
|
17
|
-
end
|
18
|
-
|
19
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_filters-1.html
|
20
|
-
class FilterContainer < OOXMLObject
|
21
|
-
define_attribute(:blank, :bool, :default => false)
|
22
|
-
define_attribute(:calendarType, RubyXL::ST_CalendarType, :default => 'none')
|
23
|
-
define_child_node(RubyXL::StringValue, :collection => true, :accessor => :filters, :node_name => :filter)
|
24
|
-
define_child_node(RubyXL::DateGroupItem, :collection => true, :accessor => :date_group_items)
|
25
|
-
define_element_name 'filters'
|
26
|
-
end
|
27
|
-
|
28
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_top10-1.html
|
29
|
-
class Top10 < OOXMLObject
|
30
|
-
define_attribute(:top, :bool, :default => true)
|
31
|
-
define_attribute(:percent, :bool, :default => false)
|
32
|
-
define_attribute(:val, :double, :required => true)
|
33
|
-
define_attribute(:filterVal, :double)
|
34
|
-
define_element_name 'top10'
|
35
|
-
end
|
36
|
-
|
37
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_customFilter-1.html
|
38
|
-
class CustomFilter < OOXMLObject
|
39
|
-
define_attribute(:operator, RubyXL::ST_FilterOperator, :default => 'equal')
|
40
|
-
define_attribute(:val, :string)
|
41
|
-
define_element_name 'customFilter'
|
42
|
-
end
|
43
|
-
|
44
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_customFilters-1.html
|
45
|
-
class CustomFilters < OOXMLContainerObject
|
46
|
-
define_attribute(:and, :bool, :default => false)
|
47
|
-
define_child_node(RubyXL::CustomFilter, :collection => true)
|
48
|
-
define_element_name 'customFilters'
|
49
|
-
end
|
50
|
-
|
51
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_dynamicFilter-1.html
|
52
|
-
class DynamicFilter < OOXMLObject
|
53
|
-
define_attribute(:type, RubyXL::ST_DynamicFilterType, :required => true)
|
54
|
-
define_attribute(:val, :double)
|
55
|
-
define_attribute(:maxVal, :double)
|
56
|
-
define_element_name 'dynamicFilter'
|
57
|
-
end
|
58
|
-
|
59
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_colorFilter-1.html
|
60
|
-
class ColorFilter < OOXMLObject
|
61
|
-
define_attribute(:dxfId, :string)
|
62
|
-
define_attribute(:cellColor, :bool)
|
63
|
-
define_element_name 'colorFilter'
|
64
|
-
end
|
65
|
-
|
66
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_iconFilter-1.html
|
67
|
-
class IconFilter < OOXMLObject
|
68
|
-
define_attribute(:iconSet, RubyXL::ST_IconSetType)
|
69
|
-
define_attribute(:iconId, :int)
|
70
|
-
define_element_name 'iconFilter'
|
71
|
-
end
|
72
|
-
|
73
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_filterColumn-1.html
|
74
|
-
class AutoFilterColumn < OOXMLObject
|
75
|
-
define_attribute(:colId, :int, :required => true)
|
76
|
-
define_attribute(:hiddenButton, :bool, :default => false)
|
77
|
-
define_attribute(:showButton, :bool, :default => true)
|
78
|
-
define_child_node(RubyXL::FilterContainer)
|
79
|
-
define_child_node(RubyXL::Top10)
|
80
|
-
define_child_node(RubyXL::CustomFilters)
|
81
|
-
define_child_node(RubyXL::DynamicFilter)
|
82
|
-
define_child_node(RubyXL::ColorFilter)
|
83
|
-
define_child_node(RubyXL::IconFilter)
|
84
|
-
define_child_node(RubyXL::ExtensionStorageArea)
|
85
|
-
define_element_name 'filterColumn'
|
86
|
-
end
|
87
|
-
|
88
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_sortCondition-1.html
|
89
|
-
class SortCondition < OOXMLObject
|
90
|
-
define_attribute(:descending, :bool, :default => false)
|
91
|
-
define_attribute(:sortBy, RubyXL::ST_SortBy, :default => 'value')
|
92
|
-
define_attribute(:ref, :ref, :required => true)
|
93
|
-
define_attribute(:customList, :string)
|
94
|
-
define_attribute(:dxfId, :int)
|
95
|
-
define_attribute(:iconSet, RubyXL::ST_IconSetType, :required => true, :default => '3Arrows')
|
96
|
-
define_attribute(:iconId, :int)
|
97
|
-
define_element_name 'sortCondition'
|
98
|
-
end
|
99
|
-
|
100
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_sortState-2.html
|
101
|
-
class SortState < OOXMLObject
|
102
|
-
define_attribute(:columnSort, :bool, :default => false)
|
103
|
-
define_attribute(:caseSensitive, :bool, :default => false)
|
104
|
-
define_attribute(:sortMethod, RubyXL::ST_SortMethod, :default => 'none')
|
105
|
-
define_attribute(:ref, :ref, :required => true)
|
106
|
-
define_child_node(RubyXL::SortCondition, :collection => true)
|
107
|
-
define_child_node(RubyXL::ExtensionStorageArea)
|
108
|
-
define_element_name 'sortState'
|
109
|
-
end
|
110
|
-
|
111
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_autoFilter-2.html
|
112
|
-
class AutoFilter < OOXMLObject
|
113
|
-
define_attribute(:ref, :ref)
|
114
|
-
define_child_node(RubyXL::AutoFilterColumn)
|
115
|
-
define_child_node(RubyXL::SortState)
|
116
|
-
define_child_node(RubyXL::ExtensionStorageArea)
|
117
|
-
define_element_name 'autoFilter'
|
118
|
-
end
|
119
|
-
|
1
|
+
require 'rubyXL/objects/ooxml_object'
|
2
|
+
require 'rubyXL/objects/simple_types'
|
3
|
+
require 'rubyXL/objects/extensions'
|
4
|
+
|
5
|
+
module RubyXL
|
6
|
+
|
7
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_dateGroupItem-1.html
|
8
|
+
class DateGroupItem < OOXMLObject
|
9
|
+
define_attribute(:year, :int, :required => true)
|
10
|
+
define_attribute(:month, :int)
|
11
|
+
define_attribute(:day, :int)
|
12
|
+
define_attribute(:hour, :int)
|
13
|
+
define_attribute(:minute, :int)
|
14
|
+
define_attribute(:second, :int)
|
15
|
+
define_attribute(:dateTimeGrouping, RubyXL::ST_DateTimeGrouping)
|
16
|
+
define_element_name 'dateGroupItem'
|
17
|
+
end
|
18
|
+
|
19
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_filters-1.html
|
20
|
+
class FilterContainer < OOXMLObject
|
21
|
+
define_attribute(:blank, :bool, :default => false)
|
22
|
+
define_attribute(:calendarType, RubyXL::ST_CalendarType, :default => 'none')
|
23
|
+
define_child_node(RubyXL::StringValue, :collection => true, :accessor => :filters, :node_name => :filter)
|
24
|
+
define_child_node(RubyXL::DateGroupItem, :collection => true, :accessor => :date_group_items)
|
25
|
+
define_element_name 'filters'
|
26
|
+
end
|
27
|
+
|
28
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_top10-1.html
|
29
|
+
class Top10 < OOXMLObject
|
30
|
+
define_attribute(:top, :bool, :default => true)
|
31
|
+
define_attribute(:percent, :bool, :default => false)
|
32
|
+
define_attribute(:val, :double, :required => true)
|
33
|
+
define_attribute(:filterVal, :double)
|
34
|
+
define_element_name 'top10'
|
35
|
+
end
|
36
|
+
|
37
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_customFilter-1.html
|
38
|
+
class CustomFilter < OOXMLObject
|
39
|
+
define_attribute(:operator, RubyXL::ST_FilterOperator, :default => 'equal')
|
40
|
+
define_attribute(:val, :string)
|
41
|
+
define_element_name 'customFilter'
|
42
|
+
end
|
43
|
+
|
44
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_customFilters-1.html
|
45
|
+
class CustomFilters < OOXMLContainerObject
|
46
|
+
define_attribute(:and, :bool, :default => false)
|
47
|
+
define_child_node(RubyXL::CustomFilter, :collection => true)
|
48
|
+
define_element_name 'customFilters'
|
49
|
+
end
|
50
|
+
|
51
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_dynamicFilter-1.html
|
52
|
+
class DynamicFilter < OOXMLObject
|
53
|
+
define_attribute(:type, RubyXL::ST_DynamicFilterType, :required => true)
|
54
|
+
define_attribute(:val, :double)
|
55
|
+
define_attribute(:maxVal, :double)
|
56
|
+
define_element_name 'dynamicFilter'
|
57
|
+
end
|
58
|
+
|
59
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_colorFilter-1.html
|
60
|
+
class ColorFilter < OOXMLObject
|
61
|
+
define_attribute(:dxfId, :string)
|
62
|
+
define_attribute(:cellColor, :bool)
|
63
|
+
define_element_name 'colorFilter'
|
64
|
+
end
|
65
|
+
|
66
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_iconFilter-1.html
|
67
|
+
class IconFilter < OOXMLObject
|
68
|
+
define_attribute(:iconSet, RubyXL::ST_IconSetType)
|
69
|
+
define_attribute(:iconId, :int)
|
70
|
+
define_element_name 'iconFilter'
|
71
|
+
end
|
72
|
+
|
73
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_filterColumn-1.html
|
74
|
+
class AutoFilterColumn < OOXMLObject
|
75
|
+
define_attribute(:colId, :int, :required => true)
|
76
|
+
define_attribute(:hiddenButton, :bool, :default => false)
|
77
|
+
define_attribute(:showButton, :bool, :default => true)
|
78
|
+
define_child_node(RubyXL::FilterContainer)
|
79
|
+
define_child_node(RubyXL::Top10)
|
80
|
+
define_child_node(RubyXL::CustomFilters)
|
81
|
+
define_child_node(RubyXL::DynamicFilter)
|
82
|
+
define_child_node(RubyXL::ColorFilter)
|
83
|
+
define_child_node(RubyXL::IconFilter)
|
84
|
+
define_child_node(RubyXL::ExtensionStorageArea)
|
85
|
+
define_element_name 'filterColumn'
|
86
|
+
end
|
87
|
+
|
88
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_sortCondition-1.html
|
89
|
+
class SortCondition < OOXMLObject
|
90
|
+
define_attribute(:descending, :bool, :default => false)
|
91
|
+
define_attribute(:sortBy, RubyXL::ST_SortBy, :default => 'value')
|
92
|
+
define_attribute(:ref, :ref, :required => true)
|
93
|
+
define_attribute(:customList, :string)
|
94
|
+
define_attribute(:dxfId, :int)
|
95
|
+
define_attribute(:iconSet, RubyXL::ST_IconSetType, :required => true, :default => '3Arrows')
|
96
|
+
define_attribute(:iconId, :int)
|
97
|
+
define_element_name 'sortCondition'
|
98
|
+
end
|
99
|
+
|
100
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_sortState-2.html
|
101
|
+
class SortState < OOXMLObject
|
102
|
+
define_attribute(:columnSort, :bool, :default => false)
|
103
|
+
define_attribute(:caseSensitive, :bool, :default => false)
|
104
|
+
define_attribute(:sortMethod, RubyXL::ST_SortMethod, :default => 'none')
|
105
|
+
define_attribute(:ref, :ref, :required => true)
|
106
|
+
define_child_node(RubyXL::SortCondition, :collection => true)
|
107
|
+
define_child_node(RubyXL::ExtensionStorageArea)
|
108
|
+
define_element_name 'sortState'
|
109
|
+
end
|
110
|
+
|
111
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_autoFilter-2.html
|
112
|
+
class AutoFilter < OOXMLObject
|
113
|
+
define_attribute(:ref, :ref)
|
114
|
+
define_child_node(RubyXL::AutoFilterColumn)
|
115
|
+
define_child_node(RubyXL::SortState)
|
116
|
+
define_child_node(RubyXL::ExtensionStorageArea)
|
117
|
+
define_element_name 'autoFilter'
|
118
|
+
end
|
119
|
+
|
120
120
|
end
|
data/lib/rubyXL/objects/font.rb
CHANGED
@@ -26,16 +26,6 @@ module RubyXL
|
|
26
26
|
define_child_node(RubyXL::StringValue, :node_name => :scheme)
|
27
27
|
define_element_name 'font'
|
28
28
|
|
29
|
-
def ==(other)
|
30
|
-
(!(self.i && self.i.val) == !(other.i && other.i.val)) &&
|
31
|
-
(!(self.b && self.b.val) == !(other.b && other.b.val)) &&
|
32
|
-
(!(self.u && self.u.val) == !(other.u && other.u.val)) &&
|
33
|
-
(!(self.strike && self.strike.val) == !(other.strike && other.strike.val)) &&
|
34
|
-
((self.name && self.name.val) == (other.name && other.name.val)) &&
|
35
|
-
((self.sz && self.sz.val) == (other.sz && other.sz.val)) &&
|
36
|
-
(self.color == other.color) # Need to write proper comparison for color
|
37
|
-
end
|
38
|
-
|
39
29
|
def is_italic
|
40
30
|
i && i.val
|
41
31
|
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require 'rubyXL/objects/ooxml_object'
|
2
|
-
require 'rubyXL/objects/simple_types'
|
3
|
-
|
4
|
-
module RubyXL
|
5
|
-
|
6
|
-
# http://www.schemacentral.com/sc/ooxml/e-ssml_f-1.html
|
7
|
-
class Formula < OOXMLObject
|
8
|
-
define_attribute(:_, :string, :accessor => :expression)
|
9
|
-
define_attribute(:t, RubyXL::ST_CellFormulaType, :default => 'normal')
|
10
|
-
define_attribute(:aca, :bool, :default => false)
|
11
|
-
define_attribute(:ref, :ref)
|
12
|
-
define_attribute(:dt2D, :bool, :default => false)
|
13
|
-
define_attribute(:dtr, :bool, :default => false)
|
14
|
-
define_attribute(:del1, :bool, :default => false)
|
15
|
-
define_attribute(:del2, :bool, :default => false)
|
16
|
-
define_attribute(:r1, :ref)
|
17
|
-
define_attribute(:r2, :ref)
|
18
|
-
define_attribute(:ca, :bool, :default => false)
|
19
|
-
define_attribute(:si, :int)
|
20
|
-
define_attribute(:bx, :bool, :default => false)
|
21
|
-
define_element_name 'f'
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
1
|
+
require 'rubyXL/objects/ooxml_object'
|
2
|
+
require 'rubyXL/objects/simple_types'
|
3
|
+
|
4
|
+
module RubyXL
|
5
|
+
|
6
|
+
# http://www.schemacentral.com/sc/ooxml/e-ssml_f-1.html
|
7
|
+
class Formula < OOXMLObject
|
8
|
+
define_attribute(:_, :string, :accessor => :expression)
|
9
|
+
define_attribute(:t, RubyXL::ST_CellFormulaType, :default => 'normal')
|
10
|
+
define_attribute(:aca, :bool, :default => false)
|
11
|
+
define_attribute(:ref, :ref)
|
12
|
+
define_attribute(:dt2D, :bool, :default => false)
|
13
|
+
define_attribute(:dtr, :bool, :default => false)
|
14
|
+
define_attribute(:del1, :bool, :default => false)
|
15
|
+
define_attribute(:del2, :bool, :default => false)
|
16
|
+
define_attribute(:r1, :ref)
|
17
|
+
define_attribute(:r2, :ref)
|
18
|
+
define_attribute(:ca, :bool, :default => false)
|
19
|
+
define_attribute(:si, :int)
|
20
|
+
define_attribute(:bx, :bool, :default => false)
|
21
|
+
define_element_name 'f'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -1,456 +1,443 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
module RubyXL
|
4
|
-
module OOXMLObjectClassMethods
|
5
|
-
# Get the value of a [sub]class variable if it exists, or create the respective variable
|
6
|
-
# with the passed-in +default+ (or +{}+, if not specified)
|
7
|
-
#
|
8
|
-
# Throughout this class, we are setting class variables through explicit method calls
|
9
|
-
# rather than by directly addressing the name of the variable because of context issues:
|
10
|
-
# addressing variable by name creates it in the context of defining class, while calling
|
11
|
-
# the setter/getter method addresses it in the context of descendant class,
|
12
|
-
# which is what we need.
|
13
|
-
def obtain_class_variable(var_name, default = {})
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# * +
|
24
|
-
# *
|
25
|
-
#
|
26
|
-
# * +:
|
27
|
-
# * +:
|
28
|
-
# * +:
|
29
|
-
# * +:
|
30
|
-
# * +:
|
31
|
-
# *
|
32
|
-
#
|
33
|
-
# *
|
34
|
-
#
|
35
|
-
# * +:
|
36
|
-
# * +:
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# define_attribute(:
|
41
|
-
#
|
42
|
-
# define_attribute(:
|
43
|
-
#
|
44
|
-
# define_attribute(:
|
45
|
-
#
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
attr_hash[:accessor]
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
# * +:
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# * +
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
# define_child_node(RubyXL::
|
68
|
-
# Define
|
69
|
-
# define_child_node(RubyXL::
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# define_child_node(RubyXL::
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
:
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
if node.is_a?(Nokogiri::XML::Document) then
|
112
|
-
@namespaces = node.namespaces
|
113
|
-
node = node.root
|
114
|
-
# ignorable_attr = node.attributes['Ignorable']
|
115
|
-
# @ignorables << ignorable_attr.value if ignorable_attr
|
116
|
-
end
|
117
|
-
|
118
|
-
obj = self.new
|
119
|
-
|
120
|
-
known_attributes = obtain_class_variable(:@@ooxml_attributes)
|
121
|
-
|
122
|
-
content_params = known_attributes['_']
|
123
|
-
process_attribute(obj, node.text, content_params) if content_params
|
124
|
-
|
125
|
-
node.attributes.each_pair { |attr_name, attr|
|
126
|
-
attr_name = if attr.namespace then "#{attr.namespace.prefix}:#{attr.name}"
|
127
|
-
else attr.name
|
128
|
-
end
|
129
|
-
|
130
|
-
attr_params = known_attributes[attr_name]
|
131
|
-
|
132
|
-
next if attr_params.nil?
|
133
|
-
# raise "Unknown attribute [#{attr_name}] for element [#{node.name}]" if attr_params.nil?
|
134
|
-
process_attribute(obj, attr.value, attr_params) unless attr_params[:computed]
|
135
|
-
}
|
136
|
-
|
137
|
-
known_child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
|
138
|
-
|
139
|
-
unless known_child_nodes.empty?
|
140
|
-
known_namespaces ||= obtain_class_variable(:@@ooxml_namespaces)
|
141
|
-
|
142
|
-
node.element_children.each { |child_node|
|
143
|
-
|
144
|
-
ns = child_node.namespace
|
145
|
-
prefix = known_namespaces[ns.href] || ns.prefix
|
146
|
-
|
147
|
-
child_node_name = case prefix
|
148
|
-
when '', nil then child_node.name
|
149
|
-
else "#{prefix}:#{child_node.name}"
|
150
|
-
end
|
151
|
-
|
152
|
-
child_node_params = known_child_nodes[child_node_name]
|
153
|
-
raise "Unknown child node [#{child_node_name}] for element [#{node.name}]" if child_node_params.nil?
|
154
|
-
parsed_object = child_node_params[:class].parse(child_node, known_namespaces)
|
155
|
-
if child_node_params[:is_array] then
|
156
|
-
index = parsed_object.index_in_collection
|
157
|
-
|
158
|
-
collection = if (self < RubyXL::OOXMLContainerObject) then obj
|
159
|
-
else obj.send(child_node_params[:accessor])
|
160
|
-
end
|
161
|
-
|
162
|
-
if index.nil? then
|
163
|
-
collection << parsed_object
|
164
|
-
else
|
165
|
-
collection[index] = parsed_object
|
166
|
-
end
|
167
|
-
else
|
168
|
-
obj.send("#{child_node_params[:accessor]}=", parsed_object)
|
169
|
-
end
|
170
|
-
}
|
171
|
-
end
|
172
|
-
|
173
|
-
obj
|
174
|
-
end
|
175
|
-
|
176
|
-
private
|
177
|
-
def accessorize(str)
|
178
|
-
acc = str.to_s.dup
|
179
|
-
acc.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
180
|
-
acc.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
181
|
-
acc.gsub!(':','_')
|
182
|
-
acc.downcase.to_sym
|
183
|
-
end
|
184
|
-
|
185
|
-
def process_attribute(obj, raw_value, params)
|
186
|
-
val = raw_value &&
|
187
|
-
case params[:attr_type]
|
188
|
-
when :double then Float(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_double.html
|
189
|
-
when :string then raw_value
|
190
|
-
when Array then raw_value # Case of Simple Types
|
191
|
-
when :sqref then RubyXL::Sqref.new(raw_value)
|
192
|
-
when :ref then RubyXL::Reference.new(raw_value)
|
193
|
-
when :bool then ['1', 'true'].include?(raw_value)
|
194
|
-
when :int then Integer(raw_value)
|
195
|
-
when :uint then
|
196
|
-
v = Integer(raw_value)
|
197
|
-
raise ArgumentError.new("invalid value for unsigned Integer(): \"#{raw_value}\"") if v < 0
|
198
|
-
v
|
199
|
-
end
|
200
|
-
obj.send("#{params[:accessor]}=", val)
|
201
|
-
end
|
202
|
-
|
203
|
-
end
|
204
|
-
|
205
|
-
|
206
|
-
module OOXMLObjectInstanceMethods
|
207
|
-
def self.included(klass)
|
208
|
-
klass.extend RubyXL::OOXMLObjectClassMethods
|
209
|
-
end
|
210
|
-
|
211
|
-
def obtain_class_variable(var_name, default = {})
|
212
|
-
self.class.obtain_class_variable(var_name, default)
|
213
|
-
end
|
214
|
-
private :obtain_class_variable
|
215
|
-
|
216
|
-
def initialize(params = {})
|
217
|
-
obtain_class_variable(:@@ooxml_attributes).each_value { |v|
|
218
|
-
instance_variable_set("@#{v[:accessor]}", params[v[:accessor]]) unless v[:computed]
|
219
|
-
}
|
220
|
-
|
221
|
-
init_child_nodes(params)
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
#
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
# obj.write_xml(
|
253
|
-
#
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
seed_xml
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
# If child node is either
|
302
|
-
# serialize
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
#
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
#
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
#
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
#
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
array_content =
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
#
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
#
|
420
|
-
# directory
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
xml_string = write_xml
|
445
|
-
return if xml_string.empty?
|
446
|
-
zip_stream.put_next_entry(self.xlsx_path.relative_path_from(::Pathname.new("/")))
|
447
|
-
zip_stream.write(xml_string)
|
448
|
-
end
|
449
|
-
|
450
|
-
def file_index
|
451
|
-
root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
|
452
|
-
end
|
453
|
-
|
454
|
-
end
|
455
|
-
|
456
|
-
end
|
1
|
+
require 'rubyXL/objects/reference'
|
2
|
+
|
3
|
+
module RubyXL
|
4
|
+
module OOXMLObjectClassMethods
|
5
|
+
# Get the value of a [sub]class variable if it exists, or create the respective variable
|
6
|
+
# with the passed-in +default+ (or +{}+, if not specified)
|
7
|
+
#
|
8
|
+
# Throughout this class, we are setting class variables through explicit method calls
|
9
|
+
# rather than by directly addressing the name of the variable because of context issues:
|
10
|
+
# addressing variable by name creates it in the context of defining class, while calling
|
11
|
+
# the setter/getter method addresses it in the context of descendant class,
|
12
|
+
# which is what we need.
|
13
|
+
def obtain_class_variable(var_name, default = {})
|
14
|
+
self.class_variable_get(var_name)
|
15
|
+
rescue NameError
|
16
|
+
self.class_variable_set(var_name, default)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Defines an attribute of OOXML object.
|
20
|
+
# === Parameters
|
21
|
+
# * +attribute_name+ - Name of the element attribute as seen in the source XML. Can be either <tt>"String"</tt> or <tt>:Symbol</tt>
|
22
|
+
# * Special attibute name <tt>'_'</tt> (underscore) denotes the value of the element rather than attribute.
|
23
|
+
# * +attribute_type+ - Specifies the conversion type for the attribute when parsing. Available options are:
|
24
|
+
# * +:int+ - <tt>Integer</tt>
|
25
|
+
# * +:uint+ - Unsigned <tt>Integer</tt>
|
26
|
+
# * +:double+ - <tt>Float</tt></u>
|
27
|
+
# * +:string+ - <tt>String</tt> (no conversion)
|
28
|
+
# * +:sqref+ - RubyXL::Sqref
|
29
|
+
# * +:ref+ - RubyXL::Reference
|
30
|
+
# * +:bool+ - <tt>Boolean</tt> ("1" and "true" convert to +true+, others to +false+)
|
31
|
+
# * one of +simple_types+ - <tt>String</tt>, plus the list of acceptable values is saved for future validation (not used yet).
|
32
|
+
# * +extra_parameters+ - Hash of optional parameters as follows:
|
33
|
+
# * +:accessor+ - Name of the accessor for this attribute to be defined on the object. If not provided, defaults to classidied +attribute_name+.
|
34
|
+
# * +:default+ - Value this attribute defaults to if not explicitly provided.
|
35
|
+
# * +:required+ - Whether this attribute is required when writing XML. If the value of the attrinute is not explicitly provided, +:default+ is written instead.
|
36
|
+
# * +:computed+ - Do not store this attribute on +parse+, but do call the object-provided read accessor on +write_xml+.
|
37
|
+
# ==== Examples
|
38
|
+
# define_attribute(:outline, :bool, :default => true)
|
39
|
+
# A <tt>Boolean</tt> attribute 'outline' with default value +true+ will be accessible by calling +obj.outline+
|
40
|
+
# define_attribute(:uniqueCount, :int)
|
41
|
+
# An <tt>Integer</tt> attribute 'uniqueCount' accessible as +obj.unique_count+
|
42
|
+
# define_attribute(:_, :string, :accessor => :expression)
|
43
|
+
# The value of the element will be accessible as a <tt>String</tt> by calling +obj.expression+
|
44
|
+
# define_attribute(:errorStyle, %w{ stop warning information }, :default => 'stop',)
|
45
|
+
# A <tt>String</tt> attribute named 'errorStyle' will be accessible as +obj.error_style+, valid values are <tt>"stop"</tt>, <tt>"warning"</tt>, <tt>"information"</tt>
|
46
|
+
def define_attribute(attr_name, attr_type, extra_params = {})
|
47
|
+
attrs = obtain_class_variable(:@@ooxml_attributes)
|
48
|
+
attr_hash = extra_params.merge({ :attr_type => attr_type })
|
49
|
+
attr_hash[:accessor] ||= accessorize(attr_name)
|
50
|
+
attrs[attr_name.to_s] = attr_hash
|
51
|
+
self.send(:attr_accessor, attr_hash[:accessor]) unless attr_hash[:computed]
|
52
|
+
end
|
53
|
+
|
54
|
+
# Defines a child node of OOXML object.
|
55
|
+
# === Parameters
|
56
|
+
# * +klass+ - Class (descendant of RubyXL::OOXMLObject) of the child nodes. Child node objects will be produced by calling +parse+ method of that class.
|
57
|
+
# * +extra_parameters+ - Hash of optional parameters as follows:
|
58
|
+
# * +:accessor+ - Name of the accessor for this attribute to be defined on the object. If not provided, defaults to classidied +attribute_name+.
|
59
|
+
# * +:node_name+ - Node name for the child node, in case it does not match the one defined by the +klass+.
|
60
|
+
# * +:collection+ - Whether the child node should be treated as a single node or a collection of nodes:
|
61
|
+
# * +false+ (default) - child node is directly accessible through the respective accessor;
|
62
|
+
# * +true+ - a collection of child nodes is accessed as +Array+ through the respective accessor;
|
63
|
+
# * +:with_count+ - same as +true+, but in addition, the attribute +count+ is defined on the current object, that will be automatically set to the number of elements in the collection at the start of +write_xml+ call.
|
64
|
+
# ==== Examples
|
65
|
+
# define_child_node(RubyXL::Alignment)
|
66
|
+
# Define a singular child node parsed by the RubyXL::BorderEdge.parse() and accessed by the default <tt>obj.alignment</tt> accessor
|
67
|
+
# define_child_node(RubyXL::Hyperlink, :collection => true, :accessor => :hyperlinks)
|
68
|
+
# Define an array of nodes accessed by <tt>obj.hyperlinks</tt> accessor, each of which will be parsed by the RubyXL::Hyperlink.parse()
|
69
|
+
# define_child_node(RubyXL::BorderEdge, :node_name => :left)
|
70
|
+
# define_child_node(RubyXL::BorderEdge, :node_name => :right)
|
71
|
+
# Use class RubyXL::BorderEdge when parsing both the elements <tt><left ...></tt> and <tt><right ...></tt> elements.
|
72
|
+
# define_child_node(RubyXL::Font, :collection => :with_count, :accessor => :fonts)
|
73
|
+
# Upon writing of the object this was defined on, its <tt>count</tt> attribute will be set to the count of nodes in <tt>fonts</tt> array
|
74
|
+
def define_child_node(klass, extra_params = {})
|
75
|
+
child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
|
76
|
+
child_node_name = (extra_params[:node_name] || klass.class_variable_get(:@@ooxml_tag_name)).to_s
|
77
|
+
accessor = (extra_params[:accessor] || accessorize(child_node_name)).to_sym
|
78
|
+
|
79
|
+
child_nodes[child_node_name] = {
|
80
|
+
:class => klass,
|
81
|
+
:is_array => extra_params[:collection],
|
82
|
+
:accessor => accessor
|
83
|
+
}
|
84
|
+
|
85
|
+
define_count_attribute if extra_params[:collection] == :with_count
|
86
|
+
|
87
|
+
self.send(:attr_accessor, accessor)
|
88
|
+
end
|
89
|
+
|
90
|
+
def define_count_attribute
|
91
|
+
define_attribute(:count, :uint, :required => true)
|
92
|
+
end
|
93
|
+
private :define_count_attribute
|
94
|
+
|
95
|
+
# Defines the name of the element that represents the current OOXML object. Should only be used once per object.
|
96
|
+
# In case of different objects represented by the same class in different parts of OOXML tree, +:node_name+
|
97
|
+
# extra parameter can be used to override the default element name.
|
98
|
+
# === Parameters
|
99
|
+
# * +element_name+
|
100
|
+
# ==== Examples
|
101
|
+
# define_element_name 'externalReference'
|
102
|
+
def define_element_name(element_name)
|
103
|
+
self.class_variable_set(:@@ooxml_tag_name, element_name)
|
104
|
+
end
|
105
|
+
|
106
|
+
def parse(node, known_namespaces = nil)
|
107
|
+
case node
|
108
|
+
when String, IO, Zip::InputStream then node = Nokogiri::XML.parse(node)
|
109
|
+
end
|
110
|
+
|
111
|
+
if node.is_a?(Nokogiri::XML::Document) then
|
112
|
+
@namespaces = node.namespaces
|
113
|
+
node = node.root
|
114
|
+
# ignorable_attr = node.attributes['Ignorable']
|
115
|
+
# @ignorables << ignorable_attr.value if ignorable_attr
|
116
|
+
end
|
117
|
+
|
118
|
+
obj = self.new
|
119
|
+
|
120
|
+
known_attributes = obtain_class_variable(:@@ooxml_attributes)
|
121
|
+
|
122
|
+
content_params = known_attributes['_']
|
123
|
+
process_attribute(obj, node.text, content_params) if content_params
|
124
|
+
|
125
|
+
node.attributes.each_pair { |attr_name, attr|
|
126
|
+
attr_name = if attr.namespace then "#{attr.namespace.prefix}:#{attr.name}"
|
127
|
+
else attr.name
|
128
|
+
end
|
129
|
+
|
130
|
+
attr_params = known_attributes[attr_name]
|
131
|
+
|
132
|
+
next if attr_params.nil?
|
133
|
+
# raise "Unknown attribute [#{attr_name}] for element [#{node.name}]" if attr_params.nil?
|
134
|
+
process_attribute(obj, attr.value, attr_params) unless attr_params[:computed]
|
135
|
+
}
|
136
|
+
|
137
|
+
known_child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
|
138
|
+
|
139
|
+
unless known_child_nodes.empty?
|
140
|
+
known_namespaces ||= obtain_class_variable(:@@ooxml_namespaces)
|
141
|
+
|
142
|
+
node.element_children.each { |child_node|
|
143
|
+
|
144
|
+
ns = child_node.namespace
|
145
|
+
prefix = known_namespaces[ns.href] || ns.prefix
|
146
|
+
|
147
|
+
child_node_name = case prefix
|
148
|
+
when '', nil then child_node.name
|
149
|
+
else "#{prefix}:#{child_node.name}"
|
150
|
+
end
|
151
|
+
|
152
|
+
child_node_params = known_child_nodes[child_node_name]
|
153
|
+
raise "Unknown child node [#{child_node_name}] for element [#{node.name}]" if child_node_params.nil?
|
154
|
+
parsed_object = child_node_params[:class].parse(child_node, known_namespaces)
|
155
|
+
if child_node_params[:is_array] then
|
156
|
+
index = parsed_object.index_in_collection
|
157
|
+
|
158
|
+
collection = if (self < RubyXL::OOXMLContainerObject) then obj
|
159
|
+
else obj.send(child_node_params[:accessor])
|
160
|
+
end
|
161
|
+
|
162
|
+
if index.nil? then
|
163
|
+
collection << parsed_object
|
164
|
+
else
|
165
|
+
collection[index] = parsed_object
|
166
|
+
end
|
167
|
+
else
|
168
|
+
obj.send("#{child_node_params[:accessor]}=", parsed_object)
|
169
|
+
end
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
obj
|
174
|
+
end
|
175
|
+
|
176
|
+
private
|
177
|
+
def accessorize(str)
|
178
|
+
acc = str.to_s.dup
|
179
|
+
acc.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
180
|
+
acc.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
181
|
+
acc.gsub!(':','_')
|
182
|
+
acc.downcase.to_sym
|
183
|
+
end
|
184
|
+
|
185
|
+
def process_attribute(obj, raw_value, params)
|
186
|
+
val = raw_value &&
|
187
|
+
case params[:attr_type]
|
188
|
+
when :double then Float(raw_value) # http://www.datypic.com/sc/xsd/t-xsd_double.html
|
189
|
+
when :string then raw_value
|
190
|
+
when Array then raw_value # Case of Simple Types
|
191
|
+
when :sqref then RubyXL::Sqref.new(raw_value)
|
192
|
+
when :ref then RubyXL::Reference.new(raw_value)
|
193
|
+
when :bool then ['1', 'true'].include?(raw_value)
|
194
|
+
when :int then Integer(raw_value)
|
195
|
+
when :uint then
|
196
|
+
v = Integer(raw_value)
|
197
|
+
raise ArgumentError.new("invalid value for unsigned Integer(): \"#{raw_value}\"") if v < 0
|
198
|
+
v
|
199
|
+
end
|
200
|
+
obj.send("#{params[:accessor]}=", val)
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
module OOXMLObjectInstanceMethods
|
207
|
+
def self.included(klass)
|
208
|
+
klass.extend RubyXL::OOXMLObjectClassMethods
|
209
|
+
end
|
210
|
+
|
211
|
+
def obtain_class_variable(var_name, default = {})
|
212
|
+
self.class.obtain_class_variable(var_name, default)
|
213
|
+
end
|
214
|
+
private :obtain_class_variable
|
215
|
+
|
216
|
+
def initialize(params = {})
|
217
|
+
obtain_class_variable(:@@ooxml_attributes).each_value { |v|
|
218
|
+
instance_variable_set("@#{v[:accessor]}", params[v[:accessor]]) unless v[:computed]
|
219
|
+
}
|
220
|
+
|
221
|
+
init_child_nodes(params)
|
222
|
+
end
|
223
|
+
|
224
|
+
def init_child_nodes(params)
|
225
|
+
obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
|
226
|
+
|
227
|
+
initial_value =
|
228
|
+
if params.has_key?(v[:accessor]) then params[v[:accessor]]
|
229
|
+
elsif v[:is_array] then []
|
230
|
+
else nil
|
231
|
+
end
|
232
|
+
|
233
|
+
instance_variable_set("@#{v[:accessor]}", initial_value)
|
234
|
+
}
|
235
|
+
end
|
236
|
+
private :init_child_nodes
|
237
|
+
|
238
|
+
def ==(other)
|
239
|
+
other.is_a?(self.class) &&
|
240
|
+
obtain_class_variable(:@@ooxml_attributes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) } &&
|
241
|
+
obtain_class_variable(:@@ooxml_child_nodes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) }
|
242
|
+
end
|
243
|
+
|
244
|
+
# Recursively write the OOXML object and all its children out as Nokogiri::XML. Immediately before the actual
|
245
|
+
# generation, +before_write_xml()+ is called to perform last-minute cleanup and validation operations; if it
|
246
|
+
# returns +false+, an empty string is returned (rather than +nil+, so Nokogiri::XML's <tt><<</tt> operator
|
247
|
+
# can be used without additional +nil+ checking)
|
248
|
+
# === Parameters
|
249
|
+
# * +xml+ - Base Nokogiri::XML object used for building. If omitted, a blank document will be generated.
|
250
|
+
# * +node_name_override+ - if present, is used instead of the default element name for this object provided by +define_element_name+
|
251
|
+
# ==== Examples
|
252
|
+
# obj.write_xml()
|
253
|
+
# Creates a new empty +Nokogiri::XML+, populates it with the OOXML structure as described in the respective definition, and returns the resulting +Nokogiri::XML+ object.
|
254
|
+
# obj.write_xml(seed_xml)
|
255
|
+
# Using the passed-in +Nokogiri+ +xml+ object, creates a new element corresponding to +obj+ according to its definition, along with all its properties and children, and returns the newly created element.
|
256
|
+
# obj.write_xml(seed_xml, 'overriden_element_name')
|
257
|
+
# Same as above, but uses the passed-in +node_name_override+ as the new element name, instead of its default name set by +define_element_name+.
|
258
|
+
def write_xml(xml = nil, node_name_override = nil)
|
259
|
+
if xml.nil? then
|
260
|
+
seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
|
261
|
+
seed_xml.encoding = 'UTF-8'
|
262
|
+
result = self.write_xml(seed_xml)
|
263
|
+
return result if result == ''
|
264
|
+
seed_xml << result
|
265
|
+
return seed_xml.to_xml({ :indent => 0, :save_with => Nokogiri::XML::Node::SaveOptions::AS_XML })
|
266
|
+
end
|
267
|
+
|
268
|
+
return '' unless before_write_xml
|
269
|
+
|
270
|
+
# Populate namespaces, if any
|
271
|
+
attrs = {}
|
272
|
+
obtain_class_variable(:@@ooxml_namespaces).each_pair { |k, v| attrs[v.empty? ? 'xmlns' : "xmlns:#{v}"] = k }
|
273
|
+
|
274
|
+
obtain_class_variable(:@@ooxml_attributes).each_pair { |k, v|
|
275
|
+
val = self.send(v[:accessor])
|
276
|
+
|
277
|
+
if val.nil? then
|
278
|
+
next unless v[:required]
|
279
|
+
val = v[:default]
|
280
|
+
end
|
281
|
+
|
282
|
+
val = val &&
|
283
|
+
case v[:attr_type]
|
284
|
+
when :bool then val ? '1' : '0'
|
285
|
+
when :double then val.to_s.gsub(/\.0*\Z/, '') # Trim trailing zeroes
|
286
|
+
else val
|
287
|
+
end
|
288
|
+
|
289
|
+
attrs[k] = val
|
290
|
+
}
|
291
|
+
|
292
|
+
element_text = attrs.delete('_')
|
293
|
+
elem = xml.create_element(node_name_override || obtain_class_variable(:@@ooxml_tag_name), attrs, element_text)
|
294
|
+
|
295
|
+
child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
|
296
|
+
child_nodes.each_pair { |child_node_name, child_node_params|
|
297
|
+
node_obj = get_node_object(child_node_params)
|
298
|
+
next if node_obj.nil?
|
299
|
+
|
300
|
+
if node_obj.respond_to?(:write_xml) && !node_obj.equal?(self) then
|
301
|
+
# If child node is either +OOXMLObject+, or +OOXMLContainerObject+ on its first (envelope) pass,
|
302
|
+
# serialize that object.
|
303
|
+
elem << node_obj.write_xml(xml, child_node_name)
|
304
|
+
else
|
305
|
+
# If child node is either vanilla +Array+, or +OOXMLContainerObject+ on its seconds (content) pass,
|
306
|
+
# serialize write its members.
|
307
|
+
node_obj.each { |item| elem << item.write_xml(xml, child_node_name) unless item.nil? }
|
308
|
+
end
|
309
|
+
}
|
310
|
+
elem
|
311
|
+
end
|
312
|
+
|
313
|
+
# Prototype method. For sparse collections (+Rows+, +Cells+, etc.) must return index at which this object
|
314
|
+
# is expected to reside in the collection. If +nil+ is returned, then object is simply added
|
315
|
+
# to the end of the collection.
|
316
|
+
def index_in_collection
|
317
|
+
nil
|
318
|
+
end
|
319
|
+
|
320
|
+
def get_node_object(child_node_params)
|
321
|
+
self.send(child_node_params[:accessor])
|
322
|
+
end
|
323
|
+
private :get_node_object
|
324
|
+
|
325
|
+
# Subclass provided filter to perform last-minute operations (cleanup, count, etc.) immediately prior to write,
|
326
|
+
# along with option to terminate the actual write if +false+ is returned (for example, to avoid writing
|
327
|
+
# the collection's root node if the collection is empty).
|
328
|
+
def before_write_xml
|
329
|
+
#TODO# This will go away once containers are fully implemented.
|
330
|
+
child_nodes = obtain_class_variable(:@@ooxml_child_nodes)
|
331
|
+
child_nodes.each_pair { |child_node_name, child_node_params|
|
332
|
+
self.count = self.send(child_node_params[:accessor]).size if child_node_params[:is_array] == :with_count
|
333
|
+
}
|
334
|
+
true
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
|
339
|
+
# Parent class for defining OOXML based objects (not unlike Rails' +ActiveRecord+!)
|
340
|
+
# Most importantly, provides functionality of parsing such objects from XML,
|
341
|
+
# and marshalling them to XML.
|
342
|
+
class OOXMLObject
|
343
|
+
include OOXMLObjectInstanceMethods
|
344
|
+
end
|
345
|
+
|
346
|
+
# Parent class for OOXML conainer objects (for example,
|
347
|
+
# <tt><fonts><font>...</font><font>...</font></fonts></tt>
|
348
|
+
# that obscures the top-level container, allowing direct access to the contents as +Array+.
|
349
|
+
class OOXMLContainerObject < Array
|
350
|
+
include OOXMLObjectInstanceMethods
|
351
|
+
|
352
|
+
def initialize(params = {})
|
353
|
+
array_content = params.delete(:_)
|
354
|
+
super
|
355
|
+
array_content.each_with_index { |v, i| self[i] = v } if array_content
|
356
|
+
end
|
357
|
+
|
358
|
+
def get_node_object(child_node_params)
|
359
|
+
if child_node_params[:is_array] then self
|
360
|
+
else super
|
361
|
+
end
|
362
|
+
end
|
363
|
+
protected :get_node_object
|
364
|
+
|
365
|
+
def init_child_nodes(params)
|
366
|
+
obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
|
367
|
+
next if v[:is_array] # Only one collection node allowed per OOXMLContainerObject, and it is contained in itself.
|
368
|
+
instance_variable_set("@#{v[:accessor]}", params[v[:accessor]])
|
369
|
+
}
|
370
|
+
end
|
371
|
+
protected :init_child_nodes
|
372
|
+
|
373
|
+
def before_write_xml
|
374
|
+
true
|
375
|
+
end
|
376
|
+
|
377
|
+
def inspect
|
378
|
+
vars = [ super ]
|
379
|
+
vars = self.instance_variables.each { |v| vars << "#{v}=#{instance_variable_get(v).inspect}" }
|
380
|
+
"<#{self.class}: #{super} #{vars.join(", ")}>"
|
381
|
+
end
|
382
|
+
|
383
|
+
class << self
|
384
|
+
def define_count_attribute
|
385
|
+
# Count will be inherited from Array. so no need to define it explicitly.
|
386
|
+
define_attribute(:count, :uint, :required => true, :computed => true)
|
387
|
+
end
|
388
|
+
protected :define_count_attribute
|
389
|
+
end
|
390
|
+
|
391
|
+
end
|
392
|
+
|
393
|
+
# Extension class providing functionality for top-level OOXML objects that are represented by
|
394
|
+
# their own <tt>.xml</tt> files in <tt>.xslx</tt> zip container.
|
395
|
+
class OOXMLTopLevelObject < OOXMLObject
|
396
|
+
SAVE_ORDER = 500
|
397
|
+
ROOT = ::Pathname.new('/')
|
398
|
+
|
399
|
+
attr_accessor :root
|
400
|
+
|
401
|
+
# Prototype method. For top-level OOXML object, returns the path at which the current object's XML file
|
402
|
+
# is located within the <tt>.xslx</tt> zip container.
|
403
|
+
def xlsx_path
|
404
|
+
raise 'Subclass responsebility'
|
405
|
+
end
|
406
|
+
|
407
|
+
# Sets the list of namespaces on this object to be added when writing out XML. Valid only on top-level objects.
|
408
|
+
# === Parameters
|
409
|
+
# * +namespace_hash+ - Hash of namespaces in the form of <tt>"prefix" => "url"</tt>
|
410
|
+
# ==== Examples
|
411
|
+
# set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => '',
|
412
|
+
# 'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r')
|
413
|
+
def self.set_namespaces(namespace_hash)
|
414
|
+
self.class_variable_set(:@@ooxml_namespaces, namespace_hash)
|
415
|
+
end
|
416
|
+
|
417
|
+
# Generates the top-level OOXML object by parsing its XML file from the temporary
|
418
|
+
# directory containing the unzipped contents of <tt>.xslx</tt>
|
419
|
+
# === Parameters
|
420
|
+
# * +dirpath+ - path to the directory with the unzipped <tt>.xslx</tt> contents.
|
421
|
+
def self.parse_file(zip_file, file_path)
|
422
|
+
entry = zip_file.find_entry(RubyXL::from_root(file_path))
|
423
|
+
# Accomodate for Nokogiri Java implementation which is incapable of reading from a stream
|
424
|
+
entry && (entry.get_input_stream { |f| parse(defined?(JRUBY_VERSION) ? f.read : f) })
|
425
|
+
end
|
426
|
+
|
427
|
+
# Saves the contents of the object as XML to respective location in <tt>.xslx</tt> zip container.
|
428
|
+
# === Parameters
|
429
|
+
# * +zipfile+ - ::Zip::File to which the resulting XNMML should be added.
|
430
|
+
def add_to_zip(zip_stream)
|
431
|
+
xml_string = write_xml
|
432
|
+
return if xml_string.empty?
|
433
|
+
zip_stream.put_next_entry(RubyXL::from_root(self.xlsx_path))
|
434
|
+
zip_stream.write(xml_string)
|
435
|
+
end
|
436
|
+
|
437
|
+
def file_index
|
438
|
+
root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
|
439
|
+
end
|
440
|
+
|
441
|
+
end
|
442
|
+
|
443
|
+
end
|