Class: OoxmlParser::DocxGraphic
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxGraphic
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb
Overview
Class for parsing ‘graphic` tags
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #chart)
Returns the value of attribute data.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DocxGraphic
Parse DocxGraphic.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#data ⇒ Object Also known as: chart
Returns the value of attribute data.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 6 def data @data end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 6 def type @type end |
Instance Method Details
#parse(node) ⇒ DocxGraphic
Parse DocxGraphic
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 13 def parse(node) node.xpath('a:graphicData/*', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |node_child| case node_child.name when 'wsp' @type = :shape @data = DocxShape.new(parent: self).parse(node_child) when 'pic' @type = :picture @data = DocxPicture.new(parent: self).parse(node_child) when 'chart' @type = :chart OOXMLDocumentObject.add_to_xmls_stack("#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(node_child.attribute('id').value)}") @data = Chart.parse OOXMLDocumentObject.xmls_stack.pop when 'wgp' @type = :group @data = ShapesGrouping.new(parent: self).parse(node_child) end end self end |