class OoxmlParser::DocxShape
Class for parsing `sp`, `wsp` tags
Attributes
body_properties[RW]
non_visual_properties[RW]
properties[RW]
shape_properties[RW]
style[RW]
text_body[RW]
Public Instance Methods
parse(node)
click to toggle source
Parse DocxShape
object @param node [Nokogiri::XML:Element] node to parse @return [DocxShape] result of parsing
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb, line 29 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 'style' @style = ShapeStyle.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?()
click to toggle source
@return [True, false] if structure contain any user data
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb, line 17 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? return true if properties.preset_geometry false end