Sha256: e55f2347acd2561911cb4d3fbde7439d2adedc3c1e72bed460bbd2659b1bab93

Contents?: true

Size: 848 Bytes

Versions: 2

Compression:

Stored size: 848 Bytes

Contents

module OoxmlParser
  class OOXMLTextBox < OOXMLDocumentObject
    attr_accessor :properties, :elements

    def initialize(properties = nil, elements = [])
      @properties = properties
      @elements = elements
    end

    def self.parse(text_body_node)
      text_body = OOXMLTextBox.new
      text_box_content_node = text_body_node.xpath('w:txbxContent').first
      text_box_content_node.xpath('*').each_with_index do |text_body_node_child, index|
        case text_body_node_child.name
        when 'p'
          text_body.elements << DocxParagraph.parse(text_body_node_child, index)
        when 'tbl'
          text_body.elements << Table.parse(text_body_node_child, index)
        when 'bodyPr'
          text_body.properties = OOXMLShapeBodyProperties.parse(text_body_node_child)
        end
      end
      text_body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb
ooxml_parser-0.1.1 lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb