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
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #chart)
Returns the value of attribute data.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Instance Attribute Details
#data ⇒ Object Also known as: chart
Returns the value of attribute data.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 7 def data @data end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 7 def type @type end |
Class Method Details
.parse(graphic_node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb', line 11 def self.parse(graphic_node) graphic = DocxGraphic.new graphic_node.xpath('a:graphicData/*', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |graphic_data_node_child| case graphic_data_node_child.name when 'wsp' graphic.type = :shape graphic.data = DocxShape.parse(graphic_data_node_child) when 'pic' graphic.type = :picture graphic.data = DocxPicture.parse(graphic_data_node_child) when 'chart' graphic.type = :chart OOXMLDocumentObject.add_to_xmls_stack("#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(graphic_data_node_child.attribute('id').value)}") graphic.data = Chart.parse OOXMLDocumentObject.xmls_stack.pop when 'wgp' graphic.type = :group graphic.data = DocxGroupedDrawing.parse(graphic_data_node_child) end end graphic end |