Class: OoxmlParser::DocxShape
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxShape
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb
Overview
Class for parsing sp, wsp tags
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body_properties ⇒ Object
Returns the value of attribute body_properties.
-
#non_visual_properties ⇒ Object
Returns the value of attribute non_visual_properties.
-
#properties ⇒ Object
(also: #shape_properties)
Returns the value of attribute properties.
-
#style ⇒ Object
Returns the value of attribute style.
-
#text_body ⇒ Object
Returns the value of attribute text_body.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DocxShape
Parse DocxShape object.
-
#with_data? ⇒ True, false
If structure contain any user data.
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
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#body_properties ⇒ Object
Returns the value of attribute body_properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 9 def body_properties @body_properties end |
#non_visual_properties ⇒ Object
Returns the value of attribute non_visual_properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 9 def non_visual_properties @non_visual_properties end |
#properties ⇒ Object Also known as: shape_properties
Returns the value of attribute properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 9 def properties @properties end |
#style ⇒ Object
Returns the value of attribute style.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 9 def style @style end |
#text_body ⇒ Object
Returns the value of attribute text_body.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 9 def text_body @text_body end |
Instance Method Details
#parse(node) ⇒ DocxShape
Parse DocxShape object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 24 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'nvSpPr' @non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child) when 'spPr' @properties = DocxShapeProperties.new(parent: self).parse(node_child) when 'txbx' @text_body = OOXMLTextBox.new(parent: self).parse(node_child) when 'txBody' @text_body = TextBody.new(parent: self).parse(node_child) when 'bodyPr' @body_properties = OOXMLShapeBodyProperties.new(parent: self).parse(node_child) end end self end |
#with_data? ⇒ True, false
Returns if structure contain any user data.
14 15 16 17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 14 def with_data? return true if @text_body.nil? return true if @text_body.paragraphs.length > 1 return true unless @text_body.paragraphs.first.runs.empty? false end |