Class: OoxmlParser::TextBox

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb

Class Method Summary collapse

Class Method Details

.parse_list(node, parent: nil) ⇒ Array

Parse TextBox List

Parameters:

  • node (Nokogiri::XML:Node)

    with TextBox

Returns:

  • (Array)

    array of elements



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb', line 7

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.dup.parse(textbox_element, i, parent: parent)
      when 'tbl'
        elements << Table.new(parent: parent).parse(textbox_element, i)
      end
    end
  end
  elements
end