Sha256: 4c2d78390d95dbca6f6be98a6edaf3a4a5f492abafd6409ea8320880778c29cb

Contents?: true

Size: 852 Bytes

Versions: 4

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for working with TextBox (w:txbxContent)
  class TextBox < OOXMLDocumentObject
    # Parse TextBox List
    # @param [Nokogiri::XML:Node] node with TextBox
    # @return [Array] array of elements
    def parse_list(node)
      elements = []
      text_box_content_node = node.xpath('w:txbxContent').first

      text_box_content_node&.xpath('*')&.each_with_index do |textbox_element, i|
        case textbox_element.name
        when 'p'
          textbox_paragraph = DocxParagraph.new
          textbox_paragraph.spacing = Spacing.new(0, 0.35, 1.15, :multiple)
          elements << textbox_paragraph.parse(textbox_element, i, parent: parent)
        when 'tbl'
          elements << Table.new(parent: parent).parse(textbox_element, i)
        end
      end
      elements
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb