class OoxmlParser::DocxShape
Class for parsing ‘sp`, `wsp` tags
Attributes
body_properties[RW]
locks_text[R]
@return [True, False] Specifies if text in shape is locked when sheet is protected
non_visual_properties[RW]
properties[RW]
shape_properties[RW]
style[RW]
text_body[RW]
Public Class Methods
new(parent: nil)
click to toggle source
Calls superclass method
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb, line 18 def initialize(parent: nil) @locks_text = true super end
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 36 def parse(node) node.attributes.each do |key, value| case key when 'fLocksText' @locks_text = attribute_enabled?(value) end end 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 24 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