Class: OoxmlParser::OOXMLDocumentObject
- Inherits:
-
Object
- Object
- OoxmlParser::OOXMLDocumentObject
- Defined in:
- lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb
Overview
Basic class for any OOXML Document Object
Direct Known Subclasses
AbstractNumbering, Accent, AlphaModFix, AlternateContent, AnimationEffect, ArgumentProperties, ArgumentSize, Author, Autofilter, Background, BackgroundProperties, Bar, Behavior, Blip, BlipFill, BookmarkEnd, BookmarkStart, Border, BordersProperties, Box, BulletImage, CacheField, CacheFields, CacheSource, CellProperties, CellXfs, Chart, ChartAxis, ChartAxisTitle, ChartCellsRange, ChartLegend, ChartReference, ChartStyle, ChartStyleEntry, ChartStyleFile, Chartsheet, CheckBox, CheckBoxState, Choice, ClientData, Color, ColorAlphaChannel, ColorProperties, ColorScale, Column, ColumnRowItem, ColumnRowItems, Columns, ComboBox, Comment, CommentAuthor, CommentAuthors, CommentExtended, CommentList, CommentRangeEnd, CommentRangeStart, Comments, CommentsExtended, CommonChartData, CommonDocumentStructure, CommonNonVisualProperties, CommonSlideData, CommonTiming, Condition, ConditionList, ConditionalFormatValueObject, ConditionalFormatting, ConditionalFormattingIcon, ConditionalFormattingRule, ConditionalFormattings, ContentTypeDefault, ContentTypeOverride, ContentTypes, CustomFilter, CustomFilters, DataBar, DataField, DataFields, DataValidation, DataValidationFormula, DataValidations, DefinedName, Delimiter, DifferentialFormattingRecord, DifferentialFormattingRecords, DisplayLabelsProperties, DocProperties, DocumentBackground, DocumentDefaults, DocumentGrid, DocumentProperties, DocumentSettings, DocumentStyle, DocxBlip, DocxColor, DocxColorScheme, DocxDrawing, DocxDrawingDistanceFromText, DocxDrawingPosition, DocxDrawingProperties, DocxFormula, DocxGraphic, DocxParagraph, DocxParagraphRun, DocxPatternFill, DocxPicture, DocxShape, DocxShapeLine, DocxShapeLineElement, DocxShapeLinePath, DocxShapeProperties, DocxShapeSize, DocxWrapDrawing, DropdownList, ExcelComment, ExcelComments, Extension, ExtensionList, Field, FieldChar, FieldSimple, FileReference, Fill, Fills, FilterColumn, Font, FontCollection, FontReference, FontScheme, Fonts, FootnoteProperties, FormProperties, FormTextComb, FormTextFormat, FormTextProperties, Formula, Fraction, FrameProperties, Function, GradientColor, GradientStop, GraphicFrame, GridColumn, GridSpan, GroupChar, HeaderFooter, HeaderFooterChild, HeaderFooterReference, Hyperlink, IconSet, ImageFill, Indents, Index, Inserted, Item, Items, LevelJustification, LevelText, Limit, LineEnd, LineJoin, LinearGradient, ListItem, Location, MarkerLayout, MathParagraph, MathRun, MathRunProperties, MathText, Matrix, MatrixRow, MultilevelType, Nary, NaryGrow, NaryLimitLocation, NaryProperties, NonVisualProperties, NonVisualShapeProperties, Note, NumberFormat, NumberFormats, NumberStringCache, NumberStringReference, Numbering, NumberingDefinition, NumberingFormat, NumberingLevel, NumberingProperties, OOXMLCoordinates, OOXMLCustomGeometry, OOXMLShapeBodyProperties, OOXMLTextBox, OldDocxGroup, OldDocxPicture, OldDocxShape, OldDocxShapeFill, OldDocxShapeProperties, OleObject, OleObjects, OoxmlColor, Outline, PageBorders, PageField, PageFields, PageMargins, PageProperties, PageSetup, PageSize, Pane, Paragraph, ParagraphBorders, ParagraphProperties, ParagraphPropertiesDefault, ParagraphRun, ParagraphSpacing, ParagraphStyleRef, PatternFill, PictureDimension, PivotCache, PivotCacheDefinition, PivotField, PivotFields, PivotFormat, PivotFormats, PivotTableDefinition, PivotTableStyleInfo, PlotArea, Point, Position, PreSubSuperscript, PresentationAlternateContent, PresentationComment, PresentationComments, PresentationFill, PresentationNotes, PresentationPattern, PresentationTheme, PresetGeometry, PresetTextWarp, ProtectedRange, Protection, Radical, Relationship, Relationships, RowFields, RunFonts, RunObject, RunProperties, RunPropertiesDefault, RunSpacing, RunStyle, SDTContent, SDTProperties, Scaling, Selection, Series, SeriesText, SetTimeNode, Shade, Shape, ShapeAdjustValueList, ShapeGuide, ShapePlaceholder, ShapeStyle, ShapeTree, ShapesGrouping, SharedItems, SharedStringTable, Sheet, SheetFormatProperties, SheetProtection, SheetView, Size, SizeRelativeHorizontal, SizeRelativeVertical, Slide, SlideLayoutFile, SlideMasterFile, SlideSize, Sound, SoundAction, SpacingValuedChild, Sparkline, SparklineGroup, SparklineGroups, Sparklines, Stretch, StringIndex, StructuredDocumentTag, StyleMatrixReference, StyleSheet, Styles, Suffix, Tab, Table, TableBorders, TableCell, TableCellLine, TableColumn, TableColumns, TableElement, TableGrid, TableLayout, TableLook, TableMargins, TablePart, TablePosition, TableProperties, TableRow, TableRowHeight, TableRowProperties, TableStyle, TableStyleColumnBandSize, TableStyleInfo, TableStyleProperties, TableStyleRowBandSize, TableStyles, Tabs, TargetElement, Text, TextBody, TextBox, TextField, TextFill, TextFont, TextOutline, TextValue, ThemeColor, ThemeColors, Tile, TimeNode, TimeNodeList, Timing, Transition, TransitionProperties, Underline, ValuedChild, View3D, Wheel, WorkbookProperties, WorkbookProtection, Worksheet, WorksheetSource, X14DataField, X14Table, XYValues, Xf, XlsxAlignment, XlsxBorder, XlsxBorders, XlsxCell, XlsxColumnProperties, XlsxColumns, XlsxDrawing, XlsxDrawingPositionParameters, XlsxHeaderFooter, XlsxRow
Instance Attribute Summary collapse
-
#parent ⇒ OOXMLDocumentObject
Object which hold current object.
Instance Method Summary collapse
-
#==(other) ⇒ True, False
Compare this object to other.
-
#boolean_attribute_value(value) ⇒ True, False
Value of attribute.
-
#initialize(parent: nil) ⇒ OOXMLDocumentObject
constructor
A new instance of OOXMLDocumentObject.
-
#parse_xml(xml_path) ⇒ Nokogiri::XML::Document
Result of parsing xml via nokogiri.
-
#with_data? ⇒ True, false
If structure contain any user data.
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ OOXMLDocumentObject
Returns a new instance of OOXMLDocumentObject.
19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 19 def initialize(parent: nil) @parent = parent end |
Instance Attribute Details
#parent ⇒ OOXMLDocumentObject
Returns object which hold current object.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 17 def parent @parent end |
Instance Method Details
#==(other) ⇒ True, False
Compare this object to other
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 26 def ==(other) return false if self.class != other.class instance_variables.each do |current_attribute| next if current_attribute == :@parent next if instance_variable_get(current_attribute).is_a?(Nokogiri::XML::Element) return false unless instance_variable_get(current_attribute) == other.instance_variable_get(current_attribute) end true end |
#boolean_attribute_value(value) ⇒ True, False
Returns value of attribute.
45 46 47 48 49 50 51 52 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 45 def boolean_attribute_value(value) return true if value.to_s == '1' return true if value.to_s == 'true' return false if value.to_s == '0' return false if value.to_s == 'false' raise ArgumentError, "Invalid value for boolean attribute: #{value}" end |
#parse_xml(xml_path) ⇒ Nokogiri::XML::Document
Returns result of parsing xml via nokogiri.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 55 def parse_xml(xml_path) xml = Nokogiri::XML(File.open(xml_path), &:strict) unless xml.errors.empty? raise NokogiriParsingException, (xml_path, xml.errors) end xml rescue Nokogiri::XML::SyntaxError => e raise NokogiriParsingException, (xml_path, e) end |
#with_data? ⇒ True, false
Returns if structure contain any user data.
39 40 41 |
# File 'lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb', line 39 def with_data? true end |