Sha256: 9cbd6d45c1bfb40c8350040c7cd4de08defba628a801b2c9a096b64b5c63611e

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

# Class for working with TextBox (w:txbxContent)
module OoxmlParser
  class TextBox
    # Parse TextBox List
    # @param [Nokogiri::XML:Node] node with TextBox
    # @return [Array] array of elements
    def self.parse_list(node, parent: nil)
      elements = []
      text_box_content_node = node.xpath('w:txbxContent').first
      unless text_box_content_node.nil?
        text_box_content_node.xpath('*').each_with_index do |textbox_element, i|
          case textbox_element.name
          when 'p'
            DocumentStructure.default_paragraph_style = DocxParagraph.new
            DocumentStructure.default_paragraph_style.spacing = Spacing.new(0, 0.35, 1.15, :multiple)
            elements << DocumentStructure.default_paragraph_style.copy.parse(textbox_element, i, parent: parent)
          when 'tbl'
            elements << Table.new(parent: parent).parse(textbox_element, i)
          end
        end
      end
      elements
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb