class OoxmlParser::OOXMLTextBox

Class for parsing ‘txbx` tags

Attributes

elements[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/ooxml_text_box.rb, line 8
def initialize(parent: nil)
  @elements = []
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse OOXMLTextBox object @param node [Nokogiri::XML:Element] node to parse @return [OOXMLTextBox] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb, line 16
def parse(node)
  text_box_content_node = node.xpath('w:txbxContent').first
  text_box_content_node.xpath('*').each_with_index do |node_child, index|
    case node_child.name
    when 'p'
      @elements << DocxParagraph.new(parent: self).parse(node_child, index)
    when 'tbl'
      @elements << Table.new(parent: self).parse(node_child, index)
    end
  end
  self
end